forked from farhoodlabs/paperclip
Add planning mode for issue work (#5353)
## Thinking Path > - Paperclip is a control plane for autonomous AI companies. > - Issues are the core unit of work, and issue comments are how board users and agents coordinate execution. > - Some issue conversations need to produce plans and approvals instead of immediate implementation work. > - The existing issue contract did not distinguish standard execution comments from planning-oriented issue work. > - This pull request adds an issue work-mode contract and board UI affordances for standard vs planning mode. > - The benefit is that planning-mode issues can be created, displayed, discussed, and carried through agent heartbeat context without losing the normal issue workflow. ## What Changed - Added `standard` / `planning` issue work-mode contracts across DB, shared validators/types, server issue flows, plugin protocol, and adapter heartbeat payloads. - Added an idempotent `0081_optimal_dormammu` migration for `issues.work_mode`, ordered after current `public-gh/master` migrations. - Updated heartbeat/context summaries and issue-thread interaction behavior so planning work mode is preserved when creating suggested follow-up issues. - Added UI support for planning-mode issue creation, issue rows, detail composer styling, and composer work-mode toggles. - Added focused server/shared/UI tests plus a Playwright visual verification spec for planning-mode surfaces. - Rebased the branch onto current `public-gh/master` and added durable planning-mode screenshots under `doc/assets/pap-3368/`. ## Verification - `pnpm --filter @paperclipai/db run check:migrations` - `pnpm exec vitest run --project @paperclipai/shared packages/shared/src/validators/issue.test.ts` - `pnpm exec vitest run --project @paperclipai/server server/src/__tests__/heartbeat-context-summary.test.ts server/src/__tests__/issue-thread-interactions-service.test.ts server/src/__tests__/issues-goal-context-routes.test.ts --pool=forks --poolOptions.forks.isolate=true` - `pnpm exec vitest run --project @paperclipai/ui ui/src/components/IssueChatThread.test.tsx ui/src/components/NewIssueDialog.test.tsx ui/src/components/IssueRow.test.tsx ui/src/pages/IssueDetail.test.tsx` - `pnpm exec vitest run --project @paperclipai/adapter-utils packages/adapter-utils/src/server-utils.test.ts` - `PAPERCLIP_E2E_SKIP_LLM=true npx playwright test --config tests/e2e/playwright.config.ts tests/e2e/planning-mode-visual-verification.spec.ts` ## Screenshots Desktop planning detail:  Desktop planning row:  Desktop staged standard toggle:  Mobile planning detail:  Mobile planning row:  ## Risks - Medium migration risk: this adds a non-null issue column. The migration uses `ADD COLUMN IF NOT EXISTS` so installations that applied an older branch-local migration number can still apply the final numbered migration safely. - Medium contract risk: issue payloads, plugin payloads, and adapter heartbeat payloads now include work mode; compatibility is handled by defaulting missing values to `standard`. - UI risk is moderate because composer controls changed; focused component tests and visual e2e coverage exercise standard vs planning display and toggle behavior. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - OpenAI Codex, GPT-5 coding agent in a local Paperclip worktree, with shell/tool use. Exact context-window size is not exposed in this runtime. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] If this change affects the UI, I have included before/after screenshots - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 140 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 137 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 61 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
@@ -455,6 +455,114 @@ describe("renderPaperclipWakePrompt", () => {
|
|||||||
expect(prompt).toContain("mark blocked work with the unblock owner/action");
|
expect(prompt).toContain("mark blocked work with the unblock owner/action");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("renders planning-mode directives for assignment and comment wakes", () => {
|
||||||
|
const assignmentPrompt = renderPaperclipWakePrompt({
|
||||||
|
reason: "issue_assigned",
|
||||||
|
issue: {
|
||||||
|
id: "issue-1",
|
||||||
|
identifier: "PAP-3404",
|
||||||
|
title: "Plan first",
|
||||||
|
status: "in_progress",
|
||||||
|
workMode: "planning",
|
||||||
|
},
|
||||||
|
commentWindow: { requestedCount: 0, includedCount: 0, missingCount: 0 },
|
||||||
|
comments: [],
|
||||||
|
fallbackFetchNeeded: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(assignmentPrompt).toContain("- issue work mode: planning");
|
||||||
|
expect(assignmentPrompt).toContain("Make the plan only. Do not write code or perform implementation work.");
|
||||||
|
|
||||||
|
const commentPrompt = renderPaperclipWakePrompt({
|
||||||
|
reason: "issue_commented",
|
||||||
|
issue: {
|
||||||
|
id: "issue-1",
|
||||||
|
identifier: "PAP-3404",
|
||||||
|
title: "Plan first",
|
||||||
|
status: "in_progress",
|
||||||
|
workMode: "planning",
|
||||||
|
},
|
||||||
|
commentIds: ["comment-1"],
|
||||||
|
latestCommentId: "comment-1",
|
||||||
|
commentWindow: { requestedCount: 1, includedCount: 1, missingCount: 0 },
|
||||||
|
comments: [{ id: "comment-1", body: "Revise the plan" }],
|
||||||
|
fallbackFetchNeeded: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(commentPrompt).toContain("Update the plan only. Do not write code or perform implementation work.");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not render stale accepted-plan continuation guidance for later planning comment wakes", () => {
|
||||||
|
const prompt = renderPaperclipWakePrompt({
|
||||||
|
reason: "issue_commented",
|
||||||
|
issue: {
|
||||||
|
id: "issue-1",
|
||||||
|
identifier: "PAP-3404",
|
||||||
|
title: "Plan first",
|
||||||
|
status: "in_progress",
|
||||||
|
workMode: "planning",
|
||||||
|
},
|
||||||
|
interactionKind: "request_confirmation",
|
||||||
|
interactionStatus: "accepted",
|
||||||
|
commentIds: ["comment-1"],
|
||||||
|
latestCommentId: "comment-1",
|
||||||
|
commentWindow: { requestedCount: 1, includedCount: 1, missingCount: 0 },
|
||||||
|
comments: [{ id: "comment-1", body: "Revise the plan" }],
|
||||||
|
fallbackFetchNeeded: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(prompt).toContain("Update the plan only. Do not write code or perform implementation work.");
|
||||||
|
expect(prompt).not.toContain("accepted-plan continuation");
|
||||||
|
expect(prompt).not.toContain("Create child issues from the approved plan only");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("renders accepted-plan continuation guidance for planning issues", () => {
|
||||||
|
const prompt = renderPaperclipWakePrompt({
|
||||||
|
reason: "issue_commented",
|
||||||
|
issue: {
|
||||||
|
id: "issue-1",
|
||||||
|
identifier: "PAP-3404",
|
||||||
|
title: "Plan first",
|
||||||
|
status: "in_progress",
|
||||||
|
workMode: "planning",
|
||||||
|
},
|
||||||
|
interactionKind: "request_confirmation",
|
||||||
|
interactionStatus: "accepted",
|
||||||
|
commentWindow: { requestedCount: 0, includedCount: 0, missingCount: 0 },
|
||||||
|
comments: [],
|
||||||
|
fallbackFetchNeeded: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(prompt).toContain("accepted-plan continuation");
|
||||||
|
expect(prompt).toContain("Create child issues from the approved plan only");
|
||||||
|
expect(prompt).toContain("may create child implementation issues");
|
||||||
|
expect(prompt).toContain("must not start implementation work on the planning issue itself");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("keeps accepted-plan guidance when stale comment ids have no loaded comments", () => {
|
||||||
|
const prompt = renderPaperclipWakePrompt({
|
||||||
|
reason: "issue_commented",
|
||||||
|
issue: {
|
||||||
|
id: "issue-1",
|
||||||
|
identifier: "PAP-3404",
|
||||||
|
title: "Plan first",
|
||||||
|
status: "in_progress",
|
||||||
|
workMode: "planning",
|
||||||
|
},
|
||||||
|
interactionKind: "request_confirmation",
|
||||||
|
interactionStatus: "accepted",
|
||||||
|
commentIds: ["stale-comment-1"],
|
||||||
|
latestCommentId: "stale-comment-1",
|
||||||
|
commentWindow: { requestedCount: 1, includedCount: 0, missingCount: 1 },
|
||||||
|
comments: [],
|
||||||
|
fallbackFetchNeeded: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(prompt).toContain("accepted-plan continuation");
|
||||||
|
expect(prompt).toContain("Create child issues from the approved plan only");
|
||||||
|
expect(prompt).not.toContain("Update the plan only");
|
||||||
|
});
|
||||||
|
|
||||||
it("renders dependency-blocked interaction guidance", () => {
|
it("renders dependency-blocked interaction guidance", () => {
|
||||||
const prompt = renderPaperclipWakePrompt({
|
const prompt = renderPaperclipWakePrompt({
|
||||||
reason: "issue_commented",
|
reason: "issue_commented",
|
||||||
|
|||||||
@@ -281,6 +281,7 @@ type PaperclipWakeIssue = {
|
|||||||
identifier: string | null;
|
identifier: string | null;
|
||||||
title: string | null;
|
title: string | null;
|
||||||
status: string | null;
|
status: string | null;
|
||||||
|
workMode: string | null;
|
||||||
priority: string | null;
|
priority: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -366,6 +367,8 @@ type PaperclipWakePayload = {
|
|||||||
executionStage: PaperclipWakeExecutionStage | null;
|
executionStage: PaperclipWakeExecutionStage | null;
|
||||||
continuationSummary: PaperclipWakeContinuationSummary | null;
|
continuationSummary: PaperclipWakeContinuationSummary | null;
|
||||||
livenessContinuation: PaperclipWakeLivenessContinuation | null;
|
livenessContinuation: PaperclipWakeLivenessContinuation | null;
|
||||||
|
interactionKind: string | null;
|
||||||
|
interactionStatus: string | null;
|
||||||
childIssueSummaries: PaperclipWakeChildIssueSummary[];
|
childIssueSummaries: PaperclipWakeChildIssueSummary[];
|
||||||
childIssueSummaryTruncated: boolean;
|
childIssueSummaryTruncated: boolean;
|
||||||
commentIds: string[];
|
commentIds: string[];
|
||||||
@@ -384,6 +387,7 @@ function normalizePaperclipWakeIssue(value: unknown): PaperclipWakeIssue | null
|
|||||||
const identifier = asString(issue.identifier, "").trim() || null;
|
const identifier = asString(issue.identifier, "").trim() || null;
|
||||||
const title = asString(issue.title, "").trim() || null;
|
const title = asString(issue.title, "").trim() || null;
|
||||||
const status = asString(issue.status, "").trim() || null;
|
const status = asString(issue.status, "").trim() || null;
|
||||||
|
const workMode = asString(issue.workMode, "").trim() || null;
|
||||||
const priority = asString(issue.priority, "").trim() || null;
|
const priority = asString(issue.priority, "").trim() || null;
|
||||||
if (!id && !identifier && !title) return null;
|
if (!id && !identifier && !title) return null;
|
||||||
return {
|
return {
|
||||||
@@ -391,6 +395,7 @@ function normalizePaperclipWakeIssue(value: unknown): PaperclipWakeIssue | null
|
|||||||
identifier,
|
identifier,
|
||||||
title,
|
title,
|
||||||
status,
|
status,
|
||||||
|
workMode,
|
||||||
priority,
|
priority,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -573,6 +578,8 @@ export function normalizePaperclipWakePayload(value: unknown): PaperclipWakePayl
|
|||||||
executionStage,
|
executionStage,
|
||||||
continuationSummary,
|
continuationSummary,
|
||||||
livenessContinuation,
|
livenessContinuation,
|
||||||
|
interactionKind: asString(payload.interactionKind, "").trim() || null,
|
||||||
|
interactionStatus: asString(payload.interactionStatus, "").trim() || null,
|
||||||
childIssueSummaries,
|
childIssueSummaries,
|
||||||
childIssueSummaryTruncated: asBoolean(payload.childIssueSummaryTruncated, false),
|
childIssueSummaryTruncated: asBoolean(payload.childIssueSummaryTruncated, false),
|
||||||
commentIds,
|
commentIds,
|
||||||
@@ -592,6 +599,15 @@ export function stringifyPaperclipWakePayload(value: unknown): string | null {
|
|||||||
return JSON.stringify(normalized);
|
return JSON.stringify(normalized);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function readPaperclipIssueWorkModeFromContext(value: unknown): string | null {
|
||||||
|
const context = parseObject(value);
|
||||||
|
const issue = parseObject(context.paperclipIssue);
|
||||||
|
const direct = asString(issue.workMode, "").trim();
|
||||||
|
if (direct) return direct;
|
||||||
|
const wake = normalizePaperclipWakePayload(context.paperclipWake);
|
||||||
|
return wake?.issue?.workMode ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
export function renderPaperclipWakePrompt(
|
export function renderPaperclipWakePrompt(
|
||||||
value: unknown,
|
value: unknown,
|
||||||
options: { resumedSession?: boolean } = {},
|
options: { resumedSession?: boolean } = {},
|
||||||
@@ -644,9 +660,31 @@ export function renderPaperclipWakePrompt(
|
|||||||
if (normalized.issue?.status) {
|
if (normalized.issue?.status) {
|
||||||
lines.push(`- issue status: ${normalized.issue.status}`);
|
lines.push(`- issue status: ${normalized.issue.status}`);
|
||||||
}
|
}
|
||||||
|
if (normalized.issue?.workMode) {
|
||||||
|
lines.push(`- issue work mode: ${normalized.issue.workMode}`);
|
||||||
|
}
|
||||||
if (normalized.issue?.priority) {
|
if (normalized.issue?.priority) {
|
||||||
lines.push(`- issue priority: ${normalized.issue.priority}`);
|
lines.push(`- issue priority: ${normalized.issue.priority}`);
|
||||||
}
|
}
|
||||||
|
if (normalized.issue?.workMode === "planning") {
|
||||||
|
const hasWakeComments = normalized.comments.length > 0;
|
||||||
|
const acceptedPlanContinuation =
|
||||||
|
!hasWakeComments &&
|
||||||
|
normalized.interactionKind === "request_confirmation" && normalized.interactionStatus === "accepted";
|
||||||
|
let directive = "Make the plan only. Do not write code or perform implementation work.";
|
||||||
|
if (hasWakeComments) {
|
||||||
|
directive = "Update the plan only. Do not write code or perform implementation work.";
|
||||||
|
}
|
||||||
|
if (acceptedPlanContinuation) {
|
||||||
|
directive = "Create child issues from the approved plan only. Do not write code or perform implementation work on the planning issue.";
|
||||||
|
}
|
||||||
|
lines.push(`- planning directive: ${directive}`);
|
||||||
|
if (acceptedPlanContinuation) {
|
||||||
|
lines.push(
|
||||||
|
"- accepted-plan continuation: you may create child implementation issues from the approved plan, but must not start implementation work on the planning issue itself",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (normalized.checkedOutByHarness) {
|
if (normalized.checkedOutByHarness) {
|
||||||
lines.push("- checkout: already claimed by the harness for this run");
|
lines.push("- checkout: already claimed by the harness for this run");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
materializePaperclipSkillCopy,
|
materializePaperclipSkillCopy,
|
||||||
parseObject,
|
parseObject,
|
||||||
readPaperclipRuntimeSkillEntries,
|
readPaperclipRuntimeSkillEntries,
|
||||||
|
readPaperclipIssueWorkModeFromContext,
|
||||||
renderPaperclipWakePrompt,
|
renderPaperclipWakePrompt,
|
||||||
renderTemplate,
|
renderTemplate,
|
||||||
resolvePaperclipDesiredSkillNames,
|
resolvePaperclipDesiredSkillNames,
|
||||||
@@ -686,7 +687,9 @@ async function buildRuntime(input: {
|
|||||||
? context.issueIds.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
? context.issueIds.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
||||||
: [];
|
: [];
|
||||||
const wakePayloadJson = stringifyPaperclipWakePayload(context.paperclipWake);
|
const wakePayloadJson = stringifyPaperclipWakePayload(context.paperclipWake);
|
||||||
|
const issueWorkMode = readPaperclipIssueWorkModeFromContext(context);
|
||||||
if (wakeTaskId) env.PAPERCLIP_TASK_ID = wakeTaskId;
|
if (wakeTaskId) env.PAPERCLIP_TASK_ID = wakeTaskId;
|
||||||
|
if (issueWorkMode) env.PAPERCLIP_ISSUE_WORK_MODE = issueWorkMode;
|
||||||
if (wakeReason) env.PAPERCLIP_WAKE_REASON = wakeReason;
|
if (wakeReason) env.PAPERCLIP_WAKE_REASON = wakeReason;
|
||||||
if (wakeCommentId) env.PAPERCLIP_WAKE_COMMENT_ID = wakeCommentId;
|
if (wakeCommentId) env.PAPERCLIP_WAKE_COMMENT_ID = wakeCommentId;
|
||||||
if (approvalId) env.PAPERCLIP_APPROVAL_ID = approvalId;
|
if (approvalId) env.PAPERCLIP_APPROVAL_ID = approvalId;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import {
|
|||||||
applyPaperclipWorkspaceEnv,
|
applyPaperclipWorkspaceEnv,
|
||||||
buildPaperclipEnv,
|
buildPaperclipEnv,
|
||||||
readPaperclipRuntimeSkillEntries,
|
readPaperclipRuntimeSkillEntries,
|
||||||
|
readPaperclipIssueWorkModeFromContext,
|
||||||
joinPromptSections,
|
joinPromptSections,
|
||||||
buildInvocationEnvForLogs,
|
buildInvocationEnvForLogs,
|
||||||
ensureAbsoluteDirectory,
|
ensureAbsoluteDirectory,
|
||||||
@@ -191,10 +192,14 @@ async function buildClaudeRuntimeConfig(input: ClaudeExecutionInput): Promise<Cl
|
|||||||
? context.issueIds.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
? context.issueIds.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
||||||
: [];
|
: [];
|
||||||
const wakePayloadJson = stringifyPaperclipWakePayload(context.paperclipWake);
|
const wakePayloadJson = stringifyPaperclipWakePayload(context.paperclipWake);
|
||||||
|
const issueWorkMode = readPaperclipIssueWorkModeFromContext(context);
|
||||||
|
|
||||||
if (wakeTaskId) {
|
if (wakeTaskId) {
|
||||||
env.PAPERCLIP_TASK_ID = wakeTaskId;
|
env.PAPERCLIP_TASK_ID = wakeTaskId;
|
||||||
}
|
}
|
||||||
|
if (issueWorkMode) {
|
||||||
|
env.PAPERCLIP_ISSUE_WORK_MODE = issueWorkMode;
|
||||||
|
}
|
||||||
if (wakeReason) {
|
if (wakeReason) {
|
||||||
env.PAPERCLIP_WAKE_REASON = wakeReason;
|
env.PAPERCLIP_WAKE_REASON = wakeReason;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import {
|
|||||||
ensurePaperclipSkillSymlink,
|
ensurePaperclipSkillSymlink,
|
||||||
ensurePathInEnv,
|
ensurePathInEnv,
|
||||||
readPaperclipRuntimeSkillEntries,
|
readPaperclipRuntimeSkillEntries,
|
||||||
|
readPaperclipIssueWorkModeFromContext,
|
||||||
resolvePaperclipDesiredSkillNames,
|
resolvePaperclipDesiredSkillNames,
|
||||||
renderTemplate,
|
renderTemplate,
|
||||||
renderPaperclipWakePrompt,
|
renderPaperclipWakePrompt,
|
||||||
@@ -423,9 +424,13 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
|
|||||||
? context.issueIds.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
? context.issueIds.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
||||||
: [];
|
: [];
|
||||||
const wakePayloadJson = stringifyPaperclipWakePayload(context.paperclipWake);
|
const wakePayloadJson = stringifyPaperclipWakePayload(context.paperclipWake);
|
||||||
|
const issueWorkMode = readPaperclipIssueWorkModeFromContext(context);
|
||||||
if (wakeTaskId) {
|
if (wakeTaskId) {
|
||||||
env.PAPERCLIP_TASK_ID = wakeTaskId;
|
env.PAPERCLIP_TASK_ID = wakeTaskId;
|
||||||
}
|
}
|
||||||
|
if (issueWorkMode) {
|
||||||
|
env.PAPERCLIP_ISSUE_WORK_MODE = issueWorkMode;
|
||||||
|
}
|
||||||
if (wakeReason) {
|
if (wakeReason) {
|
||||||
env.PAPERCLIP_WAKE_REASON = wakeReason;
|
env.PAPERCLIP_WAKE_REASON = wakeReason;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import {
|
|||||||
ensurePaperclipSkillSymlink,
|
ensurePaperclipSkillSymlink,
|
||||||
ensurePathInEnv,
|
ensurePathInEnv,
|
||||||
readPaperclipRuntimeSkillEntries,
|
readPaperclipRuntimeSkillEntries,
|
||||||
|
readPaperclipIssueWorkModeFromContext,
|
||||||
resolvePaperclipDesiredSkillNames,
|
resolvePaperclipDesiredSkillNames,
|
||||||
removeMaintainerOnlySkillSymlinks,
|
removeMaintainerOnlySkillSymlinks,
|
||||||
renderTemplate,
|
renderTemplate,
|
||||||
@@ -268,9 +269,13 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
|
|||||||
? context.issueIds.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
? context.issueIds.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
||||||
: [];
|
: [];
|
||||||
const wakePayloadJson = stringifyPaperclipWakePayload(context.paperclipWake);
|
const wakePayloadJson = stringifyPaperclipWakePayload(context.paperclipWake);
|
||||||
|
const issueWorkMode = readPaperclipIssueWorkModeFromContext(context);
|
||||||
if (wakeTaskId) {
|
if (wakeTaskId) {
|
||||||
env.PAPERCLIP_TASK_ID = wakeTaskId;
|
env.PAPERCLIP_TASK_ID = wakeTaskId;
|
||||||
}
|
}
|
||||||
|
if (issueWorkMode) {
|
||||||
|
env.PAPERCLIP_ISSUE_WORK_MODE = issueWorkMode;
|
||||||
|
}
|
||||||
if (wakeReason) {
|
if (wakeReason) {
|
||||||
env.PAPERCLIP_WAKE_REASON = wakeReason;
|
env.PAPERCLIP_WAKE_REASON = wakeReason;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import {
|
|||||||
joinPromptSections,
|
joinPromptSections,
|
||||||
ensurePathInEnv,
|
ensurePathInEnv,
|
||||||
readPaperclipRuntimeSkillEntries,
|
readPaperclipRuntimeSkillEntries,
|
||||||
|
readPaperclipIssueWorkModeFromContext,
|
||||||
resolvePaperclipDesiredSkillNames,
|
resolvePaperclipDesiredSkillNames,
|
||||||
removeMaintainerOnlySkillSymlinks,
|
removeMaintainerOnlySkillSymlinks,
|
||||||
parseObject,
|
parseObject,
|
||||||
@@ -244,7 +245,9 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
|
|||||||
? context.issueIds.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
? context.issueIds.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
||||||
: [];
|
: [];
|
||||||
const wakePayloadJson = stringifyPaperclipWakePayload(context.paperclipWake);
|
const wakePayloadJson = stringifyPaperclipWakePayload(context.paperclipWake);
|
||||||
|
const issueWorkMode = readPaperclipIssueWorkModeFromContext(context);
|
||||||
if (wakeTaskId) env.PAPERCLIP_TASK_ID = wakeTaskId;
|
if (wakeTaskId) env.PAPERCLIP_TASK_ID = wakeTaskId;
|
||||||
|
if (issueWorkMode) env.PAPERCLIP_ISSUE_WORK_MODE = issueWorkMode;
|
||||||
if (wakeReason) env.PAPERCLIP_WAKE_REASON = wakeReason;
|
if (wakeReason) env.PAPERCLIP_WAKE_REASON = wakeReason;
|
||||||
if (wakeCommentId) env.PAPERCLIP_WAKE_COMMENT_ID = wakeCommentId;
|
if (wakeCommentId) env.PAPERCLIP_WAKE_COMMENT_ID = wakeCommentId;
|
||||||
if (approvalId) env.PAPERCLIP_APPROVAL_ID = approvalId;
|
if (approvalId) env.PAPERCLIP_APPROVAL_ID = approvalId;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
asString,
|
asString,
|
||||||
buildPaperclipEnv,
|
buildPaperclipEnv,
|
||||||
parseObject,
|
parseObject,
|
||||||
|
readPaperclipIssueWorkModeFromContext,
|
||||||
renderPaperclipWakePrompt,
|
renderPaperclipWakePrompt,
|
||||||
stringifyPaperclipWakePayload,
|
stringifyPaperclipWakePayload,
|
||||||
} from "@paperclipai/adapter-utils/server-utils";
|
} from "@paperclipai/adapter-utils/server-utils";
|
||||||
@@ -347,6 +348,8 @@ function buildPaperclipEnvForWake(ctx: AdapterExecutionContext, wakePayload: Wak
|
|||||||
paperclipEnv.PAPERCLIP_API_URL = paperclipApiUrlOverride;
|
paperclipEnv.PAPERCLIP_API_URL = paperclipApiUrlOverride;
|
||||||
}
|
}
|
||||||
if (wakePayload.taskId) paperclipEnv.PAPERCLIP_TASK_ID = wakePayload.taskId;
|
if (wakePayload.taskId) paperclipEnv.PAPERCLIP_TASK_ID = wakePayload.taskId;
|
||||||
|
const issueWorkMode = readPaperclipIssueWorkModeFromContext(ctx.context);
|
||||||
|
if (issueWorkMode) paperclipEnv.PAPERCLIP_ISSUE_WORK_MODE = issueWorkMode;
|
||||||
if (wakePayload.wakeReason) paperclipEnv.PAPERCLIP_WAKE_REASON = wakePayload.wakeReason;
|
if (wakePayload.wakeReason) paperclipEnv.PAPERCLIP_WAKE_REASON = wakePayload.wakeReason;
|
||||||
if (wakePayload.wakeCommentId) paperclipEnv.PAPERCLIP_WAKE_COMMENT_ID = wakePayload.wakeCommentId;
|
if (wakePayload.wakeCommentId) paperclipEnv.PAPERCLIP_WAKE_COMMENT_ID = wakePayload.wakeCommentId;
|
||||||
if (wakePayload.approvalId) paperclipEnv.PAPERCLIP_APPROVAL_ID = wakePayload.approvalId;
|
if (wakePayload.approvalId) paperclipEnv.PAPERCLIP_APPROVAL_ID = wakePayload.approvalId;
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import {
|
|||||||
DEFAULT_PAPERCLIP_AGENT_PROMPT_TEMPLATE,
|
DEFAULT_PAPERCLIP_AGENT_PROMPT_TEMPLATE,
|
||||||
runChildProcess,
|
runChildProcess,
|
||||||
readPaperclipRuntimeSkillEntries,
|
readPaperclipRuntimeSkillEntries,
|
||||||
|
readPaperclipIssueWorkModeFromContext,
|
||||||
resolvePaperclipDesiredSkillNames,
|
resolvePaperclipDesiredSkillNames,
|
||||||
} from "@paperclipai/adapter-utils/server-utils";
|
} from "@paperclipai/adapter-utils/server-utils";
|
||||||
import { isOpenCodeUnknownSessionError, parseOpenCodeJsonl } from "./parse.js";
|
import { isOpenCodeUnknownSessionError, parseOpenCodeJsonl } from "./parse.js";
|
||||||
@@ -266,7 +267,9 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
|
|||||||
? context.issueIds.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
? context.issueIds.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
||||||
: [];
|
: [];
|
||||||
const wakePayloadJson = stringifyPaperclipWakePayload(context.paperclipWake);
|
const wakePayloadJson = stringifyPaperclipWakePayload(context.paperclipWake);
|
||||||
|
const issueWorkMode = readPaperclipIssueWorkModeFromContext(context);
|
||||||
if (wakeTaskId) env.PAPERCLIP_TASK_ID = wakeTaskId;
|
if (wakeTaskId) env.PAPERCLIP_TASK_ID = wakeTaskId;
|
||||||
|
if (issueWorkMode) env.PAPERCLIP_ISSUE_WORK_MODE = issueWorkMode;
|
||||||
if (wakeReason) env.PAPERCLIP_WAKE_REASON = wakeReason;
|
if (wakeReason) env.PAPERCLIP_WAKE_REASON = wakeReason;
|
||||||
if (wakeCommentId) env.PAPERCLIP_WAKE_COMMENT_ID = wakeCommentId;
|
if (wakeCommentId) env.PAPERCLIP_WAKE_COMMENT_ID = wakeCommentId;
|
||||||
if (approvalId) env.PAPERCLIP_APPROVAL_ID = approvalId;
|
if (approvalId) env.PAPERCLIP_APPROVAL_ID = approvalId;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import {
|
|||||||
ensurePaperclipSkillSymlink,
|
ensurePaperclipSkillSymlink,
|
||||||
ensurePathInEnv,
|
ensurePathInEnv,
|
||||||
readPaperclipRuntimeSkillEntries,
|
readPaperclipRuntimeSkillEntries,
|
||||||
|
readPaperclipIssueWorkModeFromContext,
|
||||||
resolvePaperclipDesiredSkillNames,
|
resolvePaperclipDesiredSkillNames,
|
||||||
removeMaintainerOnlySkillSymlinks,
|
removeMaintainerOnlySkillSymlinks,
|
||||||
renderTemplate,
|
renderTemplate,
|
||||||
@@ -295,8 +296,10 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
|
|||||||
? context.issueIds.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
? context.issueIds.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
||||||
: [];
|
: [];
|
||||||
const wakePayloadJson = stringifyPaperclipWakePayload(context.paperclipWake);
|
const wakePayloadJson = stringifyPaperclipWakePayload(context.paperclipWake);
|
||||||
|
const issueWorkMode = readPaperclipIssueWorkModeFromContext(context);
|
||||||
|
|
||||||
if (wakeTaskId) env.PAPERCLIP_TASK_ID = wakeTaskId;
|
if (wakeTaskId) env.PAPERCLIP_TASK_ID = wakeTaskId;
|
||||||
|
if (issueWorkMode) env.PAPERCLIP_ISSUE_WORK_MODE = issueWorkMode;
|
||||||
if (wakeReason) env.PAPERCLIP_WAKE_REASON = wakeReason;
|
if (wakeReason) env.PAPERCLIP_WAKE_REASON = wakeReason;
|
||||||
if (wakeCommentId) env.PAPERCLIP_WAKE_COMMENT_ID = wakeCommentId;
|
if (wakeCommentId) env.PAPERCLIP_WAKE_COMMENT_ID = wakeCommentId;
|
||||||
if (approvalId) env.PAPERCLIP_APPROVAL_ID = approvalId;
|
if (approvalId) env.PAPERCLIP_APPROVAL_ID = approvalId;
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE "issues" ADD COLUMN IF NOT EXISTS "work_mode" text DEFAULT 'standard' NOT NULL;
|
||||||
+437
-191
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"id": "063c8887-ed46-4125-a08f-51c16b636245",
|
"id": "a7ba5d6c-9f74-487d-a9c1-56a4d5455b92",
|
||||||
"prevId": "fdc9cd8b-5423-4d64-b255-9bc1497fdd6a",
|
"prevId": "50cf2dfe-df7b-4f02-a169-edbae599cf39",
|
||||||
"version": "7",
|
"version": "7",
|
||||||
"dialect": "postgresql",
|
"dialect": "postgresql",
|
||||||
"tables": {
|
"tables": {
|
||||||
@@ -8274,6 +8274,12 @@
|
|||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
|
"author_type": {
|
||||||
|
"name": "author_type",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
"created_by_run_id": {
|
"created_by_run_id": {
|
||||||
"name": "created_by_run_id",
|
"name": "created_by_run_id",
|
||||||
"type": "uuid",
|
"type": "uuid",
|
||||||
@@ -8286,6 +8292,18 @@
|
|||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": true
|
"notNull": true
|
||||||
},
|
},
|
||||||
|
"presentation": {
|
||||||
|
"name": "presentation",
|
||||||
|
"type": "jsonb",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"metadata": {
|
||||||
|
"name": "metadata",
|
||||||
|
"type": "jsonb",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
"created_at": {
|
"created_at": {
|
||||||
"name": "created_at",
|
"name": "created_at",
|
||||||
"type": "timestamp with time zone",
|
"type": "timestamp with time zone",
|
||||||
@@ -10990,6 +11008,13 @@
|
|||||||
"notNull": true,
|
"notNull": true,
|
||||||
"default": "'backlog'"
|
"default": "'backlog'"
|
||||||
},
|
},
|
||||||
|
"work_mode": {
|
||||||
|
"name": "work_mode",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'standard'"
|
||||||
|
},
|
||||||
"priority": {
|
"priority": {
|
||||||
"name": "priority",
|
"name": "priority",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@@ -13103,6 +13128,195 @@
|
|||||||
"checkConstraints": {},
|
"checkConstraints": {},
|
||||||
"isRLSEnabled": false
|
"isRLSEnabled": false
|
||||||
},
|
},
|
||||||
|
"public.plugin_managed_resources": {
|
||||||
|
"name": "plugin_managed_resources",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"company_id": {
|
||||||
|
"name": "company_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"plugin_id": {
|
||||||
|
"name": "plugin_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"plugin_key": {
|
||||||
|
"name": "plugin_key",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"resource_kind": {
|
||||||
|
"name": "resource_kind",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"resource_key": {
|
||||||
|
"name": "resource_key",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"resource_id": {
|
||||||
|
"name": "resource_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"defaults_json": {
|
||||||
|
"name": "defaults_json",
|
||||||
|
"type": "jsonb",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "'{}'::jsonb"
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp with time zone",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"updated_at": {
|
||||||
|
"name": "updated_at",
|
||||||
|
"type": "timestamp with time zone",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"plugin_managed_resources_company_idx": {
|
||||||
|
"name": "plugin_managed_resources_company_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "company_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
},
|
||||||
|
"plugin_managed_resources_plugin_idx": {
|
||||||
|
"name": "plugin_managed_resources_plugin_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "plugin_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
},
|
||||||
|
"plugin_managed_resources_resource_idx": {
|
||||||
|
"name": "plugin_managed_resources_resource_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "resource_kind",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expression": "resource_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
},
|
||||||
|
"plugin_managed_resources_company_plugin_resource_uq": {
|
||||||
|
"name": "plugin_managed_resources_company_plugin_resource_uq",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "company_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expression": "plugin_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expression": "resource_kind",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expression": "resource_key",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": true,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"plugin_managed_resources_company_id_companies_id_fk": {
|
||||||
|
"name": "plugin_managed_resources_company_id_companies_id_fk",
|
||||||
|
"tableFrom": "plugin_managed_resources",
|
||||||
|
"tableTo": "companies",
|
||||||
|
"columnsFrom": [
|
||||||
|
"company_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"plugin_managed_resources_plugin_id_plugins_id_fk": {
|
||||||
|
"name": "plugin_managed_resources_plugin_id_plugins_id_fk",
|
||||||
|
"tableFrom": "plugin_managed_resources",
|
||||||
|
"tableTo": "plugins",
|
||||||
|
"columnsFrom": [
|
||||||
|
"plugin_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
"public.plugin_migrations": {
|
"public.plugin_migrations": {
|
||||||
"name": "plugin_migrations",
|
"name": "plugin_migrations",
|
||||||
"schema": "",
|
"schema": "",
|
||||||
@@ -14358,6 +14572,214 @@
|
|||||||
"checkConstraints": {},
|
"checkConstraints": {},
|
||||||
"isRLSEnabled": false
|
"isRLSEnabled": false
|
||||||
},
|
},
|
||||||
|
"public.routine_revisions": {
|
||||||
|
"name": "routine_revisions",
|
||||||
|
"schema": "",
|
||||||
|
"columns": {
|
||||||
|
"id": {
|
||||||
|
"name": "id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "gen_random_uuid()"
|
||||||
|
},
|
||||||
|
"company_id": {
|
||||||
|
"name": "company_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"routine_id": {
|
||||||
|
"name": "routine_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"revision_number": {
|
||||||
|
"name": "revision_number",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"name": "title",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"name": "description",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"snapshot": {
|
||||||
|
"name": "snapshot",
|
||||||
|
"type": "jsonb",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"change_summary": {
|
||||||
|
"name": "change_summary",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"restored_from_revision_id": {
|
||||||
|
"name": "restored_from_revision_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_by_agent_id": {
|
||||||
|
"name": "created_by_agent_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_by_user_id": {
|
||||||
|
"name": "created_by_user_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_by_run_id": {
|
||||||
|
"name": "created_by_run_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"name": "created_at",
|
||||||
|
"type": "timestamp with time zone",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": "now()"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"routine_revisions_routine_revision_uq": {
|
||||||
|
"name": "routine_revisions_routine_revision_uq",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "routine_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expression": "revision_number",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": true,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
},
|
||||||
|
"routine_revisions_company_routine_created_idx": {
|
||||||
|
"name": "routine_revisions_company_routine_created_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "company_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expression": "routine_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expression": "created_at",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreignKeys": {
|
||||||
|
"routine_revisions_company_id_companies_id_fk": {
|
||||||
|
"name": "routine_revisions_company_id_companies_id_fk",
|
||||||
|
"tableFrom": "routine_revisions",
|
||||||
|
"tableTo": "companies",
|
||||||
|
"columnsFrom": [
|
||||||
|
"company_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"routine_revisions_routine_id_routines_id_fk": {
|
||||||
|
"name": "routine_revisions_routine_id_routines_id_fk",
|
||||||
|
"tableFrom": "routine_revisions",
|
||||||
|
"tableTo": "routines",
|
||||||
|
"columnsFrom": [
|
||||||
|
"routine_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "cascade",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"routine_revisions_restored_from_revision_id_routine_revisions_id_fk": {
|
||||||
|
"name": "routine_revisions_restored_from_revision_id_routine_revisions_id_fk",
|
||||||
|
"tableFrom": "routine_revisions",
|
||||||
|
"tableTo": "routine_revisions",
|
||||||
|
"columnsFrom": [
|
||||||
|
"restored_from_revision_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "set null",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"routine_revisions_created_by_agent_id_agents_id_fk": {
|
||||||
|
"name": "routine_revisions_created_by_agent_id_agents_id_fk",
|
||||||
|
"tableFrom": "routine_revisions",
|
||||||
|
"tableTo": "agents",
|
||||||
|
"columnsFrom": [
|
||||||
|
"created_by_agent_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "set null",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"routine_revisions_created_by_run_id_heartbeat_runs_id_fk": {
|
||||||
|
"name": "routine_revisions_created_by_run_id_heartbeat_runs_id_fk",
|
||||||
|
"tableFrom": "routine_revisions",
|
||||||
|
"tableTo": "heartbeat_runs",
|
||||||
|
"columnsFrom": [
|
||||||
|
"created_by_run_id"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "set null",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"policies": {},
|
||||||
|
"checkConstraints": {},
|
||||||
|
"isRLSEnabled": false
|
||||||
|
},
|
||||||
"public.routine_runs": {
|
"public.routine_runs": {
|
||||||
"name": "routine_runs",
|
"name": "routine_runs",
|
||||||
"schema": "",
|
"schema": "",
|
||||||
@@ -15022,6 +15444,19 @@
|
|||||||
"notNull": true,
|
"notNull": true,
|
||||||
"default": "'[]'::jsonb"
|
"default": "'[]'::jsonb"
|
||||||
},
|
},
|
||||||
|
"latest_revision_id": {
|
||||||
|
"name": "latest_revision_id",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"latest_revision_number": {
|
||||||
|
"name": "latest_revision_number",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"default": 1
|
||||||
|
},
|
||||||
"created_by_agent_id": {
|
"created_by_agent_id": {
|
||||||
"name": "created_by_agent_id",
|
"name": "created_by_agent_id",
|
||||||
"type": "uuid",
|
"type": "uuid",
|
||||||
@@ -15929,195 +16364,6 @@
|
|||||||
"policies": {},
|
"policies": {},
|
||||||
"checkConstraints": {},
|
"checkConstraints": {},
|
||||||
"isRLSEnabled": false
|
"isRLSEnabled": false
|
||||||
},
|
|
||||||
"public.plugin_managed_resources": {
|
|
||||||
"name": "plugin_managed_resources",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "gen_random_uuid()"
|
|
||||||
},
|
|
||||||
"company_id": {
|
|
||||||
"name": "company_id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"plugin_id": {
|
|
||||||
"name": "plugin_id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"plugin_key": {
|
|
||||||
"name": "plugin_key",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"resource_kind": {
|
|
||||||
"name": "resource_kind",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"resource_key": {
|
|
||||||
"name": "resource_key",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"resource_id": {
|
|
||||||
"name": "resource_id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"defaults_json": {
|
|
||||||
"name": "defaults_json",
|
|
||||||
"type": "jsonb",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "'{}'::jsonb"
|
|
||||||
},
|
|
||||||
"created_at": {
|
|
||||||
"name": "created_at",
|
|
||||||
"type": "timestamp with time zone",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "now()"
|
|
||||||
},
|
|
||||||
"updated_at": {
|
|
||||||
"name": "updated_at",
|
|
||||||
"type": "timestamp with time zone",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "now()"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {
|
|
||||||
"plugin_managed_resources_company_idx": {
|
|
||||||
"name": "plugin_managed_resources_company_idx",
|
|
||||||
"columns": [
|
|
||||||
{
|
|
||||||
"expression": "company_id",
|
|
||||||
"isExpression": false,
|
|
||||||
"asc": true,
|
|
||||||
"nulls": "last"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"isUnique": false,
|
|
||||||
"concurrently": false,
|
|
||||||
"method": "btree",
|
|
||||||
"with": {}
|
|
||||||
},
|
|
||||||
"plugin_managed_resources_plugin_idx": {
|
|
||||||
"name": "plugin_managed_resources_plugin_idx",
|
|
||||||
"columns": [
|
|
||||||
{
|
|
||||||
"expression": "plugin_id",
|
|
||||||
"isExpression": false,
|
|
||||||
"asc": true,
|
|
||||||
"nulls": "last"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"isUnique": false,
|
|
||||||
"concurrently": false,
|
|
||||||
"method": "btree",
|
|
||||||
"with": {}
|
|
||||||
},
|
|
||||||
"plugin_managed_resources_resource_idx": {
|
|
||||||
"name": "plugin_managed_resources_resource_idx",
|
|
||||||
"columns": [
|
|
||||||
{
|
|
||||||
"expression": "resource_kind",
|
|
||||||
"isExpression": false,
|
|
||||||
"asc": true,
|
|
||||||
"nulls": "last"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"expression": "resource_id",
|
|
||||||
"isExpression": false,
|
|
||||||
"asc": true,
|
|
||||||
"nulls": "last"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"isUnique": false,
|
|
||||||
"concurrently": false,
|
|
||||||
"method": "btree",
|
|
||||||
"with": {}
|
|
||||||
},
|
|
||||||
"plugin_managed_resources_company_plugin_resource_uq": {
|
|
||||||
"name": "plugin_managed_resources_company_plugin_resource_uq",
|
|
||||||
"columns": [
|
|
||||||
{
|
|
||||||
"expression": "company_id",
|
|
||||||
"isExpression": false,
|
|
||||||
"asc": true,
|
|
||||||
"nulls": "last"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"expression": "plugin_id",
|
|
||||||
"isExpression": false,
|
|
||||||
"asc": true,
|
|
||||||
"nulls": "last"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"expression": "resource_kind",
|
|
||||||
"isExpression": false,
|
|
||||||
"asc": true,
|
|
||||||
"nulls": "last"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"expression": "resource_key",
|
|
||||||
"isExpression": false,
|
|
||||||
"asc": true,
|
|
||||||
"nulls": "last"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"isUnique": true,
|
|
||||||
"concurrently": false,
|
|
||||||
"method": "btree",
|
|
||||||
"with": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"foreignKeys": {
|
|
||||||
"plugin_managed_resources_company_id_companies_id_fk": {
|
|
||||||
"name": "plugin_managed_resources_company_id_companies_id_fk",
|
|
||||||
"tableFrom": "plugin_managed_resources",
|
|
||||||
"tableTo": "companies",
|
|
||||||
"columnsFrom": [
|
|
||||||
"company_id"
|
|
||||||
],
|
|
||||||
"columnsTo": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"onDelete": "cascade",
|
|
||||||
"onUpdate": "no action"
|
|
||||||
},
|
|
||||||
"plugin_managed_resources_plugin_id_plugins_id_fk": {
|
|
||||||
"name": "plugin_managed_resources_plugin_id_plugins_id_fk",
|
|
||||||
"tableFrom": "plugin_managed_resources",
|
|
||||||
"tableTo": "plugins",
|
|
||||||
"columnsFrom": [
|
|
||||||
"plugin_id"
|
|
||||||
],
|
|
||||||
"columnsTo": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"onDelete": "cascade",
|
|
||||||
"onUpdate": "no action"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {},
|
|
||||||
"policies": {},
|
|
||||||
"checkConstraints": {},
|
|
||||||
"isRLSEnabled": false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"enums": {},
|
"enums": {},
|
||||||
@@ -568,6 +568,13 @@
|
|||||||
"when": 1777849000000,
|
"when": 1777849000000,
|
||||||
"tag": "0080_company_search_fuzzystrmatch",
|
"tag": "0080_company_search_fuzzystrmatch",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 81,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1778067785040,
|
||||||
|
"tag": "0081_optimal_dormammu",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export const issues = pgTable(
|
|||||||
title: text("title").notNull(),
|
title: text("title").notNull(),
|
||||||
description: text("description"),
|
description: text("description"),
|
||||||
status: text("status").notNull().default("backlog"),
|
status: text("status").notNull().default("backlog"),
|
||||||
|
workMode: text("work_mode").notNull().default("standard"),
|
||||||
priority: text("priority").notNull().default("medium"),
|
priority: text("priority").notNull().default("medium"),
|
||||||
assigneeAgentId: uuid("assignee_agent_id").references(() => agents.id),
|
assigneeAgentId: uuid("assignee_agent_id").references(() => agents.id),
|
||||||
assigneeUserId: text("assignee_user_id"),
|
assigneeUserId: text("assignee_user_id"),
|
||||||
|
|||||||
@@ -852,6 +852,7 @@ export interface WorkerToHostMethods {
|
|||||||
title: string;
|
title: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
status?: string;
|
status?: string;
|
||||||
|
workMode?: string;
|
||||||
priority?: string;
|
priority?: string;
|
||||||
assigneeAgentId?: string;
|
assigneeAgentId?: string;
|
||||||
assigneeUserId?: string | null;
|
assigneeUserId?: string | null;
|
||||||
|
|||||||
@@ -1147,6 +1147,7 @@ export function createTestHarness(options: TestHarnessOptions): TestHarness {
|
|||||||
title: input.title,
|
title: input.title,
|
||||||
description: input.description ?? null,
|
description: input.description ?? null,
|
||||||
status: input.status ?? "todo",
|
status: input.status ?? "todo",
|
||||||
|
workMode: input.workMode ?? "standard",
|
||||||
priority: input.priority ?? "medium",
|
priority: input.priority ?? "medium",
|
||||||
assigneeAgentId: input.assigneeAgentId ?? null,
|
assigneeAgentId: input.assigneeAgentId ?? null,
|
||||||
assigneeUserId: input.assigneeUserId ?? null,
|
assigneeUserId: input.assigneeUserId ?? null,
|
||||||
|
|||||||
@@ -1257,6 +1257,7 @@ export interface PluginIssuesClient {
|
|||||||
title: string;
|
title: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
status?: Issue["status"];
|
status?: Issue["status"];
|
||||||
|
workMode?: Issue["workMode"];
|
||||||
priority?: Issue["priority"];
|
priority?: Issue["priority"];
|
||||||
assigneeAgentId?: string;
|
assigneeAgentId?: string;
|
||||||
assigneeUserId?: string | null;
|
assigneeUserId?: string | null;
|
||||||
@@ -1280,6 +1281,7 @@ export interface PluginIssuesClient {
|
|||||||
| "title"
|
| "title"
|
||||||
| "description"
|
| "description"
|
||||||
| "status"
|
| "status"
|
||||||
|
| "workMode"
|
||||||
| "priority"
|
| "priority"
|
||||||
| "assigneeAgentId"
|
| "assigneeAgentId"
|
||||||
| "assigneeUserId"
|
| "assigneeUserId"
|
||||||
|
|||||||
@@ -714,6 +714,7 @@ export function startWorkerRpcHost(options: WorkerRpcHostOptions): WorkerRpcHost
|
|||||||
title: input.title,
|
title: input.title,
|
||||||
description: input.description,
|
description: input.description,
|
||||||
status: input.status,
|
status: input.status,
|
||||||
|
workMode: input.workMode,
|
||||||
priority: input.priority,
|
priority: input.priority,
|
||||||
assigneeAgentId: input.assigneeAgentId,
|
assigneeAgentId: input.assigneeAgentId,
|
||||||
assigneeUserId: input.assigneeUserId,
|
assigneeUserId: input.assigneeUserId,
|
||||||
|
|||||||
@@ -146,6 +146,8 @@ export const INBOX_MINE_ISSUE_STATUS_FILTER = INBOX_MINE_ISSUE_STATUSES.join(","
|
|||||||
|
|
||||||
export const ISSUE_PRIORITIES = ["critical", "high", "medium", "low"] as const;
|
export const ISSUE_PRIORITIES = ["critical", "high", "medium", "low"] as const;
|
||||||
export type IssuePriority = (typeof ISSUE_PRIORITIES)[number];
|
export type IssuePriority = (typeof ISSUE_PRIORITIES)[number];
|
||||||
|
export const ISSUE_WORK_MODES = ["standard", "planning"] as const;
|
||||||
|
export type IssueWorkMode = (typeof ISSUE_WORK_MODES)[number];
|
||||||
export const MAX_ISSUE_REQUEST_DEPTH = 1024;
|
export const MAX_ISSUE_REQUEST_DEPTH = 1024;
|
||||||
|
|
||||||
export const ISSUE_COMMENT_AUTHOR_TYPES = ["user", "agent", "system"] as const;
|
export const ISSUE_COMMENT_AUTHOR_TYPES = ["user", "agent", "system"] as const;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export {
|
|||||||
INBOX_MINE_ISSUE_STATUSES,
|
INBOX_MINE_ISSUE_STATUSES,
|
||||||
INBOX_MINE_ISSUE_STATUS_FILTER,
|
INBOX_MINE_ISSUE_STATUS_FILTER,
|
||||||
ISSUE_PRIORITIES,
|
ISSUE_PRIORITIES,
|
||||||
|
ISSUE_WORK_MODES,
|
||||||
MAX_ISSUE_REQUEST_DEPTH,
|
MAX_ISSUE_REQUEST_DEPTH,
|
||||||
ISSUE_COMMENT_AUTHOR_TYPES,
|
ISSUE_COMMENT_AUTHOR_TYPES,
|
||||||
ISSUE_COMMENT_METADATA_ROW_TYPES,
|
ISSUE_COMMENT_METADATA_ROW_TYPES,
|
||||||
@@ -134,6 +135,7 @@ export {
|
|||||||
type AgentIconName,
|
type AgentIconName,
|
||||||
type IssueStatus,
|
type IssueStatus,
|
||||||
type IssuePriority,
|
type IssuePriority,
|
||||||
|
type IssueWorkMode,
|
||||||
type IssueCommentAuthorType,
|
type IssueCommentAuthorType,
|
||||||
type IssueCommentMetadataRowType,
|
type IssueCommentMetadataRowType,
|
||||||
type IssueCommentPresentationKind,
|
type IssueCommentPresentationKind,
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ export type {
|
|||||||
} from "./work-product.js";
|
} from "./work-product.js";
|
||||||
export type {
|
export type {
|
||||||
Issue,
|
Issue,
|
||||||
|
IssueWorkMode,
|
||||||
IssueAssigneeAdapterOverrides,
|
IssueAssigneeAdapterOverrides,
|
||||||
IssueBlockerAttention,
|
IssueBlockerAttention,
|
||||||
IssueBlockerAttentionReason,
|
IssueBlockerAttentionReason,
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import type {
|
|||||||
IssueExecutionStateStatus,
|
IssueExecutionStateStatus,
|
||||||
IssueOriginKind,
|
IssueOriginKind,
|
||||||
IssuePriority,
|
IssuePriority,
|
||||||
|
IssueWorkMode,
|
||||||
ModelProfileKey,
|
ModelProfileKey,
|
||||||
IssueThreadInteractionContinuationPolicy,
|
IssueThreadInteractionContinuationPolicy,
|
||||||
IssueThreadInteractionKind,
|
IssueThreadInteractionKind,
|
||||||
@@ -26,6 +27,8 @@ import type { Project, ProjectWorkspace } from "./project.js";
|
|||||||
import type { ExecutionWorkspace, IssueExecutionWorkspaceSettings } from "./workspace-runtime.js";
|
import type { ExecutionWorkspace, IssueExecutionWorkspaceSettings } from "./workspace-runtime.js";
|
||||||
import type { IssueWorkProduct } from "./work-product.js";
|
import type { IssueWorkProduct } from "./work-product.js";
|
||||||
|
|
||||||
|
export type { IssueWorkMode };
|
||||||
|
|
||||||
export interface IssueAncestorProject {
|
export interface IssueAncestorProject {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -302,6 +305,7 @@ export interface Issue {
|
|||||||
title: string;
|
title: string;
|
||||||
description: string | null;
|
description: string | null;
|
||||||
status: IssueStatus;
|
status: IssueStatus;
|
||||||
|
workMode: IssueWorkMode;
|
||||||
priority: IssuePriority;
|
priority: IssuePriority;
|
||||||
assigneeAgentId: string | null;
|
assigneeAgentId: string | null;
|
||||||
assigneeUserId: string | null;
|
assigneeUserId: string | null;
|
||||||
@@ -454,6 +458,7 @@ export interface SuggestedTaskDraft {
|
|||||||
title: string;
|
title: string;
|
||||||
description?: string | null;
|
description?: string | null;
|
||||||
priority?: IssuePriority | null;
|
priority?: IssuePriority | null;
|
||||||
|
workMode?: IssueWorkMode | null;
|
||||||
assigneeAgentId?: string | null;
|
assigneeAgentId?: string | null;
|
||||||
assigneeUserId?: string | null;
|
assigneeUserId?: string | null;
|
||||||
projectId?: string | null;
|
projectId?: string | null;
|
||||||
|
|||||||
@@ -127,6 +127,26 @@ describe("issue validators", () => {
|
|||||||
expect(parsed.requestDepth).toBe(MAX_ISSUE_REQUEST_DEPTH);
|
expect(parsed.requestDepth).toBe(MAX_ISSUE_REQUEST_DEPTH);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("defaults issue work mode to standard and accepts planning", () => {
|
||||||
|
expect(createIssueSchema.parse({ title: "Plan first" }).workMode).toBe("standard");
|
||||||
|
expect(createIssueSchema.parse({ title: "Plan first", workMode: "planning" }).workMode).toBe("planning");
|
||||||
|
expect(updateIssueSchema.parse({ workMode: "planning" }).workMode).toBe("planning");
|
||||||
|
expect(suggestedTaskDraftSchema.parse({
|
||||||
|
clientKey: "planning-child",
|
||||||
|
title: "Plan child",
|
||||||
|
workMode: "planning",
|
||||||
|
}).workMode).toBe("planning");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("rejects unknown issue work modes", () => {
|
||||||
|
expect(createIssueSchema.safeParse({ title: "Plan first", workMode: "normal" }).success).toBe(false);
|
||||||
|
expect(suggestedTaskDraftSchema.safeParse({
|
||||||
|
clientKey: "bad-child",
|
||||||
|
title: "Bad child",
|
||||||
|
workMode: "analysis",
|
||||||
|
}).success).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
it("clamps oversized requestDepth values on update", () => {
|
it("clamps oversized requestDepth values on update", () => {
|
||||||
const parsed = updateIssueSchema.parse({
|
const parsed = updateIssueSchema.parse({
|
||||||
requestDepth: MAX_ISSUE_REQUEST_DEPTH + 1,
|
requestDepth: MAX_ISSUE_REQUEST_DEPTH + 1,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
ISSUE_COMMENT_PRESENTATION_TONES,
|
ISSUE_COMMENT_PRESENTATION_TONES,
|
||||||
ISSUE_MONITOR_SCHEDULED_BY,
|
ISSUE_MONITOR_SCHEDULED_BY,
|
||||||
ISSUE_PRIORITIES,
|
ISSUE_PRIORITIES,
|
||||||
|
ISSUE_WORK_MODES,
|
||||||
clampIssueRequestDepth,
|
clampIssueRequestDepth,
|
||||||
ISSUE_STATUSES,
|
ISSUE_STATUSES,
|
||||||
ISSUE_THREAD_INTERACTION_CONTINUATION_POLICIES,
|
ISSUE_THREAD_INTERACTION_CONTINUATION_POLICIES,
|
||||||
@@ -182,6 +183,7 @@ export const createIssueSchema = z.object({
|
|||||||
title: z.string().min(1),
|
title: z.string().min(1),
|
||||||
description: multilineTextSchema.optional().nullable(),
|
description: multilineTextSchema.optional().nullable(),
|
||||||
status: z.enum(ISSUE_STATUSES).optional().default("backlog"),
|
status: z.enum(ISSUE_STATUSES).optional().default("backlog"),
|
||||||
|
workMode: z.enum(ISSUE_WORK_MODES).optional().default("standard"),
|
||||||
priority: z.enum(ISSUE_PRIORITIES).optional().default("medium"),
|
priority: z.enum(ISSUE_PRIORITIES).optional().default("medium"),
|
||||||
assigneeAgentId: z.string().uuid().optional().nullable(),
|
assigneeAgentId: z.string().uuid().optional().nullable(),
|
||||||
assigneeUserId: z.string().optional().nullable(),
|
assigneeUserId: z.string().optional().nullable(),
|
||||||
@@ -353,6 +355,7 @@ export const suggestedTaskDraftSchema = z.object({
|
|||||||
title: z.string().trim().min(1).max(240),
|
title: z.string().trim().min(1).max(240),
|
||||||
description: multilineTextSchema.pipe(z.string().trim().max(20000)).nullable().optional(),
|
description: multilineTextSchema.pipe(z.string().trim().max(20000)).nullable().optional(),
|
||||||
priority: z.enum(ISSUE_PRIORITIES).nullable().optional(),
|
priority: z.enum(ISSUE_PRIORITIES).nullable().optional(),
|
||||||
|
workMode: z.enum(ISSUE_WORK_MODES).nullable().optional(),
|
||||||
assigneeAgentId: z.string().uuid().nullable().optional(),
|
assigneeAgentId: z.string().uuid().nullable().optional(),
|
||||||
assigneeUserId: z.string().trim().min(1).nullable().optional(),
|
assigneeUserId: z.string().trim().min(1).nullable().optional(),
|
||||||
projectId: z.string().uuid().nullable().optional(),
|
projectId: z.string().uuid().nullable().optional(),
|
||||||
|
|||||||
@@ -1,9 +1,133 @@
|
|||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
import {
|
import {
|
||||||
|
buildPaperclipTaskMarkdown,
|
||||||
|
mergeCoalescedContextSnapshot,
|
||||||
summarizeHeartbeatRunContextSnapshot,
|
summarizeHeartbeatRunContextSnapshot,
|
||||||
summarizeHeartbeatRunListResultJson,
|
summarizeHeartbeatRunListResultJson,
|
||||||
} from "../services/heartbeat.js";
|
} from "../services/heartbeat.js";
|
||||||
|
|
||||||
|
describe("buildPaperclipTaskMarkdown", () => {
|
||||||
|
it("adds planning directives for assignment and comment task context", () => {
|
||||||
|
const assignment = buildPaperclipTaskMarkdown({
|
||||||
|
issue: {
|
||||||
|
id: "issue-1",
|
||||||
|
identifier: "PAP-3404",
|
||||||
|
title: "Plan first",
|
||||||
|
workMode: "planning",
|
||||||
|
description: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(assignment).toContain("- Work mode: \"planning\"");
|
||||||
|
expect(assignment).toContain("Make the plan only. Do not write code or perform implementation work.");
|
||||||
|
|
||||||
|
const commentWake = buildPaperclipTaskMarkdown({
|
||||||
|
issue: {
|
||||||
|
id: "issue-1",
|
||||||
|
identifier: "PAP-3404",
|
||||||
|
title: "Plan first",
|
||||||
|
workMode: "planning",
|
||||||
|
description: null,
|
||||||
|
},
|
||||||
|
wakeComment: {
|
||||||
|
id: "comment-1",
|
||||||
|
body: "Please revise the plan.",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(commentWake).toContain("Update the plan only. Do not write code or perform implementation work.");
|
||||||
|
|
||||||
|
const acceptedConfirmation = buildPaperclipTaskMarkdown({
|
||||||
|
issue: {
|
||||||
|
id: "issue-1",
|
||||||
|
identifier: "PAP-3404",
|
||||||
|
title: "Plan first",
|
||||||
|
workMode: "planning",
|
||||||
|
description: null,
|
||||||
|
},
|
||||||
|
interaction: {
|
||||||
|
kind: "request_confirmation",
|
||||||
|
status: "accepted",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(acceptedConfirmation).toContain("Create child issues from the approved plan only");
|
||||||
|
expect(acceptedConfirmation).not.toContain("Make the plan only.");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("prefers ordinary comment planning guidance over stale accepted confirmation state", () => {
|
||||||
|
const commentWake = buildPaperclipTaskMarkdown({
|
||||||
|
issue: {
|
||||||
|
id: "issue-1",
|
||||||
|
identifier: "PAP-3404",
|
||||||
|
title: "Plan first",
|
||||||
|
workMode: "planning",
|
||||||
|
description: null,
|
||||||
|
},
|
||||||
|
wakeComment: {
|
||||||
|
id: "comment-1",
|
||||||
|
body: "Please revise the plan.",
|
||||||
|
},
|
||||||
|
interaction: {
|
||||||
|
kind: "request_confirmation",
|
||||||
|
status: "accepted",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(commentWake).toContain("Update the plan only. Do not write code or perform implementation work.");
|
||||||
|
expect(commentWake).not.toContain("Create child issues from the approved plan only");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("mergeCoalescedContextSnapshot", () => {
|
||||||
|
it("clears stale accepted-plan interaction state when merging a later ordinary comment wake", () => {
|
||||||
|
const merged = mergeCoalescedContextSnapshot(
|
||||||
|
{
|
||||||
|
issueId: "issue-1",
|
||||||
|
interactionId: "interaction-1",
|
||||||
|
interactionKind: "request_confirmation",
|
||||||
|
interactionStatus: "accepted",
|
||||||
|
continuationPolicy: "wake_assignee_on_accept",
|
||||||
|
wakeReason: "issue_commented",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
issueId: "issue-1",
|
||||||
|
commentId: "comment-1",
|
||||||
|
wakeCommentId: "comment-1",
|
||||||
|
wakeReason: "issue_commented",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(merged.interactionId).toBeUndefined();
|
||||||
|
expect(merged.interactionKind).toBeUndefined();
|
||||||
|
expect(merged.interactionStatus).toBeUndefined();
|
||||||
|
expect(merged.continuationPolicy).toBeUndefined();
|
||||||
|
expect(merged.commentId).toBe("comment-1");
|
||||||
|
expect(merged.wakeCommentId).toBe("comment-1");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("preserves accepted-plan interaction state for the interaction wake itself", () => {
|
||||||
|
const merged = mergeCoalescedContextSnapshot(
|
||||||
|
{
|
||||||
|
issueId: "issue-1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
issueId: "issue-1",
|
||||||
|
interactionId: "interaction-1",
|
||||||
|
interactionKind: "request_confirmation",
|
||||||
|
interactionStatus: "accepted",
|
||||||
|
continuationPolicy: "wake_assignee_on_accept",
|
||||||
|
wakeReason: "issue_commented",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(merged.interactionId).toBe("interaction-1");
|
||||||
|
expect(merged.interactionKind).toBe("request_confirmation");
|
||||||
|
expect(merged.interactionStatus).toBe("accepted");
|
||||||
|
expect(merged.continuationPolicy).toBe("wake_assignee_on_accept");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("summarizeHeartbeatRunContextSnapshot", () => {
|
describe("summarizeHeartbeatRunContextSnapshot", () => {
|
||||||
it("keeps only the small retry/linking fields needed by the client", () => {
|
it("keeps only the small retry/linking fields needed by the client", () => {
|
||||||
const summarized = summarizeHeartbeatRunContextSnapshot({
|
const summarized = summarizeHeartbeatRunContextSnapshot({
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { randomUUID } from "node:crypto";
|
import { randomUUID } from "node:crypto";
|
||||||
|
import { eq } from "drizzle-orm";
|
||||||
import { afterAll, afterEach, beforeAll, describe, expect, it } from "vitest";
|
import { afterAll, afterEach, beforeAll, describe, expect, it } from "vitest";
|
||||||
import {
|
import {
|
||||||
agents,
|
agents,
|
||||||
@@ -110,6 +111,7 @@ describeEmbeddedPostgres("issueThreadInteractionService", () => {
|
|||||||
{
|
{
|
||||||
clientKey: "root",
|
clientKey: "root",
|
||||||
title: "Create the root follow-up",
|
title: "Create the root follow-up",
|
||||||
|
workMode: "planning",
|
||||||
assigneeAgentId,
|
assigneeAgentId,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -153,6 +155,19 @@ describeEmbeddedPostgres("issueThreadInteractionService", () => {
|
|||||||
status: "todo",
|
status: "todo",
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
const createdIssueRows = await db
|
||||||
|
.select({
|
||||||
|
title: issues.title,
|
||||||
|
workMode: issues.workMode,
|
||||||
|
})
|
||||||
|
.from(issues)
|
||||||
|
.where(eq(issues.companyId, companyId));
|
||||||
|
expect(createdIssueRows).toEqual(
|
||||||
|
expect.arrayContaining([
|
||||||
|
expect.objectContaining({ title: "Create the root follow-up", workMode: "planning" }),
|
||||||
|
expect.objectContaining({ title: "Create the nested follow-up", workMode: "standard" }),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
|
||||||
const children = await issuesSvc.list(companyId, { parentId: issueId });
|
const children = await issuesSvc.list(companyId, { parentId: issueId });
|
||||||
expect(children).toHaveLength(1);
|
expect(children).toHaveLength(1);
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ const legacyProjectLinkedIssue = {
|
|||||||
title: "Legacy onboarding task",
|
title: "Legacy onboarding task",
|
||||||
description: "Seed the first CEO task",
|
description: "Seed the first CEO task",
|
||||||
status: "todo",
|
status: "todo",
|
||||||
|
workMode: "planning",
|
||||||
priority: "medium",
|
priority: "medium",
|
||||||
projectId: "22222222-2222-4222-8222-222222222222",
|
projectId: "22222222-2222-4222-8222-222222222222",
|
||||||
goalId: null,
|
goalId: null,
|
||||||
@@ -264,6 +265,7 @@ describe.sequential("issue goal context routes", () => {
|
|||||||
|
|
||||||
expect(res.status).toBe(200);
|
expect(res.status).toBe(200);
|
||||||
expect(res.body.issue.goalId).toBe(projectGoal.id);
|
expect(res.body.issue.goalId).toBe(projectGoal.id);
|
||||||
|
expect(res.body.issue.workMode).toBe("planning");
|
||||||
expect(res.body.goal).toEqual(
|
expect(res.body.goal).toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: projectGoal.id,
|
id: projectGoal.id,
|
||||||
|
|||||||
@@ -1304,6 +1304,7 @@ export function issueRoutes(
|
|||||||
title: issue.title,
|
title: issue.title,
|
||||||
description: issue.description,
|
description: issue.description,
|
||||||
status: issue.status,
|
status: issue.status,
|
||||||
|
workMode: issue.workMode,
|
||||||
...(blockerAttention ? { blockerAttention } : {}),
|
...(blockerAttention ? { blockerAttention } : {}),
|
||||||
productivityReview,
|
productivityReview,
|
||||||
priority: issue.priority,
|
priority: issue.priority,
|
||||||
|
|||||||
@@ -1782,6 +1782,7 @@ function enrichWakeContextSnapshot(input: {
|
|||||||
contextSnapshot.wakeTriggerDetail = triggerDetail;
|
contextSnapshot.wakeTriggerDetail = triggerDetail;
|
||||||
}
|
}
|
||||||
normalizeModelProfileWakeContext({ contextSnapshot, payload });
|
normalizeModelProfileWakeContext({ contextSnapshot, payload });
|
||||||
|
normalizeInteractionContinuationWakeContext(contextSnapshot, payload);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
contextSnapshot,
|
contextSnapshot,
|
||||||
@@ -1792,6 +1793,35 @@ function enrichWakeContextSnapshot(input: {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const INTERACTION_CONTINUATION_CONTEXT_KEYS = [
|
||||||
|
"interactionId",
|
||||||
|
"interactionKind",
|
||||||
|
"interactionStatus",
|
||||||
|
"continuationPolicy",
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
function isInteractionResolutionWakePayload(payload: Record<string, unknown> | null | undefined) {
|
||||||
|
return readNonEmptyString(payload?.mutation) === "interaction";
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearInteractionContinuationWakeContext(contextSnapshot: Record<string, unknown>) {
|
||||||
|
for (const key of INTERACTION_CONTINUATION_CONTEXT_KEYS) {
|
||||||
|
delete contextSnapshot[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasInteractionContinuationWakeContext(contextSnapshot: Record<string, unknown>) {
|
||||||
|
return INTERACTION_CONTINUATION_CONTEXT_KEYS.some((key) => readNonEmptyString(contextSnapshot[key]));
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeInteractionContinuationWakeContext(
|
||||||
|
contextSnapshot: Record<string, unknown>,
|
||||||
|
payload: Record<string, unknown> | null | undefined,
|
||||||
|
) {
|
||||||
|
if (isInteractionResolutionWakePayload(payload)) return;
|
||||||
|
clearInteractionContinuationWakeContext(contextSnapshot);
|
||||||
|
}
|
||||||
|
|
||||||
export function mergeCoalescedContextSnapshot(
|
export function mergeCoalescedContextSnapshot(
|
||||||
existingRaw: unknown,
|
existingRaw: unknown,
|
||||||
incoming: Record<string, unknown>,
|
incoming: Record<string, unknown>,
|
||||||
@@ -1811,6 +1841,9 @@ export function mergeCoalescedContextSnapshot(
|
|||||||
// regenerate any structured payload from those ids.
|
// regenerate any structured payload from those ids.
|
||||||
delete merged[PAPERCLIP_WAKE_PAYLOAD_KEY];
|
delete merged[PAPERCLIP_WAKE_PAYLOAD_KEY];
|
||||||
}
|
}
|
||||||
|
if (!hasInteractionContinuationWakeContext(incoming)) {
|
||||||
|
clearInteractionContinuationWakeContext(merged);
|
||||||
|
}
|
||||||
return merged;
|
return merged;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1833,6 +1866,7 @@ async function buildPaperclipWakePayload(input: {
|
|||||||
title: string;
|
title: string;
|
||||||
status: string;
|
status: string;
|
||||||
priority: string;
|
priority: string;
|
||||||
|
workMode: string;
|
||||||
}
|
}
|
||||||
| null;
|
| null;
|
||||||
}) {
|
}) {
|
||||||
@@ -1850,6 +1884,7 @@ async function buildPaperclipWakePayload(input: {
|
|||||||
title: issues.title,
|
title: issues.title,
|
||||||
status: issues.status,
|
status: issues.status,
|
||||||
priority: issues.priority,
|
priority: issues.priority,
|
||||||
|
workMode: issues.workMode,
|
||||||
})
|
})
|
||||||
.from(issues)
|
.from(issues)
|
||||||
.where(and(eq(issues.id, issueId), eq(issues.companyId, input.companyId)))
|
.where(and(eq(issues.id, issueId), eq(issues.companyId, input.companyId)))
|
||||||
@@ -1936,6 +1971,7 @@ async function buildPaperclipWakePayload(input: {
|
|||||||
title: issueSummary.title,
|
title: issueSummary.title,
|
||||||
status: issueSummary.status,
|
status: issueSummary.status,
|
||||||
priority: issueSummary.priority,
|
priority: issueSummary.priority,
|
||||||
|
workMode: issueSummary.workMode,
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
childIssueSummaries: Array.isArray(input.contextSnapshot.childIssueSummaries)
|
childIssueSummaries: Array.isArray(input.contextSnapshot.childIssueSummaries)
|
||||||
@@ -1955,6 +1991,8 @@ async function buildPaperclipWakePayload(input: {
|
|||||||
instruction: readNonEmptyString(input.contextSnapshot.livenessContinuationInstruction),
|
instruction: readNonEmptyString(input.contextSnapshot.livenessContinuationInstruction),
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
|
interactionKind: readNonEmptyString(input.contextSnapshot.interactionKind),
|
||||||
|
interactionStatus: readNonEmptyString(input.contextSnapshot.interactionStatus),
|
||||||
checkedOutByHarness: input.contextSnapshot[PAPERCLIP_HARNESS_CHECKOUT_KEY] === true,
|
checkedOutByHarness: input.contextSnapshot[PAPERCLIP_HARNESS_CHECKOUT_KEY] === true,
|
||||||
dependencyBlockedInteraction: input.contextSnapshot.dependencyBlockedInteraction === true,
|
dependencyBlockedInteraction: input.contextSnapshot.dependencyBlockedInteraction === true,
|
||||||
treeHoldInteraction: input.contextSnapshot.treeHoldInteraction === true,
|
treeHoldInteraction: input.contextSnapshot.treeHoldInteraction === true,
|
||||||
@@ -2016,12 +2054,17 @@ export function buildPaperclipTaskMarkdown(input: {
|
|||||||
id: string;
|
id: string;
|
||||||
identifier: string | null;
|
identifier: string | null;
|
||||||
title: string;
|
title: string;
|
||||||
|
workMode?: string | null;
|
||||||
description?: string | null;
|
description?: string | null;
|
||||||
} | null;
|
} | null;
|
||||||
wakeComment?: {
|
wakeComment?: {
|
||||||
id: string;
|
id: string;
|
||||||
body: string;
|
body: string;
|
||||||
} | null;
|
} | null;
|
||||||
|
interaction?: {
|
||||||
|
kind?: string | null;
|
||||||
|
status?: string | null;
|
||||||
|
} | null;
|
||||||
}) {
|
}) {
|
||||||
const quoteTaskScalar = (value: string) => JSON.stringify(value);
|
const quoteTaskScalar = (value: string) => JSON.stringify(value);
|
||||||
const fenceTaskText = (value: string) => {
|
const fenceTaskText = (value: string) => {
|
||||||
@@ -2034,6 +2077,10 @@ export function buildPaperclipTaskMarkdown(input: {
|
|||||||
};
|
};
|
||||||
const issue = input.issue;
|
const issue = input.issue;
|
||||||
const wakeComment = input.wakeComment ?? null;
|
const wakeComment = input.wakeComment ?? null;
|
||||||
|
const acceptedPlanContinuation =
|
||||||
|
!wakeComment &&
|
||||||
|
input.interaction?.kind === "request_confirmation" &&
|
||||||
|
input.interaction.status === "accepted";
|
||||||
if (!issue && !wakeComment) return null;
|
if (!issue && !wakeComment) return null;
|
||||||
|
|
||||||
const lines = [
|
const lines = [
|
||||||
@@ -2045,6 +2092,21 @@ export function buildPaperclipTaskMarkdown(input: {
|
|||||||
`- Issue: ${quoteTaskScalar(issue.identifier || issue.id)}`,
|
`- Issue: ${quoteTaskScalar(issue.identifier || issue.id)}`,
|
||||||
`- Title: ${quoteTaskScalar(issue.title)}`,
|
`- Title: ${quoteTaskScalar(issue.title)}`,
|
||||||
);
|
);
|
||||||
|
if (issue.workMode === "planning") {
|
||||||
|
let directive = "Make the plan only. Do not write code or perform implementation work.";
|
||||||
|
if (wakeComment) {
|
||||||
|
directive = "Update the plan only. Do not write code or perform implementation work.";
|
||||||
|
}
|
||||||
|
if (acceptedPlanContinuation) {
|
||||||
|
directive = "Create child issues from the approved plan only. Do not write code or perform implementation work on the planning issue.";
|
||||||
|
}
|
||||||
|
lines.push(
|
||||||
|
`- Work mode: ${quoteTaskScalar("planning")}`,
|
||||||
|
"",
|
||||||
|
"Planning mode directive:",
|
||||||
|
directive,
|
||||||
|
);
|
||||||
|
}
|
||||||
const description = issue.description?.trim();
|
const description = issue.description?.trim();
|
||||||
if (description) {
|
if (description) {
|
||||||
lines.push("", "Issue description:", fenceTaskText(description));
|
lines.push("", "Issue description:", fenceTaskText(description));
|
||||||
@@ -2328,6 +2390,7 @@ export function heartbeatService(db: Db, options: HeartbeatServiceOptions = {})
|
|||||||
title: issues.title,
|
title: issues.title,
|
||||||
description: issues.description,
|
description: issues.description,
|
||||||
status: issues.status,
|
status: issues.status,
|
||||||
|
workMode: issues.workMode,
|
||||||
priority: issues.priority,
|
priority: issues.priority,
|
||||||
projectId: issues.projectId,
|
projectId: issues.projectId,
|
||||||
projectWorkspaceId: issues.projectWorkspaceId,
|
projectWorkspaceId: issues.projectWorkspaceId,
|
||||||
@@ -6564,6 +6627,7 @@ export function heartbeatService(db: Db, options: HeartbeatServiceOptions = {})
|
|||||||
title: issueContext.title,
|
title: issueContext.title,
|
||||||
status: issueContext.status,
|
status: issueContext.status,
|
||||||
priority: issueContext.priority,
|
priority: issueContext.priority,
|
||||||
|
workMode: issueContext.workMode,
|
||||||
description: issueContext.description,
|
description: issueContext.description,
|
||||||
projectId: issueContext.projectId,
|
projectId: issueContext.projectId,
|
||||||
projectWorkspaceId: issueContext.projectWorkspaceId,
|
projectWorkspaceId: issueContext.projectWorkspaceId,
|
||||||
@@ -6596,6 +6660,7 @@ export function heartbeatService(db: Db, options: HeartbeatServiceOptions = {})
|
|||||||
title: issueRef.title,
|
title: issueRef.title,
|
||||||
status: issueRef.status,
|
status: issueRef.status,
|
||||||
priority: issueRef.priority,
|
priority: issueRef.priority,
|
||||||
|
workMode: issueRef.workMode,
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
});
|
});
|
||||||
@@ -6610,10 +6675,15 @@ export function heartbeatService(db: Db, options: HeartbeatServiceOptions = {})
|
|||||||
id: issueRef.id,
|
id: issueRef.id,
|
||||||
identifier: issueRef.identifier,
|
identifier: issueRef.identifier,
|
||||||
title: issueRef.title,
|
title: issueRef.title,
|
||||||
|
workMode: issueRef.workMode,
|
||||||
description: issueRef.description,
|
description: issueRef.description,
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
wakeComment: wakeCommentContext,
|
wakeComment: wakeCommentContext,
|
||||||
|
interaction: {
|
||||||
|
kind: readNonEmptyString(context.interactionKind),
|
||||||
|
status: readNonEmptyString(context.interactionStatus),
|
||||||
|
},
|
||||||
});
|
});
|
||||||
if (issueRef) {
|
if (issueRef) {
|
||||||
context.paperclipIssue = {
|
context.paperclipIssue = {
|
||||||
@@ -6621,6 +6691,7 @@ export function heartbeatService(db: Db, options: HeartbeatServiceOptions = {})
|
|||||||
identifier: issueRef.identifier,
|
identifier: issueRef.identifier,
|
||||||
title: issueRef.title,
|
title: issueRef.title,
|
||||||
description: issueRef.description,
|
description: issueRef.description,
|
||||||
|
workMode: issueRef.workMode,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
delete context.paperclipIssue;
|
delete context.paperclipIssue;
|
||||||
@@ -8764,7 +8835,7 @@ export function heartbeatService(db: Db, options: HeartbeatServiceOptions = {})
|
|||||||
if (coalescedTargetRun) {
|
if (coalescedTargetRun) {
|
||||||
const mergedContextSnapshot = mergeCoalescedContextSnapshot(
|
const mergedContextSnapshot = mergeCoalescedContextSnapshot(
|
||||||
coalescedTargetRun.contextSnapshot,
|
coalescedTargetRun.contextSnapshot,
|
||||||
contextSnapshot,
|
enrichedContextSnapshot,
|
||||||
);
|
);
|
||||||
const mergedRun = await db
|
const mergedRun = await db
|
||||||
.update(heartbeatRuns)
|
.update(heartbeatRuns)
|
||||||
|
|||||||
@@ -839,6 +839,7 @@ export function issueThreadInteractionService(db: Db) {
|
|||||||
title: task.title,
|
title: task.title,
|
||||||
description: task.description ?? null,
|
description: task.description ?? null,
|
||||||
status: "todo",
|
status: "todo",
|
||||||
|
workMode: task.workMode ?? "standard",
|
||||||
priority: task.priority ?? "medium",
|
priority: task.priority ?? "medium",
|
||||||
assigneeAgentId: task.assigneeAgentId ?? null,
|
assigneeAgentId: task.assigneeAgentId ?? null,
|
||||||
assigneeUserId: task.assigneeUserId ?? null,
|
assigneeUserId: task.assigneeUserId ?? null,
|
||||||
|
|||||||
@@ -1430,6 +1430,7 @@ const issueListSelect = {
|
|||||||
END
|
END
|
||||||
`,
|
`,
|
||||||
status: issues.status,
|
status: issues.status,
|
||||||
|
workMode: issues.workMode,
|
||||||
priority: issues.priority,
|
priority: issues.priority,
|
||||||
assigneeAgentId: issues.assigneeAgentId,
|
assigneeAgentId: issues.assigneeAgentId,
|
||||||
assigneeUserId: issues.assigneeUserId,
|
assigneeUserId: issues.assigneeUserId,
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ export interface ExecutionWorkspaceIssueRef {
|
|||||||
id: string;
|
id: string;
|
||||||
identifier: string | null;
|
identifier: string | null;
|
||||||
title: string | null;
|
title: string | null;
|
||||||
|
workMode?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ExecutionWorkspaceAgentRef {
|
export interface ExecutionWorkspaceAgentRef {
|
||||||
@@ -712,6 +713,7 @@ function buildWorkspaceCommandEnv(input: {
|
|||||||
env.PAPERCLIP_ISSUE_ID = input.issue?.id ?? "";
|
env.PAPERCLIP_ISSUE_ID = input.issue?.id ?? "";
|
||||||
env.PAPERCLIP_ISSUE_IDENTIFIER = input.issue?.identifier ?? "";
|
env.PAPERCLIP_ISSUE_IDENTIFIER = input.issue?.identifier ?? "";
|
||||||
env.PAPERCLIP_ISSUE_TITLE = input.issue?.title ?? "";
|
env.PAPERCLIP_ISSUE_TITLE = input.issue?.title ?? "";
|
||||||
|
env.PAPERCLIP_ISSUE_WORK_MODE = input.issue?.workMode ?? "";
|
||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,157 @@
|
|||||||
|
import { expect, test } from "@playwright/test";
|
||||||
|
|
||||||
|
const SKIP_LLM = process.env.PAPERCLIP_E2E_SKIP_LLM !== "false";
|
||||||
|
|
||||||
|
const AGENT_NAME = "CEO";
|
||||||
|
const TASK_TITLE = "PAP-3413 planning mode evidence";
|
||||||
|
|
||||||
|
test("captures planning mode UI for desktop and mobile", async ({ page }) => {
|
||||||
|
const timestamp = Date.now();
|
||||||
|
const companyName = `PAP-3413-${timestamp}`;
|
||||||
|
const screenshotDir = "test-results/planning-mode";
|
||||||
|
|
||||||
|
await page.goto("/onboarding");
|
||||||
|
await expect(page.locator("h3", { hasText: "Name your company" })).toBeVisible({ timeout: 5_000 });
|
||||||
|
|
||||||
|
await page.locator('input[placeholder="Acme Corp"]').fill(companyName);
|
||||||
|
await page.getByRole("button", { name: "Next" }).click();
|
||||||
|
|
||||||
|
await expect(page.locator("h3", { hasText: "Create your first agent" })).toBeVisible({ timeout: 30_000 });
|
||||||
|
await expect(page.locator('input[placeholder="CEO"]')).toHaveValue(AGENT_NAME);
|
||||||
|
await page.getByRole("button", { name: "Next" }).click();
|
||||||
|
|
||||||
|
await expect(page.locator("h3", { hasText: "Give it something to do" })).toBeVisible({ timeout: 30_000 });
|
||||||
|
const baseUrl = page.url().split("/").slice(0, 3).join("/");
|
||||||
|
|
||||||
|
if (SKIP_LLM) {
|
||||||
|
const companiesAfterAgentRes = await page.request.get(`${baseUrl}/api/companies`);
|
||||||
|
expect(companiesAfterAgentRes.ok()).toBe(true);
|
||||||
|
const companiesAfterAgent = await companiesAfterAgentRes.json();
|
||||||
|
const companyAfterAgent = companiesAfterAgent.find((c: { name: string }) => c.name === companyName);
|
||||||
|
expect(companyAfterAgent).toBeTruthy();
|
||||||
|
|
||||||
|
const agentsAfterCreateRes = await page.request.get(`${baseUrl}/api/companies/${companyAfterAgent.id}/agents`);
|
||||||
|
expect(agentsAfterCreateRes.ok()).toBe(true);
|
||||||
|
const agentsAfterCreate = await agentsAfterCreateRes.json();
|
||||||
|
const ceoAgentAfterCreate = agentsAfterCreate.find((a: { name: string }) => a.name === AGENT_NAME);
|
||||||
|
expect(ceoAgentAfterCreate).toBeTruthy();
|
||||||
|
|
||||||
|
const disableWakeRes = await page.request.patch(
|
||||||
|
`${baseUrl}/api/agents/${ceoAgentAfterCreate.id}?companyId=${encodeURIComponent(companyAfterAgent.id)}`,
|
||||||
|
{
|
||||||
|
data: {
|
||||||
|
runtimeConfig: {
|
||||||
|
heartbeat: {
|
||||||
|
enabled: false,
|
||||||
|
intervalSec: 300,
|
||||||
|
wakeOnDemand: false,
|
||||||
|
cooldownSec: 10,
|
||||||
|
maxConcurrentRuns: 5,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
expect(disableWakeRes.ok()).toBe(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
const taskTitleInput = page.locator('input[placeholder="e.g. Research competitor pricing"]');
|
||||||
|
await taskTitleInput.clear();
|
||||||
|
await taskTitleInput.fill(TASK_TITLE);
|
||||||
|
await page.getByRole("button", { name: "Next" }).click();
|
||||||
|
|
||||||
|
await expect(page.locator("h3", { hasText: "Ready to launch" })).toBeVisible({ timeout: 30_000 });
|
||||||
|
await page.getByRole("button", { name: "Create & Open Issue" }).click();
|
||||||
|
await expect(page).toHaveURL(/\/issues\//, { timeout: 30_000 });
|
||||||
|
|
||||||
|
const openedIssueUrl = page.url();
|
||||||
|
const openedIssueIdentifier = openedIssueUrl.split("/").filter(Boolean).pop();
|
||||||
|
const baseOrigin = new URL(openedIssueUrl).origin;
|
||||||
|
const companyRes = await page.request.get(`${baseOrigin}/api/companies`);
|
||||||
|
expect(companyRes.ok()).toBe(true);
|
||||||
|
const companies = await companyRes.json();
|
||||||
|
const company = companies.find((c: { name: string }) => c.name === companyName);
|
||||||
|
expect(company).toBeTruthy();
|
||||||
|
const issueRes = await page.request.get(`${baseOrigin}/api/companies/${company.id}/issues`);
|
||||||
|
expect(issueRes.ok()).toBe(true);
|
||||||
|
const issues = await issueRes.json();
|
||||||
|
const planningSeedIssue = issues.find(
|
||||||
|
(candidate: { id: string; identifier?: string; title: string }) =>
|
||||||
|
candidate.identifier === openedIssueIdentifier || candidate.id === openedIssueIdentifier || candidate.title === TASK_TITLE,
|
||||||
|
);
|
||||||
|
expect(planningSeedIssue).toBeTruthy();
|
||||||
|
|
||||||
|
const issue = planningSeedIssue;
|
||||||
|
const issueIdentifier = issue.identifier ?? issue.id;
|
||||||
|
const issuePath = `/${company.issuePrefix ?? company.id}/issues/${issueIdentifier}`;
|
||||||
|
const companyPrefix = company.issuePrefix ?? company.id;
|
||||||
|
const issueLinkSelector = `a[href$="/issues/${issueIdentifier}"]`;
|
||||||
|
|
||||||
|
const setMode = async (mode: "standard" | "planning") => {
|
||||||
|
const patchRes = await page.request.patch(`${baseOrigin}/api/issues/${issue.id}`, {
|
||||||
|
data: { workMode: mode },
|
||||||
|
});
|
||||||
|
expect(patchRes.ok()).toBe(true);
|
||||||
|
await expect
|
||||||
|
.poll(async () => {
|
||||||
|
const currentRes = await page.request.get(`${baseOrigin}/api/issues/${issue.id}`);
|
||||||
|
expect(currentRes.ok()).toBe(true);
|
||||||
|
const current = await currentRes.json();
|
||||||
|
return current.workMode;
|
||||||
|
}, { timeout: 10_000 })
|
||||||
|
.toBe(mode);
|
||||||
|
};
|
||||||
|
|
||||||
|
await setMode("planning");
|
||||||
|
|
||||||
|
await page.goto(issuePath);
|
||||||
|
await expect(page.getByText("Planning").first()).toBeVisible();
|
||||||
|
await expect(page.getByTestId("issue-chat-composer")).toHaveAttribute("data-pending-work-mode", "planning");
|
||||||
|
const desktopPlanningToggle = page.getByTestId("issue-chat-composer-work-mode-toggle");
|
||||||
|
await expect(desktopPlanningToggle).toBeVisible();
|
||||||
|
await expect(desktopPlanningToggle).toHaveAttribute("data-pending-work-mode", "planning");
|
||||||
|
await expect(desktopPlanningToggle).toHaveAttribute("aria-pressed", "true");
|
||||||
|
|
||||||
|
await page.screenshot({
|
||||||
|
path: `${screenshotDir}/desktop-planning-detail-${timestamp}.png`,
|
||||||
|
fullPage: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto(`/${companyPrefix}/issues`);
|
||||||
|
await expect(page.locator(issueLinkSelector)).toBeVisible();
|
||||||
|
await expect(page.locator(issueLinkSelector)).toContainText("Planning");
|
||||||
|
await page.screenshot({
|
||||||
|
path: `${screenshotDir}/desktop-planning-row-${timestamp}.png`,
|
||||||
|
fullPage: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto(issuePath);
|
||||||
|
await page.getByTestId("issue-chat-composer-work-mode-toggle").click();
|
||||||
|
await expect(page.getByTestId("issue-chat-composer")).toHaveAttribute("data-pending-work-mode", "standard");
|
||||||
|
await expect(page.getByTestId("issue-chat-composer-work-mode-toggle")).toBeHidden();
|
||||||
|
await page.screenshot({
|
||||||
|
path: `${screenshotDir}/desktop-standard-toggle-${timestamp}.png`,
|
||||||
|
fullPage: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
await setMode("planning");
|
||||||
|
await page.setViewportSize({ width: 390, height: 844 });
|
||||||
|
await page.goto(issuePath);
|
||||||
|
await expect(page.getByText("Planning").first()).toBeVisible();
|
||||||
|
const mobilePlanningToggle = page.getByTestId("issue-chat-composer-work-mode-toggle");
|
||||||
|
await expect(mobilePlanningToggle).toBeVisible();
|
||||||
|
await expect(mobilePlanningToggle).toHaveAttribute("data-pending-work-mode", "planning");
|
||||||
|
await expect(mobilePlanningToggle).toHaveAttribute("aria-pressed", "true");
|
||||||
|
await page.screenshot({
|
||||||
|
path: `${screenshotDir}/mobile-planning-detail-${timestamp}.png`,
|
||||||
|
fullPage: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto(`/${companyPrefix}/issues`);
|
||||||
|
await expect(page.locator(issueLinkSelector)).toBeVisible();
|
||||||
|
await expect(page.locator(issueLinkSelector)).toContainText("Planning");
|
||||||
|
await page.screenshot({
|
||||||
|
path: `${screenshotDir}/mobile-planning-row-${timestamp}.png`,
|
||||||
|
fullPage: true,
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -346,6 +346,104 @@ describe("IssueChatThread", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("renders the composer in planning mode when the issue is in planning mode", () => {
|
||||||
|
const root = createRoot(container);
|
||||||
|
|
||||||
|
act(() => {
|
||||||
|
root.render(
|
||||||
|
<MemoryRouter>
|
||||||
|
<IssueChatThread
|
||||||
|
comments={[]}
|
||||||
|
linkedRuns={[]}
|
||||||
|
timelineEvents={[]}
|
||||||
|
liveRuns={[]}
|
||||||
|
issueWorkMode="planning"
|
||||||
|
onWorkModeChange={() => {}}
|
||||||
|
onAdd={async () => {}}
|
||||||
|
enableLiveTranscriptPolling={false}
|
||||||
|
/>
|
||||||
|
</MemoryRouter>,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const composer = container.querySelector('[data-testid="issue-chat-composer"]');
|
||||||
|
expect(composer).not.toBeNull();
|
||||||
|
expect(composer?.getAttribute("data-pending-work-mode")).toBe("planning");
|
||||||
|
expect(composer?.className).toContain("amber");
|
||||||
|
|
||||||
|
const toggle = container.querySelector(
|
||||||
|
'[data-testid="issue-chat-composer-work-mode-toggle"]',
|
||||||
|
);
|
||||||
|
expect(toggle).not.toBeNull();
|
||||||
|
expect(toggle?.getAttribute("data-pending-work-mode")).toBe("planning");
|
||||||
|
expect(toggle?.textContent).toContain("Planning");
|
||||||
|
|
||||||
|
act(() => {
|
||||||
|
root.unmount();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("hides the planning chip on a standard issue and exposes the toggle through the menu", () => {
|
||||||
|
const root = createRoot(container);
|
||||||
|
const onWorkModeChange = vi.fn();
|
||||||
|
|
||||||
|
act(() => {
|
||||||
|
root.render(
|
||||||
|
<MemoryRouter>
|
||||||
|
<IssueChatThread
|
||||||
|
comments={[]}
|
||||||
|
linkedRuns={[]}
|
||||||
|
timelineEvents={[]}
|
||||||
|
liveRuns={[]}
|
||||||
|
issueWorkMode="standard"
|
||||||
|
onWorkModeChange={onWorkModeChange}
|
||||||
|
onAdd={async () => {}}
|
||||||
|
enableLiveTranscriptPolling={false}
|
||||||
|
/>
|
||||||
|
</MemoryRouter>,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(
|
||||||
|
container.querySelector('[data-testid="issue-chat-composer-work-mode-toggle"]'),
|
||||||
|
).toBeNull();
|
||||||
|
const composer = container.querySelector('[data-testid="issue-chat-composer"]');
|
||||||
|
expect(composer?.getAttribute("data-pending-work-mode")).toBe("standard");
|
||||||
|
expect(composer?.className).not.toContain("amber");
|
||||||
|
|
||||||
|
const menuTrigger = container.querySelector(
|
||||||
|
'[data-testid="issue-chat-composer-work-mode-menu"]',
|
||||||
|
) as HTMLButtonElement | null;
|
||||||
|
expect(menuTrigger).not.toBeNull();
|
||||||
|
act(() => {
|
||||||
|
menuTrigger?.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
const menuItem = document.querySelector(
|
||||||
|
'[data-testid="issue-chat-composer-work-mode-menu-toggle"]',
|
||||||
|
) as HTMLButtonElement | null;
|
||||||
|
expect(menuItem).not.toBeNull();
|
||||||
|
expect(menuItem?.textContent).toContain("Switch to planning");
|
||||||
|
|
||||||
|
act(() => {
|
||||||
|
menuItem?.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(onWorkModeChange).not.toHaveBeenCalled();
|
||||||
|
expect(composer?.getAttribute("data-pending-work-mode")).toBe("planning");
|
||||||
|
expect(composer?.className).toContain("amber");
|
||||||
|
|
||||||
|
const visibleChip = container.querySelector(
|
||||||
|
'[data-testid="issue-chat-composer-work-mode-toggle"]',
|
||||||
|
);
|
||||||
|
expect(visibleChip).not.toBeNull();
|
||||||
|
expect(visibleChip?.textContent).toContain("Planning");
|
||||||
|
|
||||||
|
act(() => {
|
||||||
|
root.unmount();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("virtualizes long merged threads so only a windowed slice mounts", () => {
|
it("virtualizes long merged threads so only a windowed slice mounts", () => {
|
||||||
const root = createRoot(container);
|
const root = createRoot(container);
|
||||||
const totalMergedRows =
|
const totalMergedRows =
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import type {
|
|||||||
IssueBlockerAttention,
|
IssueBlockerAttention,
|
||||||
IssueRelationIssueSummary,
|
IssueRelationIssueSummary,
|
||||||
SuccessfulRunHandoffState,
|
SuccessfulRunHandoffState,
|
||||||
|
IssueWorkMode,
|
||||||
} from "@paperclipai/shared";
|
} from "@paperclipai/shared";
|
||||||
import type { ActiveRunForIssue, LiveRunForIssue } from "../api/heartbeats";
|
import type { ActiveRunForIssue, LiveRunForIssue } from "../api/heartbeats";
|
||||||
import { useLiveRunTranscripts } from "./transcript/useLiveRunTranscripts";
|
import { useLiveRunTranscripts } from "./transcript/useLiveRunTranscripts";
|
||||||
@@ -117,7 +118,7 @@ import { cn, formatDateTime, formatShortDate } from "../lib/utils";
|
|||||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||||
import { Textarea } from "@/components/ui/textarea";
|
import { Textarea } from "@/components/ui/textarea";
|
||||||
import { AlertTriangle, ArrowRight, Brain, Check, ChevronDown, Copy, Hammer, Loader2, MoreHorizontal, Paperclip, PauseCircle, Search, Square, ThumbsDown, ThumbsUp } from "lucide-react";
|
import { AlertTriangle, ArrowRight, Brain, Check, ChevronDown, ClipboardList, Copy, Hammer, Loader2, MoreHorizontal, Paperclip, PauseCircle, Search, Square, ThumbsDown, ThumbsUp } from "lucide-react";
|
||||||
import { IssueBlockedNotice } from "./IssueBlockedNotice";
|
import { IssueBlockedNotice } from "./IssueBlockedNotice";
|
||||||
|
|
||||||
interface IssueChatMessageContext {
|
interface IssueChatMessageContext {
|
||||||
@@ -261,6 +262,8 @@ interface IssueChatComposerProps {
|
|||||||
composerDisabledReason?: string | null;
|
composerDisabledReason?: string | null;
|
||||||
composerHint?: string | null;
|
composerHint?: string | null;
|
||||||
issueStatus?: string;
|
issueStatus?: string;
|
||||||
|
issueWorkMode?: IssueWorkMode;
|
||||||
|
onWorkModeChange?: (workMode: IssueWorkMode) => Promise<void> | void;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IssueChatThreadProps {
|
interface IssueChatThreadProps {
|
||||||
@@ -304,6 +307,7 @@ interface IssueChatThreadProps {
|
|||||||
mentions?: MentionOption[];
|
mentions?: MentionOption[];
|
||||||
composerDisabledReason?: string | null;
|
composerDisabledReason?: string | null;
|
||||||
composerHint?: string | null;
|
composerHint?: string | null;
|
||||||
|
onWorkModeChange?: (workMode: IssueWorkMode) => Promise<void> | void;
|
||||||
showComposer?: boolean;
|
showComposer?: boolean;
|
||||||
showJumpToLatest?: boolean;
|
showJumpToLatest?: boolean;
|
||||||
emptyMessage?: string;
|
emptyMessage?: string;
|
||||||
@@ -333,6 +337,7 @@ interface IssueChatThreadProps {
|
|||||||
interaction: AskUserQuestionsInteraction,
|
interaction: AskUserQuestionsInteraction,
|
||||||
) => Promise<void> | void;
|
) => Promise<void> | void;
|
||||||
composerRef?: Ref<IssueChatComposerHandle>;
|
composerRef?: Ref<IssueChatComposerHandle>;
|
||||||
|
issueWorkMode?: IssueWorkMode;
|
||||||
/**
|
/**
|
||||||
* Hook for the parent to refetch comments when the user explicitly asks
|
* Hook for the parent to refetch comments when the user explicitly asks
|
||||||
* to jump to the latest comment. Used to make sure the absolute newest
|
* to jump to the latest comment. Used to make sure the absolute newest
|
||||||
@@ -2816,6 +2821,8 @@ const IssueChatComposer = forwardRef<IssueChatComposerHandle, IssueChatComposerP
|
|||||||
composerDisabledReason = null,
|
composerDisabledReason = null,
|
||||||
composerHint = null,
|
composerHint = null,
|
||||||
issueStatus,
|
issueStatus,
|
||||||
|
issueWorkMode,
|
||||||
|
onWorkModeChange,
|
||||||
}, forwardedRef) {
|
}, forwardedRef) {
|
||||||
const api = useAui();
|
const api = useAui();
|
||||||
const toastActions = useOptionalToastActions();
|
const toastActions = useOptionalToastActions();
|
||||||
@@ -2828,6 +2835,10 @@ const IssueChatComposer = forwardRef<IssueChatComposerHandle, IssueChatComposerP
|
|||||||
const effectiveSuggestedAssigneeValue = suggestedAssigneeValue ?? currentAssigneeValue;
|
const effectiveSuggestedAssigneeValue = suggestedAssigneeValue ?? currentAssigneeValue;
|
||||||
const [reassignTarget, setReassignTarget] = useState(effectiveSuggestedAssigneeValue);
|
const [reassignTarget, setReassignTarget] = useState(effectiveSuggestedAssigneeValue);
|
||||||
const [unassignedConfirmed, setUnassignedConfirmed] = useState(false);
|
const [unassignedConfirmed, setUnassignedConfirmed] = useState(false);
|
||||||
|
const resolvedIssueWorkMode: IssueWorkMode = issueWorkMode ?? "standard";
|
||||||
|
const [pendingWorkMode, setPendingWorkMode] = useState<IssueWorkMode>(resolvedIssueWorkMode);
|
||||||
|
const [workModeMenuOpen, setWorkModeMenuOpen] = useState(false);
|
||||||
|
const canToggleWorkMode = typeof onWorkModeChange === "function";
|
||||||
const attachInputRef = useRef<HTMLInputElement | null>(null);
|
const attachInputRef = useRef<HTMLInputElement | null>(null);
|
||||||
const editorRef = useRef<MarkdownEditorRef>(null);
|
const editorRef = useRef<MarkdownEditorRef>(null);
|
||||||
const composerContainerRef = useRef<HTMLDivElement | null>(null);
|
const composerContainerRef = useRef<HTMLDivElement | null>(null);
|
||||||
@@ -2878,6 +2889,10 @@ const IssueChatComposer = forwardRef<IssueChatComposerHandle, IssueChatComposerP
|
|||||||
setUnassignedConfirmed(false);
|
setUnassignedConfirmed(false);
|
||||||
}, [reassignTarget]);
|
}, [reassignTarget]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setPendingWorkMode(resolvedIssueWorkMode);
|
||||||
|
}, [resolvedIssueWorkMode]);
|
||||||
|
|
||||||
useImperativeHandle(forwardedRef, () => ({
|
useImperativeHandle(forwardedRef, () => ({
|
||||||
focus: focusComposer,
|
focus: focusComposer,
|
||||||
restoreDraft: (submittedBody: string) => {
|
restoreDraft: (submittedBody: string) => {
|
||||||
@@ -2920,10 +2935,14 @@ const IssueChatComposer = forwardRef<IssueChatComposerHandle, IssueChatComposerP
|
|||||||
const submittedBody = trimmed;
|
const submittedBody = trimmed;
|
||||||
const viewportSnapshot = captureComposerViewportSnapshot(composerContainerRef.current);
|
const viewportSnapshot = captureComposerViewportSnapshot(composerContainerRef.current);
|
||||||
|
|
||||||
|
const workModeChanged = pendingWorkMode !== resolvedIssueWorkMode;
|
||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
setBody("");
|
setBody("");
|
||||||
setUnassignedConfirmed(false);
|
setUnassignedConfirmed(false);
|
||||||
try {
|
try {
|
||||||
|
if (workModeChanged && onWorkModeChange) {
|
||||||
|
await onWorkModeChange(pendingWorkMode);
|
||||||
|
}
|
||||||
const appendPromise = api.thread().append({
|
const appendPromise = api.thread().append({
|
||||||
role: "user",
|
role: "user",
|
||||||
content: [{ type: "text", text: submittedBody }],
|
content: [{ type: "text", text: submittedBody }],
|
||||||
@@ -3081,12 +3100,16 @@ const IssueChatComposer = forwardRef<IssueChatComposerHandle, IssueChatComposerP
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isPlanning = pendingWorkMode === "planning";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={composerContainerRef}
|
ref={composerContainerRef}
|
||||||
data-testid="issue-chat-composer"
|
data-testid="issue-chat-composer"
|
||||||
|
data-pending-work-mode={pendingWorkMode}
|
||||||
className={cn(
|
className={cn(
|
||||||
"relative rounded-md border border-border/70 bg-background/95 p-[15px] shadow-[0_-12px_28px_rgba(15,23,42,0.08)] backdrop-blur transition-[border-color,background-color,box-shadow] duration-150 supports-[backdrop-filter]:bg-background/85 dark:shadow-[0_-12px_28px_rgba(0,0,0,0.28)]",
|
"relative rounded-md border border-border/70 bg-background/95 p-[15px] shadow-[0_-12px_28px_rgba(15,23,42,0.08)] backdrop-blur transition-[border-color,background-color,box-shadow] duration-150 supports-[backdrop-filter]:bg-background/85 dark:shadow-[0_-12px_28px_rgba(0,0,0,0.28)]",
|
||||||
|
isPlanning && "border-amber-500/60 bg-amber-50/60 supports-[backdrop-filter]:bg-amber-50/40 dark:border-amber-500/50 dark:bg-amber-500/[0.07] dark:supports-[backdrop-filter]:bg-amber-500/[0.07]",
|
||||||
isDragOver && "border-primary/45 bg-background shadow-[0_-12px_28px_rgba(15,23,42,0.08),0_0_0_1px_hsl(var(--primary)/0.16)]",
|
isDragOver && "border-primary/45 bg-background shadow-[0_-12px_28px_rgba(15,23,42,0.08),0_0_0_1px_hsl(var(--primary)/0.16)]",
|
||||||
)}
|
)}
|
||||||
onDragEnterCapture={handleFileDragEnter}
|
onDragEnterCapture={handleFileDragEnter}
|
||||||
@@ -3178,25 +3201,77 @@ const IssueChatComposer = forwardRef<IssueChatComposerHandle, IssueChatComposerP
|
|||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<div className="flex flex-wrap items-center justify-end gap-3">
|
<div className="flex flex-wrap items-center justify-end gap-3">
|
||||||
{(onImageUpload || onAttachImage) ? (
|
<div className="mr-auto flex items-center gap-2">
|
||||||
<div className="mr-auto flex items-center gap-3">
|
{(onImageUpload || onAttachImage) ? (
|
||||||
<input
|
<>
|
||||||
ref={attachInputRef}
|
<input
|
||||||
type="file"
|
ref={attachInputRef}
|
||||||
className="hidden"
|
type="file"
|
||||||
onChange={handleAttachFile}
|
className="hidden"
|
||||||
/>
|
onChange={handleAttachFile}
|
||||||
<Button
|
/>
|
||||||
variant="ghost"
|
<Button
|
||||||
size="icon-sm"
|
variant="ghost"
|
||||||
onClick={() => attachInputRef.current?.click()}
|
size="icon-sm"
|
||||||
disabled={attaching}
|
onClick={() => attachInputRef.current?.click()}
|
||||||
title="Attach file"
|
disabled={attaching}
|
||||||
|
title="Attach file"
|
||||||
|
>
|
||||||
|
<Paperclip className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
{canToggleWorkMode ? (
|
||||||
|
<Popover open={workModeMenuOpen} onOpenChange={setWorkModeMenuOpen}>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="icon-sm"
|
||||||
|
data-testid="issue-chat-composer-work-mode-menu"
|
||||||
|
title="More composer options"
|
||||||
|
>
|
||||||
|
<MoreHorizontal className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-44 p-1" align="start">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
data-testid="issue-chat-composer-work-mode-menu-toggle"
|
||||||
|
data-pending-work-mode={pendingWorkMode}
|
||||||
|
className={cn(
|
||||||
|
"flex w-full items-center gap-2 rounded px-2 py-1.5 text-xs hover:bg-accent/50",
|
||||||
|
isPlanning ? "text-amber-700 dark:text-amber-300" : "text-foreground",
|
||||||
|
)}
|
||||||
|
onClick={() => {
|
||||||
|
setPendingWorkMode((prev) => (prev === "planning" ? "standard" : "planning"));
|
||||||
|
setWorkModeMenuOpen(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{isPlanning ? (
|
||||||
|
<Hammer className="h-3.5 w-3.5 shrink-0 text-muted-foreground" aria-hidden />
|
||||||
|
) : (
|
||||||
|
<ClipboardList className="h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-300" aria-hidden />
|
||||||
|
)}
|
||||||
|
<span>{isPlanning ? "Switch to standard" : "Switch to planning"}</span>
|
||||||
|
</button>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
) : null}
|
||||||
|
{canToggleWorkMode && isPlanning ? (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
data-testid="issue-chat-composer-work-mode-toggle"
|
||||||
|
data-pending-work-mode={pendingWorkMode}
|
||||||
|
aria-pressed
|
||||||
|
title="Planning mode is on for this submission. Click to switch to Standard."
|
||||||
|
onClick={() => setPendingWorkMode("standard")}
|
||||||
|
className="inline-flex items-center gap-1.5 rounded-md border border-amber-500/60 bg-amber-500/15 px-2 py-1 text-xs text-amber-800 transition-colors hover:bg-amber-500/25 dark:border-amber-500/50 dark:bg-amber-500/15 dark:text-amber-200 dark:hover:bg-amber-500/25"
|
||||||
>
|
>
|
||||||
<Paperclip className="h-4 w-4" />
|
<ClipboardList className="h-3.5 w-3.5" aria-hidden />
|
||||||
</Button>
|
<span>Planning</span>
|
||||||
</div>
|
</button>
|
||||||
) : null}
|
) : null}
|
||||||
|
</div>
|
||||||
|
|
||||||
{enableReassign && reassignOptions.length > 0 ? (
|
{enableReassign && reassignOptions.length > 0 ? (
|
||||||
<InlineEntitySelector
|
<InlineEntitySelector
|
||||||
@@ -3300,6 +3375,8 @@ export function IssueChatThread({
|
|||||||
onSubmitInteractionAnswers,
|
onSubmitInteractionAnswers,
|
||||||
onCancelInteraction,
|
onCancelInteraction,
|
||||||
composerRef,
|
composerRef,
|
||||||
|
issueWorkMode,
|
||||||
|
onWorkModeChange,
|
||||||
onRefreshLatestComments,
|
onRefreshLatestComments,
|
||||||
}: IssueChatThreadProps) {
|
}: IssueChatThreadProps) {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
@@ -3873,8 +3950,8 @@ export function IssueChatThread({
|
|||||||
stoppingRunId={stoppingRunId}
|
stoppingRunId={stoppingRunId}
|
||||||
interruptingQueuedRunId={interruptingQueuedRunId}
|
interruptingQueuedRunId={interruptingQueuedRunId}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
{showComposer ? (
|
{showComposer ? (
|
||||||
<div data-testid="issue-chat-thread-notices" className="space-y-2">
|
<div data-testid="issue-chat-thread-notices" className="space-y-2">
|
||||||
<IssueBlockedNotice
|
<IssueBlockedNotice
|
||||||
@@ -3923,6 +4000,8 @@ export function IssueChatThread({
|
|||||||
composerDisabledReason={composerDisabledReason}
|
composerDisabledReason={composerDisabledReason}
|
||||||
composerHint={composerHint}
|
composerHint={composerHint}
|
||||||
issueStatus={issueStatus}
|
issueStatus={issueStatus}
|
||||||
|
issueWorkMode={issueWorkMode}
|
||||||
|
onWorkModeChange={onWorkModeChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -215,6 +215,7 @@ function createIssue(): Issue {
|
|||||||
title: "Plan rendering",
|
title: "Plan rendering",
|
||||||
description: null,
|
description: null,
|
||||||
status: "in_progress",
|
status: "in_progress",
|
||||||
|
workMode: "standard",
|
||||||
priority: "medium",
|
priority: "medium",
|
||||||
assigneeAgentId: null,
|
assigneeAgentId: null,
|
||||||
assigneeUserId: null,
|
assigneeUserId: null,
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ function createIssue(overrides: Partial<Issue> = {}): Issue {
|
|||||||
createdAt: new Date("2026-04-11T10:00:00.000Z"),
|
createdAt: new Date("2026-04-11T10:00:00.000Z"),
|
||||||
updatedAt: new Date("2026-04-11T10:00:00.000Z"),
|
updatedAt: new Date("2026-04-11T10:00:00.000Z"),
|
||||||
...overrides,
|
...overrides,
|
||||||
|
workMode: overrides.workMode ?? "standard",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ function createIssue(overrides: Partial<Issue> = {}): Issue {
|
|||||||
createdAt: new Date("2026-04-06T12:00:00.000Z"),
|
createdAt: new Date("2026-04-06T12:00:00.000Z"),
|
||||||
updatedAt: new Date("2026-04-06T12:05:00.000Z"),
|
updatedAt: new Date("2026-04-06T12:05:00.000Z"),
|
||||||
...overrides,
|
...overrides,
|
||||||
|
workMode: overrides.workMode ?? "standard",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ function createIssue(overrides: Partial<Issue> = {}): Issue {
|
|||||||
lastExternalCommentAt: null,
|
lastExternalCommentAt: null,
|
||||||
isUnreadForMe: false,
|
isUnreadForMe: false,
|
||||||
...overrides,
|
...overrides,
|
||||||
|
workMode: overrides.workMode ?? "standard",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,6 +228,22 @@ describe("IssueRow", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("renders planning mode marker for planning work mode issues", () => {
|
||||||
|
const root = createRoot(container);
|
||||||
|
|
||||||
|
act(() => {
|
||||||
|
root.render(<IssueRow issue={createIssue({ workMode: "planning" })} />);
|
||||||
|
});
|
||||||
|
|
||||||
|
const link = container.querySelector("[data-inbox-issue-link]") as HTMLAnchorElement | null;
|
||||||
|
expect(link).not.toBeNull();
|
||||||
|
expect(link?.textContent).toContain("Planning");
|
||||||
|
|
||||||
|
act(() => {
|
||||||
|
root.unmount();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("renders without error when titleSuffix is omitted", () => {
|
it("renders without error when titleSuffix is omitted", () => {
|
||||||
const root = createRoot(container);
|
const root = createRoot(container);
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,14 @@ export function IssueRow({
|
|||||||
{checklistStepNumber}.
|
{checklistStepNumber}.
|
||||||
</span>
|
</span>
|
||||||
) : null;
|
) : null;
|
||||||
|
const planningModeIndicator = issue.workMode === "planning" ? (
|
||||||
|
<span
|
||||||
|
className="ml-1.5 inline-flex shrink-0 items-center rounded-full border border-amber-500/60 bg-amber-500/15 px-2 py-0.5 text-[10px] font-medium text-amber-700 dark:text-amber-300"
|
||||||
|
title="This issue is in planning mode."
|
||||||
|
>
|
||||||
|
Planning
|
||||||
|
</span>
|
||||||
|
) : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
@@ -104,6 +112,7 @@ export function IssueRow({
|
|||||||
<span className="flex shrink-0 items-center gap-1 pt-px sm:hidden">
|
<span className="flex shrink-0 items-center gap-1 pt-px sm:hidden">
|
||||||
{mobileLeading ?? <StatusIcon status={issue.status} blockerAttention={issue.blockerAttention} className={selectedStatusClass} />}
|
{mobileLeading ?? <StatusIcon status={issue.status} blockerAttention={issue.blockerAttention} className={selectedStatusClass} />}
|
||||||
{productivityReviewIndicator}
|
{productivityReviewIndicator}
|
||||||
|
{planningModeIndicator}
|
||||||
</span>
|
</span>
|
||||||
<span className="flex min-w-0 flex-1 flex-col gap-1 sm:contents">
|
<span className="flex min-w-0 flex-1 flex-col gap-1 sm:contents">
|
||||||
<span className={cn("line-clamp-2 text-sm sm:order-2 sm:min-w-0 sm:flex-1 sm:truncate sm:line-clamp-none", titleClassName)}>
|
<span className={cn("line-clamp-2 text-sm sm:order-2 sm:min-w-0 sm:flex-1 sm:truncate sm:line-clamp-none", titleClassName)}>
|
||||||
@@ -128,6 +137,7 @@ export function IssueRow({
|
|||||||
<span className="shrink-0 font-mono text-xs text-muted-foreground">
|
<span className="shrink-0 font-mono text-xs text-muted-foreground">
|
||||||
{identifier}
|
{identifier}
|
||||||
</span>
|
</span>
|
||||||
|
{planningModeIndicator}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{mobileMeta ? (
|
{mobileMeta ? (
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ function createIssue(overrides: Partial<Issue> = {}): Issue {
|
|||||||
createdAt: new Date("2026-04-18T19:00:00.000Z"),
|
createdAt: new Date("2026-04-18T19:00:00.000Z"),
|
||||||
updatedAt: new Date("2026-04-18T19:00:00.000Z"),
|
updatedAt: new Date("2026-04-18T19:00:00.000Z"),
|
||||||
...overrides,
|
...overrides,
|
||||||
|
workMode: overrides.workMode ?? "standard",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ function createIssue(overrides: Partial<Issue> = {}): Issue {
|
|||||||
labelIds: [],
|
labelIds: [],
|
||||||
currentExecutionWorkspace: null,
|
currentExecutionWorkspace: null,
|
||||||
...overrides,
|
...overrides,
|
||||||
|
workMode: overrides.workMode ?? "standard",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ function createIssue(overrides: Partial<Issue> = {}): Issue {
|
|||||||
lastActivityAt: null,
|
lastActivityAt: null,
|
||||||
isUnreadForMe: false,
|
isUnreadForMe: false,
|
||||||
...overrides,
|
...overrides,
|
||||||
|
workMode: overrides.workMode ?? "standard",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -405,6 +405,42 @@ describe("NewIssueDialog", () => {
|
|||||||
goalId: "goal-1",
|
goalId: "goal-1",
|
||||||
projectId: "project-1",
|
projectId: "project-1",
|
||||||
executionWorkspaceId: "workspace-1",
|
executionWorkspaceId: "workspace-1",
|
||||||
|
workMode: "standard",
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
act(() => root.unmount());
|
||||||
|
});
|
||||||
|
|
||||||
|
it("restores the planning mode from dialog defaults", async () => {
|
||||||
|
dialogState.newIssueDefaults = {
|
||||||
|
title: "Planned from defaults",
|
||||||
|
workMode: "planning",
|
||||||
|
};
|
||||||
|
|
||||||
|
const { root } = renderDialog(container);
|
||||||
|
await flush();
|
||||||
|
|
||||||
|
const planningButton = container.querySelector('[data-issue-work-mode="planning"]');
|
||||||
|
expect(planningButton?.className).toContain("bg-accent");
|
||||||
|
|
||||||
|
const submitButton = Array.from(container.querySelectorAll("button"))
|
||||||
|
.find((button) => button.textContent?.includes("Create Issue"));
|
||||||
|
expect(submitButton).not.toBeUndefined();
|
||||||
|
await vi.waitFor(() => {
|
||||||
|
expect(submitButton?.hasAttribute("disabled")).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
submitButton!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
||||||
|
});
|
||||||
|
await flush();
|
||||||
|
|
||||||
|
expect(mockIssuesApi.create).toHaveBeenCalledWith(
|
||||||
|
"company-1",
|
||||||
|
expect.objectContaining({
|
||||||
|
title: "Planned from defaults",
|
||||||
|
workMode: "planning",
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -545,6 +581,45 @@ describe("NewIssueDialog", () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
title: "Typed issue",
|
title: "Typed issue",
|
||||||
description: "Typed description",
|
description: "Typed description",
|
||||||
|
workMode: "standard",
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
act(() => root.unmount());
|
||||||
|
});
|
||||||
|
|
||||||
|
it("submits planning work mode when planning is selected", async () => {
|
||||||
|
const { root } = renderDialog(container);
|
||||||
|
await flush();
|
||||||
|
|
||||||
|
const titleInput = container.querySelector('textarea[placeholder="Issue title"]') as HTMLTextAreaElement | null;
|
||||||
|
expect(titleInput).not.toBeNull();
|
||||||
|
await typeTextareaValue(titleInput!, "Plan this first");
|
||||||
|
|
||||||
|
const planningButton = container.querySelector('[data-issue-work-mode="planning"]');
|
||||||
|
expect(planningButton).not.toBeNull();
|
||||||
|
await act(async () => {
|
||||||
|
planningButton!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
||||||
|
});
|
||||||
|
await flush();
|
||||||
|
|
||||||
|
const submitButton = Array.from(container.querySelectorAll("button"))
|
||||||
|
.find((button) => button.textContent?.includes("Create Issue"));
|
||||||
|
expect(submitButton).not.toBeUndefined();
|
||||||
|
await vi.waitFor(() => {
|
||||||
|
expect(submitButton?.hasAttribute("disabled")).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
submitButton!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
||||||
|
});
|
||||||
|
await flush();
|
||||||
|
|
||||||
|
expect(mockIssuesApi.create).toHaveBeenCalledWith(
|
||||||
|
"company-1",
|
||||||
|
expect.objectContaining({
|
||||||
|
title: "Plan this first",
|
||||||
|
workMode: "planning",
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { memo, useState, useEffect, useRef, useCallback, useMemo, type ChangeEvent, type DragEvent, type RefObject } from "react";
|
import { memo, useState, useEffect, useRef, useCallback, useMemo, type ChangeEvent, type DragEvent, type RefObject } from "react";
|
||||||
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
|
import type { IssueWorkMode } from "@paperclipai/shared";
|
||||||
import { pickTextColorForSolidBg } from "@/lib/color-contrast";
|
import { pickTextColorForSolidBg } from "@/lib/color-contrast";
|
||||||
import { useDialog } from "../context/DialogContext";
|
import { useDialog } from "../context/DialogContext";
|
||||||
import { useCompany } from "../context/CompanyContext";
|
import { useCompany } from "../context/CompanyContext";
|
||||||
@@ -43,6 +44,8 @@ import {
|
|||||||
ChevronRight,
|
ChevronRight,
|
||||||
ChevronDown,
|
ChevronDown,
|
||||||
CircleDot,
|
CircleDot,
|
||||||
|
ClipboardList,
|
||||||
|
Hammer,
|
||||||
Minus,
|
Minus,
|
||||||
ArrowUp,
|
ArrowUp,
|
||||||
ArrowDown,
|
ArrowDown,
|
||||||
@@ -86,6 +89,7 @@ interface IssueDraft {
|
|||||||
executionWorkspaceMode?: string;
|
executionWorkspaceMode?: string;
|
||||||
selectedExecutionWorkspaceId?: string;
|
selectedExecutionWorkspaceId?: string;
|
||||||
useIsolatedExecutionWorkspace?: boolean;
|
useIsolatedExecutionWorkspace?: boolean;
|
||||||
|
workMode?: IssueWorkMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
type StagedIssueFile = {
|
type StagedIssueFile = {
|
||||||
@@ -130,6 +134,19 @@ const ISSUE_THINKING_EFFORT_OPTIONS = {
|
|||||||
],
|
],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
function isIssueWorkMode(value: unknown): value is IssueWorkMode {
|
||||||
|
return value === "standard" || value === "planning";
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISSUE_WORK_MODE_OPTIONS: ReadonlyArray<{
|
||||||
|
value: IssueWorkMode;
|
||||||
|
label: string;
|
||||||
|
icon: typeof Hammer;
|
||||||
|
}> = [
|
||||||
|
{ value: "standard", label: "Standard", icon: Hammer },
|
||||||
|
{ value: "planning", label: "Planning", icon: ClipboardList },
|
||||||
|
];
|
||||||
|
|
||||||
function loadDraft(): IssueDraft | null {
|
function loadDraft(): IssueDraft | null {
|
||||||
try {
|
try {
|
||||||
const raw = localStorage.getItem(DRAFT_KEY);
|
const raw = localStorage.getItem(DRAFT_KEY);
|
||||||
@@ -400,6 +417,7 @@ export function NewIssueDialog() {
|
|||||||
const [assigneeChrome, setAssigneeChrome] = useState(false);
|
const [assigneeChrome, setAssigneeChrome] = useState(false);
|
||||||
const [executionWorkspaceMode, setExecutionWorkspaceMode] = useState<string>("shared_workspace");
|
const [executionWorkspaceMode, setExecutionWorkspaceMode] = useState<string>("shared_workspace");
|
||||||
const [selectedExecutionWorkspaceId, setSelectedExecutionWorkspaceId] = useState("");
|
const [selectedExecutionWorkspaceId, setSelectedExecutionWorkspaceId] = useState("");
|
||||||
|
const [workMode, setWorkMode] = useState<IssueWorkMode>("standard");
|
||||||
const [expanded, setExpanded] = useState(false);
|
const [expanded, setExpanded] = useState(false);
|
||||||
const [dialogCompanyId, setDialogCompanyId] = useState<string | null>(null);
|
const [dialogCompanyId, setDialogCompanyId] = useState<string | null>(null);
|
||||||
const [stagedFiles, setStagedFiles] = useState<StagedIssueFile[]>([]);
|
const [stagedFiles, setStagedFiles] = useState<StagedIssueFile[]>([]);
|
||||||
@@ -419,6 +437,7 @@ export function NewIssueDialog() {
|
|||||||
// Popover states
|
// Popover states
|
||||||
const [statusOpen, setStatusOpen] = useState(false);
|
const [statusOpen, setStatusOpen] = useState(false);
|
||||||
const [priorityOpen, setPriorityOpen] = useState(false);
|
const [priorityOpen, setPriorityOpen] = useState(false);
|
||||||
|
const [workModeOpen, setWorkModeOpen] = useState(false);
|
||||||
const [moreOpen, setMoreOpen] = useState(false);
|
const [moreOpen, setMoreOpen] = useState(false);
|
||||||
const [companyOpen, setCompanyOpen] = useState(false);
|
const [companyOpen, setCompanyOpen] = useState(false);
|
||||||
const descriptionEditorRef = useRef<MarkdownEditorRef>(null);
|
const descriptionEditorRef = useRef<MarkdownEditorRef>(null);
|
||||||
@@ -626,6 +645,7 @@ export function NewIssueDialog() {
|
|||||||
assigneeChrome,
|
assigneeChrome,
|
||||||
executionWorkspaceMode,
|
executionWorkspaceMode,
|
||||||
selectedExecutionWorkspaceId,
|
selectedExecutionWorkspaceId,
|
||||||
|
workMode,
|
||||||
});
|
});
|
||||||
}, [
|
}, [
|
||||||
newIssueOpen,
|
newIssueOpen,
|
||||||
@@ -642,6 +662,7 @@ export function NewIssueDialog() {
|
|||||||
assigneeChrome,
|
assigneeChrome,
|
||||||
executionWorkspaceMode,
|
executionWorkspaceMode,
|
||||||
selectedExecutionWorkspaceId,
|
selectedExecutionWorkspaceId,
|
||||||
|
workMode,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const handleTitleChange = useCallback((nextTitle: string) => {
|
const handleTitleChange = useCallback((nextTitle: string) => {
|
||||||
@@ -678,6 +699,7 @@ export function NewIssueDialog() {
|
|||||||
assigneeChrome,
|
assigneeChrome,
|
||||||
executionWorkspaceMode,
|
executionWorkspaceMode,
|
||||||
selectedExecutionWorkspaceId,
|
selectedExecutionWorkspaceId,
|
||||||
|
workMode,
|
||||||
newIssueOpen,
|
newIssueOpen,
|
||||||
queueDraftSave,
|
queueDraftSave,
|
||||||
]);
|
]);
|
||||||
@@ -696,6 +718,7 @@ export function NewIssueDialog() {
|
|||||||
|
|
||||||
const draft = loadDraft();
|
const draft = loadDraft();
|
||||||
if (newIssueDefaults.parentId) {
|
if (newIssueDefaults.parentId) {
|
||||||
|
const nextWorkMode = isIssueWorkMode(newIssueDefaults.workMode) ? newIssueDefaults.workMode : "standard";
|
||||||
const defaultProjectId = newIssueDefaults.projectId ?? "";
|
const defaultProjectId = newIssueDefaults.projectId ?? "";
|
||||||
const defaultProject = orderedProjects.find((project) => project.id === defaultProjectId);
|
const defaultProject = orderedProjects.find((project) => project.id === defaultProjectId);
|
||||||
const hasExplicitProjectWorkspaceId = newIssueDefaults.projectWorkspaceId !== undefined;
|
const hasExplicitProjectWorkspaceId = newIssueDefaults.projectWorkspaceId !== undefined;
|
||||||
@@ -713,11 +736,13 @@ export function NewIssueDialog() {
|
|||||||
setAssigneeThinkingEffort("");
|
setAssigneeThinkingEffort("");
|
||||||
setAssigneeChrome(false);
|
setAssigneeChrome(false);
|
||||||
setExecutionWorkspaceMode(defaultExecutionWorkspaceMode);
|
setExecutionWorkspaceMode(defaultExecutionWorkspaceMode);
|
||||||
|
setWorkMode(nextWorkMode);
|
||||||
setSelectedExecutionWorkspaceId(newIssueDefaults.executionWorkspaceId ?? "");
|
setSelectedExecutionWorkspaceId(newIssueDefaults.executionWorkspaceId ?? "");
|
||||||
executionWorkspaceDefaultProjectId.current = hasExplicitProjectWorkspaceId || defaultProject
|
executionWorkspaceDefaultProjectId.current = hasExplicitProjectWorkspaceId || defaultProject
|
||||||
? defaultProjectId || null
|
? defaultProjectId || null
|
||||||
: null;
|
: null;
|
||||||
} else if (newIssueDefaults.title) {
|
} else if (newIssueDefaults.title) {
|
||||||
|
const nextWorkMode = isIssueWorkMode(newIssueDefaults.workMode) ? newIssueDefaults.workMode : "standard";
|
||||||
setIssueText(newIssueDefaults.title, newIssueDefaults.description ?? "");
|
setIssueText(newIssueDefaults.title, newIssueDefaults.description ?? "");
|
||||||
setStatus(newIssueDefaults.status ?? "todo");
|
setStatus(newIssueDefaults.status ?? "todo");
|
||||||
setPriority(newIssueDefaults.priority ?? "");
|
setPriority(newIssueDefaults.priority ?? "");
|
||||||
@@ -735,11 +760,13 @@ export function NewIssueDialog() {
|
|||||||
setAssigneeThinkingEffort("");
|
setAssigneeThinkingEffort("");
|
||||||
setAssigneeChrome(false);
|
setAssigneeChrome(false);
|
||||||
setExecutionWorkspaceMode(defaultExecutionWorkspaceModeForIssueDefaults(newIssueDefaults, defaultProject));
|
setExecutionWorkspaceMode(defaultExecutionWorkspaceModeForIssueDefaults(newIssueDefaults, defaultProject));
|
||||||
|
setWorkMode(nextWorkMode);
|
||||||
setSelectedExecutionWorkspaceId(newIssueDefaults.executionWorkspaceId ?? "");
|
setSelectedExecutionWorkspaceId(newIssueDefaults.executionWorkspaceId ?? "");
|
||||||
executionWorkspaceDefaultProjectId.current = hasExplicitProjectWorkspaceId || newIssueDefaults.executionWorkspaceId || defaultProject
|
executionWorkspaceDefaultProjectId.current = hasExplicitProjectWorkspaceId || newIssueDefaults.executionWorkspaceId || defaultProject
|
||||||
? defaultProjectId || null
|
? defaultProjectId || null
|
||||||
: null;
|
: null;
|
||||||
} else if (draft && draft.title.trim()) {
|
} else if (draft && draft.title.trim()) {
|
||||||
|
const nextWorkMode = isIssueWorkMode(draft.workMode) ? draft.workMode : "standard";
|
||||||
const restoredProjectId = newIssueDefaults.projectId ?? draft.projectId;
|
const restoredProjectId = newIssueDefaults.projectId ?? draft.projectId;
|
||||||
const restoredProject = orderedProjects.find((project) => project.id === restoredProjectId);
|
const restoredProject = orderedProjects.find((project) => project.id === restoredProjectId);
|
||||||
const hasExplicitProjectWorkspaceId = newIssueDefaults.projectWorkspaceId !== undefined;
|
const hasExplicitProjectWorkspaceId = newIssueDefaults.projectWorkspaceId !== undefined;
|
||||||
@@ -775,6 +802,7 @@ export function NewIssueDialog() {
|
|||||||
?? (draft.useIsolatedExecutionWorkspace ? "isolated_workspace" : defaultExecutionWorkspaceModeForProject(restoredProject))
|
?? (draft.useIsolatedExecutionWorkspace ? "isolated_workspace" : defaultExecutionWorkspaceModeForProject(restoredProject))
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
setWorkMode(nextWorkMode);
|
||||||
setSelectedExecutionWorkspaceId(
|
setSelectedExecutionWorkspaceId(
|
||||||
hasExplicitExecutionWorkspaceId
|
hasExplicitExecutionWorkspaceId
|
||||||
? (newIssueDefaults.executionWorkspaceId ?? "")
|
? (newIssueDefaults.executionWorkspaceId ?? "")
|
||||||
@@ -784,6 +812,7 @@ export function NewIssueDialog() {
|
|||||||
? restoredProjectId || null
|
? restoredProjectId || null
|
||||||
: null;
|
: null;
|
||||||
} else {
|
} else {
|
||||||
|
setWorkMode("standard");
|
||||||
const defaultProjectId = newIssueDefaults.projectId ?? "";
|
const defaultProjectId = newIssueDefaults.projectId ?? "";
|
||||||
const defaultProject = orderedProjects.find((project) => project.id === defaultProjectId);
|
const defaultProject = orderedProjects.find((project) => project.id === defaultProjectId);
|
||||||
const hasExplicitProjectWorkspaceId = newIssueDefaults.projectWorkspaceId !== undefined;
|
const hasExplicitProjectWorkspaceId = newIssueDefaults.projectWorkspaceId !== undefined;
|
||||||
@@ -863,6 +892,7 @@ export function NewIssueDialog() {
|
|||||||
setAssigneeChrome(false);
|
setAssigneeChrome(false);
|
||||||
setExecutionWorkspaceMode("shared_workspace");
|
setExecutionWorkspaceMode("shared_workspace");
|
||||||
setSelectedExecutionWorkspaceId("");
|
setSelectedExecutionWorkspaceId("");
|
||||||
|
setWorkMode("standard");
|
||||||
setExpanded(false);
|
setExpanded(false);
|
||||||
setDialogCompanyId(null);
|
setDialogCompanyId(null);
|
||||||
setStagedFiles([]);
|
setStagedFiles([]);
|
||||||
@@ -889,6 +919,7 @@ export function NewIssueDialog() {
|
|||||||
setAssigneeChrome(false);
|
setAssigneeChrome(false);
|
||||||
setExecutionWorkspaceMode("shared_workspace");
|
setExecutionWorkspaceMode("shared_workspace");
|
||||||
setSelectedExecutionWorkspaceId("");
|
setSelectedExecutionWorkspaceId("");
|
||||||
|
setWorkMode("standard");
|
||||||
}
|
}
|
||||||
|
|
||||||
function discardDraft() {
|
function discardDraft() {
|
||||||
@@ -939,6 +970,7 @@ export function NewIssueDialog() {
|
|||||||
description: currentDescription || undefined,
|
description: currentDescription || undefined,
|
||||||
status,
|
status,
|
||||||
priority: priority || "medium",
|
priority: priority || "medium",
|
||||||
|
workMode,
|
||||||
...(selectedAssigneeAgentId ? { assigneeAgentId: selectedAssigneeAgentId } : {}),
|
...(selectedAssigneeAgentId ? { assigneeAgentId: selectedAssigneeAgentId } : {}),
|
||||||
...(selectedAssigneeUserId ? { assigneeUserId: selectedAssigneeUserId } : {}),
|
...(selectedAssigneeUserId ? { assigneeUserId: selectedAssigneeUserId } : {}),
|
||||||
...(newIssueDefaults.parentId ? { parentId: newIssueDefaults.parentId } : {}),
|
...(newIssueDefaults.parentId ? { parentId: newIssueDefaults.parentId } : {}),
|
||||||
@@ -1146,6 +1178,8 @@ export function NewIssueDialog() {
|
|||||||
},
|
},
|
||||||
[assigneeAdapterModels],
|
[assigneeAdapterModels],
|
||||||
);
|
);
|
||||||
|
const currentWorkMode = ISSUE_WORK_MODE_OPTIONS[workMode === "planning" ? 1 : 0]!;
|
||||||
|
const CurrentWorkModeIcon = currentWorkMode.icon;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
@@ -1868,6 +1902,48 @@ export function NewIssueDialog() {
|
|||||||
Upload
|
Upload
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
{/* Work mode chip */}
|
||||||
|
<Popover open={workModeOpen} onOpenChange={setWorkModeOpen}>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
data-issue-work-mode-chip={workMode}
|
||||||
|
className={cn(
|
||||||
|
"inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-xs transition-colors",
|
||||||
|
workMode === "planning"
|
||||||
|
? "border-amber-500/60 bg-amber-500/15 text-amber-800 hover:bg-amber-500/25 dark:border-amber-500/50 dark:bg-amber-500/15 dark:text-amber-200 dark:hover:bg-amber-500/25"
|
||||||
|
: "border-border text-muted-foreground hover:bg-accent/50",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<CurrentWorkModeIcon className="h-3 w-3" />
|
||||||
|
{currentWorkMode.label}
|
||||||
|
</button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-36 p-1" align="start">
|
||||||
|
{ISSUE_WORK_MODE_OPTIONS.map((option) => {
|
||||||
|
const Icon = option.icon;
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
key={option.value}
|
||||||
|
data-issue-work-mode={option.value}
|
||||||
|
className={cn(
|
||||||
|
"flex w-full items-center gap-2 rounded px-2 py-1.5 text-xs hover:bg-accent/50",
|
||||||
|
option.value === workMode && "bg-accent",
|
||||||
|
option.value === "planning" && "text-amber-700 dark:text-amber-300",
|
||||||
|
)}
|
||||||
|
onClick={() => {
|
||||||
|
setWorkMode(option.value);
|
||||||
|
setWorkModeOpen(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon className="h-3 w-3" />
|
||||||
|
{option.label}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
|
||||||
{/* More (dates) */}
|
{/* More (dates) */}
|
||||||
<Popover open={moreOpen} onOpenChange={setMoreOpen}>
|
<Popover open={moreOpen} onOpenChange={setMoreOpen}>
|
||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { createContext, useCallback, useContext, useMemo, useState, type ReactNode } from "react";
|
import { createContext, useCallback, useContext, useMemo, useState, type ReactNode } from "react";
|
||||||
|
import type { IssueWorkMode } from "@paperclipai/shared";
|
||||||
|
|
||||||
interface NewIssueDefaults {
|
interface NewIssueDefaults {
|
||||||
status?: string;
|
status?: string;
|
||||||
|
workMode?: IssueWorkMode;
|
||||||
priority?: string;
|
priority?: string;
|
||||||
projectId?: string;
|
projectId?: string;
|
||||||
projectWorkspaceId?: string;
|
projectWorkspaceId?: string;
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ function makeIssue(id: string, isUnreadForMe: boolean): Issue {
|
|||||||
title: `Issue ${id}`,
|
title: `Issue ${id}`,
|
||||||
description: null,
|
description: null,
|
||||||
status: "todo",
|
status: "todo",
|
||||||
|
workMode: "standard",
|
||||||
priority: "medium",
|
priority: "medium",
|
||||||
assigneeAgentId: null,
|
assigneeAgentId: null,
|
||||||
assigneeUserId: null,
|
assigneeUserId: null,
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ function makeIssue(overrides: Partial<Issue> = {}): Issue {
|
|||||||
createdAt: new Date("2026-04-15T00:00:00.000Z"),
|
createdAt: new Date("2026-04-15T00:00:00.000Z"),
|
||||||
updatedAt: new Date("2026-04-15T00:00:00.000Z"),
|
updatedAt: new Date("2026-04-15T00:00:00.000Z"),
|
||||||
...overrides,
|
...overrides,
|
||||||
|
workMode: overrides.workMode ?? "standard",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ function makeIssue(id: string, parentId: string | null = null): Issue {
|
|||||||
title: `Issue ${id}`,
|
title: `Issue ${id}`,
|
||||||
description: null,
|
description: null,
|
||||||
status: "todo",
|
status: "todo",
|
||||||
|
workMode: "standard",
|
||||||
priority: "medium",
|
priority: "medium",
|
||||||
assigneeAgentId: null,
|
assigneeAgentId: null,
|
||||||
assigneeUserId: null,
|
assigneeUserId: null,
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ describe("issueDetailBreadcrumb", () => {
|
|||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
...overrides,
|
...overrides,
|
||||||
|
workMode: overrides.workMode ?? "standard",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ function createIssue(overrides: Partial<Issue> = {}): Issue {
|
|||||||
lastExternalCommentAt: null,
|
lastExternalCommentAt: null,
|
||||||
isUnreadForMe: false,
|
isUnreadForMe: false,
|
||||||
...overrides,
|
...overrides,
|
||||||
|
workMode: overrides.workMode ?? "standard",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ function makeIssue(overrides: Partial<Issue> = {}): Issue {
|
|||||||
createdAt: now,
|
createdAt: now,
|
||||||
updatedAt: now,
|
updatedAt: now,
|
||||||
...overrides,
|
...overrides,
|
||||||
|
workMode: overrides.workMode ?? "standard",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -446,6 +446,7 @@ describe("optimistic issue comments", () => {
|
|||||||
title: "Fix comment flow",
|
title: "Fix comment flow",
|
||||||
description: null,
|
description: null,
|
||||||
status: "done",
|
status: "done",
|
||||||
|
workMode: "standard",
|
||||||
priority: "medium",
|
priority: "medium",
|
||||||
assigneeAgentId: "agent-1",
|
assigneeAgentId: "agent-1",
|
||||||
assigneeUserId: null,
|
assigneeUserId: null,
|
||||||
@@ -515,6 +516,7 @@ describe("optimistic issue comments", () => {
|
|||||||
title: "Fix property pane",
|
title: "Fix property pane",
|
||||||
description: null,
|
description: null,
|
||||||
status: "todo",
|
status: "todo",
|
||||||
|
workMode: "standard",
|
||||||
priority: "medium",
|
priority: "medium",
|
||||||
assigneeAgentId: "agent-1",
|
assigneeAgentId: "agent-1",
|
||||||
assigneeUserId: null,
|
assigneeUserId: null,
|
||||||
@@ -687,6 +689,7 @@ describe("optimistic issue comments", () => {
|
|||||||
title: "Fix property pane",
|
title: "Fix property pane",
|
||||||
description: null,
|
description: null,
|
||||||
status: "todo",
|
status: "todo",
|
||||||
|
workMode: "standard",
|
||||||
priority: "medium",
|
priority: "medium",
|
||||||
assigneeAgentId: "agent-1",
|
assigneeAgentId: "agent-1",
|
||||||
assigneeUserId: null,
|
assigneeUserId: null,
|
||||||
@@ -728,6 +731,7 @@ describe("optimistic issue comments", () => {
|
|||||||
title: "Leave me alone",
|
title: "Leave me alone",
|
||||||
description: null,
|
description: null,
|
||||||
status: "todo",
|
status: "todo",
|
||||||
|
workMode: "standard",
|
||||||
priority: "medium",
|
priority: "medium",
|
||||||
assigneeAgentId: "agent-2",
|
assigneeAgentId: "agent-2",
|
||||||
assigneeUserId: null,
|
assigneeUserId: null,
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ function makeIssue(overrides: Partial<Issue> = {}): Issue {
|
|||||||
createdAt: new Date("2026-04-07T00:00:00.000Z"),
|
createdAt: new Date("2026-04-07T00:00:00.000Z"),
|
||||||
updatedAt: new Date("2026-04-07T00:00:00.000Z"),
|
updatedAt: new Date("2026-04-07T00:00:00.000Z"),
|
||||||
...overrides,
|
...overrides,
|
||||||
|
workMode: overrides.workMode ?? "standard",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ function createIssue(overrides: Partial<Issue> = {}): Issue {
|
|||||||
lastActivityAt: new Date("2026-03-11T00:00:00.000Z"),
|
lastActivityAt: new Date("2026-03-11T00:00:00.000Z"),
|
||||||
isUnreadForMe: false,
|
isUnreadForMe: false,
|
||||||
...overrides,
|
...overrides,
|
||||||
|
workMode: overrides.workMode ?? "standard",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -192,6 +192,8 @@ vi.mock("../components/InlineEditor", () => ({
|
|||||||
|
|
||||||
vi.mock("../components/IssueChatThread", () => ({
|
vi.mock("../components/IssueChatThread", () => ({
|
||||||
IssueChatThread: (props: {
|
IssueChatThread: (props: {
|
||||||
|
onWorkModeChange?: (workMode: string) => void;
|
||||||
|
issueWorkMode?: string;
|
||||||
onStopRun?: (runId: string) => Promise<void>;
|
onStopRun?: (runId: string) => Promise<void>;
|
||||||
stopRunLabel?: string;
|
stopRunLabel?: string;
|
||||||
stoppingRunLabel?: string;
|
stoppingRunLabel?: string;
|
||||||
@@ -1099,6 +1101,7 @@ describe("IssueDetail", () => {
|
|||||||
expect(mockIssueChatThreadRender.mock.calls.at(-1)?.[0]).toMatchObject({
|
expect(mockIssueChatThreadRender.mock.calls.at(-1)?.[0]).toMatchObject({
|
||||||
stopRunLabel: "Pause work",
|
stopRunLabel: "Pause work",
|
||||||
stoppingRunLabel: "Pausing...",
|
stoppingRunLabel: "Pausing...",
|
||||||
|
issueWorkMode: "standard",
|
||||||
});
|
});
|
||||||
|
|
||||||
const chatPauseButton = Array.from(container.querySelectorAll("button"))
|
const chatPauseButton = Array.from(container.querySelectorAll("button"))
|
||||||
@@ -1129,6 +1132,67 @@ describe("IssueDetail", () => {
|
|||||||
expect(pauseMenuButton).toBeTruthy();
|
expect(pauseMenuButton).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("passes planning work mode to the issue chat thread", async () => {
|
||||||
|
mockIssuesApi.get.mockResolvedValue(createIssue({ workMode: "planning" }));
|
||||||
|
await act(async () => {
|
||||||
|
root.render(
|
||||||
|
<QueryClientProvider client={queryClient}>
|
||||||
|
<IssueDetail />
|
||||||
|
</QueryClientProvider>,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
await flushReact();
|
||||||
|
|
||||||
|
expect(mockIssueChatThreadRender.mock.calls.at(-1)?.[0]).toMatchObject({
|
||||||
|
issueWorkMode: "planning",
|
||||||
|
});
|
||||||
|
expect(container.textContent).toContain("Planning");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("forwards composer work mode changes to the issues API", async () => {
|
||||||
|
const issue = createIssue();
|
||||||
|
mockIssuesApi.get.mockResolvedValue(issue);
|
||||||
|
mockIssuesApi.listAttachments.mockResolvedValue([
|
||||||
|
{
|
||||||
|
id: "attachment-1",
|
||||||
|
issueId: issue.id,
|
||||||
|
issueCommentId: null,
|
||||||
|
originalFilename: "planning-notes.txt",
|
||||||
|
contentPath: "/attachments/planning-notes.txt",
|
||||||
|
contentType: "text/plain",
|
||||||
|
byteSize: 4096,
|
||||||
|
uploadedByUserId: null,
|
||||||
|
uploadedAt: new Date("2026-04-21T00:02:00.000Z"),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
localStorage.setItem("paperclip:issue-comment-draft:issue-1", "Draft follow-up message");
|
||||||
|
mockIssuesApi.update.mockResolvedValue(createIssue({ workMode: "planning" }));
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
root.render(
|
||||||
|
<QueryClientProvider client={queryClient}>
|
||||||
|
<IssueDetail />
|
||||||
|
</QueryClientProvider>,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
await flushReact();
|
||||||
|
await flushReact();
|
||||||
|
|
||||||
|
const lastChatThreadProps = mockIssueChatThreadRender.mock.calls.at(-1)?.[0];
|
||||||
|
expect(lastChatThreadProps?.issueWorkMode).toBe("standard");
|
||||||
|
expect(typeof lastChatThreadProps?.onWorkModeChange).toBe("function");
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
lastChatThreadProps?.onWorkModeChange?.("planning");
|
||||||
|
});
|
||||||
|
await flushReact();
|
||||||
|
|
||||||
|
expect(mockIssuesApi.update).toHaveBeenCalledWith(issue.identifier, { workMode: "planning" });
|
||||||
|
expect(localStorage.getItem("paperclip:issue-comment-draft:issue-1")).toBe("Draft follow-up message");
|
||||||
|
expect(container.textContent).toContain("planning-notes.txt");
|
||||||
|
localStorage.removeItem("paperclip:issue-comment-draft:issue-1");
|
||||||
|
});
|
||||||
|
|
||||||
it("renders Paused by board distinctly and defaults leaf resume to wake the assignee", async () => {
|
it("renders Paused by board distinctly and defaults leaf resume to wake the assignee", async () => {
|
||||||
const activeHold = createPauseHold();
|
const activeHold = createPauseHold();
|
||||||
const releasedHold = createPauseHold({
|
const releasedHold = createPauseHold({
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ import {
|
|||||||
type Issue,
|
type Issue,
|
||||||
type IssueAttachment,
|
type IssueAttachment,
|
||||||
type IssueComment,
|
type IssueComment,
|
||||||
|
type IssueWorkMode,
|
||||||
type IssueThreadInteraction,
|
type IssueThreadInteraction,
|
||||||
type RequestConfirmationInteraction,
|
type RequestConfirmationInteraction,
|
||||||
type SuggestTasksInteraction,
|
type SuggestTasksInteraction,
|
||||||
@@ -186,7 +187,6 @@ const LEAF_WORK_CONTROL_MODE_HELP_TEXT: Partial<Record<IssueTreeControlMode, str
|
|||||||
pause: "Pause active execution on this issue until an explicit resume.",
|
pause: "Pause active execution on this issue until an explicit resume.",
|
||||||
resume: "Release the active pause hold so this issue can continue.",
|
resume: "Release the active pause hold so this issue can continue.",
|
||||||
};
|
};
|
||||||
|
|
||||||
function issueTreeControlLabel(mode: IssueTreeControlMode, scope: "leaf" | "subtree") {
|
function issueTreeControlLabel(mode: IssueTreeControlMode, scope: "leaf" | "subtree") {
|
||||||
return scope === "leaf"
|
return scope === "leaf"
|
||||||
? LEAF_WORK_CONTROL_MODE_LABEL[mode] ?? TREE_CONTROL_MODE_LABEL[mode]
|
? LEAF_WORK_CONTROL_MODE_LABEL[mode] ?? TREE_CONTROL_MODE_LABEL[mode]
|
||||||
@@ -581,6 +581,7 @@ type IssueDetailChatTabProps = {
|
|||||||
companyId: string;
|
companyId: string;
|
||||||
projectId: string | null;
|
projectId: string | null;
|
||||||
issueStatus: Issue["status"];
|
issueStatus: Issue["status"];
|
||||||
|
issueWorkMode: IssueWorkMode;
|
||||||
executionRunId: string | null;
|
executionRunId: string | null;
|
||||||
blockedBy: Issue["blockedBy"];
|
blockedBy: Issue["blockedBy"];
|
||||||
blockerAttention: Issue["blockerAttention"] | null;
|
blockerAttention: Issue["blockerAttention"] | null;
|
||||||
@@ -592,6 +593,7 @@ type IssueDetailChatTabProps = {
|
|||||||
commentsLoadingOlder: boolean;
|
commentsLoadingOlder: boolean;
|
||||||
onLoadOlderComments: () => void;
|
onLoadOlderComments: () => void;
|
||||||
onRefreshLatestComments: () => Promise<unknown> | void;
|
onRefreshLatestComments: () => Promise<unknown> | void;
|
||||||
|
onWorkModeChange?: (workMode: IssueWorkMode) => Promise<void> | void;
|
||||||
composerRef: Ref<IssueChatComposerHandle>;
|
composerRef: Ref<IssueChatComposerHandle>;
|
||||||
feedbackVotes?: FeedbackVote[];
|
feedbackVotes?: FeedbackVote[];
|
||||||
feedbackDataSharingPreference: "allowed" | "not_allowed" | "prompt";
|
feedbackDataSharingPreference: "allowed" | "not_allowed" | "prompt";
|
||||||
@@ -638,6 +640,7 @@ const IssueDetailChatTab = memo(function IssueDetailChatTab({
|
|||||||
issueId,
|
issueId,
|
||||||
companyId,
|
companyId,
|
||||||
projectId,
|
projectId,
|
||||||
|
issueWorkMode,
|
||||||
issueStatus,
|
issueStatus,
|
||||||
executionRunId,
|
executionRunId,
|
||||||
blockedBy,
|
blockedBy,
|
||||||
@@ -650,6 +653,7 @@ const IssueDetailChatTab = memo(function IssueDetailChatTab({
|
|||||||
commentsLoadingOlder,
|
commentsLoadingOlder,
|
||||||
onLoadOlderComments,
|
onLoadOlderComments,
|
||||||
onRefreshLatestComments,
|
onRefreshLatestComments,
|
||||||
|
onWorkModeChange,
|
||||||
composerRef,
|
composerRef,
|
||||||
feedbackVotes,
|
feedbackVotes,
|
||||||
feedbackDataSharingPreference,
|
feedbackDataSharingPreference,
|
||||||
@@ -878,6 +882,8 @@ const IssueDetailChatTab = memo(function IssueDetailChatTab({
|
|||||||
onSubmitInteractionAnswers(interaction, answers)
|
onSubmitInteractionAnswers(interaction, answers)
|
||||||
}
|
}
|
||||||
onCancelInteraction={onCancelInteraction}
|
onCancelInteraction={onCancelInteraction}
|
||||||
|
issueWorkMode={issueWorkMode}
|
||||||
|
onWorkModeChange={onWorkModeChange}
|
||||||
onCancelRun={runningIssueRun && onPauseWorkRun
|
onCancelRun={runningIssueRun && onPauseWorkRun
|
||||||
? async () => {
|
? async () => {
|
||||||
await onPauseWorkRun(runningIssueRun.id);
|
await onPauseWorkRun(runningIssueRun.id);
|
||||||
@@ -3190,6 +3196,15 @@ export function IssueDetail() {
|
|||||||
</span>
|
</span>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
|
{issue.workMode === "planning" ? (
|
||||||
|
<span
|
||||||
|
className="inline-flex items-center rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-[10px] font-medium text-amber-700 dark:text-amber-300 shrink-0"
|
||||||
|
title="This issue is in planning mode."
|
||||||
|
>
|
||||||
|
Planning
|
||||||
|
</span>
|
||||||
|
) : null}
|
||||||
|
|
||||||
{issue.projectId ? (
|
{issue.projectId ? (
|
||||||
<Link
|
<Link
|
||||||
to={`/projects/${issue.projectId}`}
|
to={`/projects/${issue.projectId}`}
|
||||||
@@ -3706,6 +3721,7 @@ export function IssueDetail() {
|
|||||||
companyId={issue.companyId}
|
companyId={issue.companyId}
|
||||||
projectId={issue.projectId ?? null}
|
projectId={issue.projectId ?? null}
|
||||||
issueStatus={issue.status}
|
issueStatus={issue.status}
|
||||||
|
issueWorkMode={issue.workMode ?? "standard"}
|
||||||
executionRunId={issue.executionRunId ?? null}
|
executionRunId={issue.executionRunId ?? null}
|
||||||
blockedBy={issue.blockedBy ?? []}
|
blockedBy={issue.blockedBy ?? []}
|
||||||
blockerAttention={issue.blockerAttention ?? null}
|
blockerAttention={issue.blockerAttention ?? null}
|
||||||
@@ -3741,6 +3757,11 @@ export function IssueDetail() {
|
|||||||
onPauseWorkRun={canManageTreeControl
|
onPauseWorkRun={canManageTreeControl
|
||||||
? (runId) => pauseIssueWorkRun.mutateAsync({ runId, scope: treeControlScope }).then(() => undefined)
|
? (runId) => pauseIssueWorkRun.mutateAsync({ runId, scope: treeControlScope }).then(() => undefined)
|
||||||
: undefined}
|
: undefined}
|
||||||
|
onWorkModeChange={(nextMode) => {
|
||||||
|
const currentMode: IssueWorkMode = issue.workMode ?? "standard";
|
||||||
|
if (currentMode === nextMode) return;
|
||||||
|
return updateIssue.mutateAsync({ workMode: nextMode }).then(() => undefined);
|
||||||
|
}}
|
||||||
onCancelQueued={handleCancelQueuedComment}
|
onCancelQueued={handleCancelQueuedComment}
|
||||||
interruptingQueuedRunId={interruptQueuedComment.isPending ? interruptQueuedComment.variables ?? null : null}
|
interruptingQueuedRunId={interruptQueuedComment.isPending ? interruptQueuedComment.variables ?? null : null}
|
||||||
pausingWorkRunId={pauseIssueWorkRun.isPending ? pauseIssueWorkRun.variables?.runId ?? null : null}
|
pausingWorkRunId={pauseIssueWorkRun.isPending ? pauseIssueWorkRun.variables?.runId ?? null : null}
|
||||||
|
|||||||
@@ -308,6 +308,7 @@ function createIssue(overrides: Partial<Issue> = {}): Issue {
|
|||||||
lastActivityAt: new Date("2026-04-01T00:00:00.000Z"),
|
lastActivityAt: new Date("2026-04-01T00:00:00.000Z"),
|
||||||
isUnreadForMe: false,
|
isUnreadForMe: false,
|
||||||
...overrides,
|
...overrides,
|
||||||
|
workMode: overrides.workMode ?? "standard",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -742,6 +742,7 @@ export function createIssue(overrides: Partial<Issue> = {}): Issue {
|
|||||||
createdAt: recent(90),
|
createdAt: recent(90),
|
||||||
updatedAt: recent(3),
|
updatedAt: recent(3),
|
||||||
...overrides,
|
...overrides,
|
||||||
|
workMode: overrides.workMode ?? "standard",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -675,6 +675,26 @@ function IssueChatMatrix() {
|
|||||||
composerDisabledReason="This issue is in review. Request changes or approve it from the review controls."
|
composerDisabledReason="This issue is in review. Request changes or approve it from the review controls."
|
||||||
/>
|
/>
|
||||||
</ScenarioCard>
|
</ScenarioCard>
|
||||||
|
<ScenarioCard
|
||||||
|
title="Planning mode composer"
|
||||||
|
description="Issue is in planning mode. The composer turns amber and surfaces a Planning chip next to the paperclip — clicking it stages a Standard submission without immediately changing the issue mode."
|
||||||
|
>
|
||||||
|
<IssueChatThread
|
||||||
|
comments={[]}
|
||||||
|
timelineEvents={[]}
|
||||||
|
linkedRuns={[]}
|
||||||
|
liveRuns={[]}
|
||||||
|
companyId={companyId}
|
||||||
|
projectId={projectId}
|
||||||
|
agentMap={storybookAgentMap}
|
||||||
|
currentUserId={currentUserId}
|
||||||
|
issueWorkMode="planning"
|
||||||
|
onWorkModeChange={() => undefined}
|
||||||
|
onAdd={async () => {}}
|
||||||
|
enableLiveTranscriptPolling={false}
|
||||||
|
emptyMessage="Planning mode reply box example."
|
||||||
|
/>
|
||||||
|
</ScenarioCard>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Section>
|
</Section>
|
||||||
|
|||||||
Reference in New Issue
Block a user