@dendelion/paper-camp 0.18.1 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/app/assets/index-B6251tL6.js +2 -0
  2. package/dist/app/assets/{index-Bm61MVP8.js.map → index-B6251tL6.js.map} +1 -1
  3. package/dist/app/assets/{index-NfzGv6aM.js → index-BNoowtMI.js} +2 -2
  4. package/dist/app/assets/{index-NfzGv6aM.js.map → index-BNoowtMI.js.map} +1 -1
  5. package/dist/app/assets/index-D2iIIpI1.js +4 -0
  6. package/dist/app/assets/{index-0_VbynEu.js.map → index-D2iIIpI1.js.map} +1 -1
  7. package/dist/app/assets/index-D5j1njQR.js +2 -0
  8. package/dist/app/assets/index-D5j1njQR.js.map +1 -0
  9. package/dist/app/assets/index-DLkUANCR.js +2 -0
  10. package/dist/app/assets/index-DLkUANCR.js.map +1 -0
  11. package/dist/app/assets/{index-Dz77-ZQi.js → index-nuVVSVma.js} +3 -3
  12. package/dist/app/assets/index-nuVVSVma.js.map +1 -0
  13. package/dist/app/assets/index-s6CVH54G.js +6 -0
  14. package/dist/app/assets/index-s6CVH54G.js.map +1 -0
  15. package/dist/app/assets/main--EStESJz.js +217 -0
  16. package/dist/app/assets/main--EStESJz.js.map +1 -0
  17. package/dist/app/assets/main-CAJuC1Pz.css +1 -0
  18. package/dist/app/assets/{sidebar-section-AupYBPL3.js → sidebar-section-DTU8Naqm.js} +2 -2
  19. package/dist/app/assets/{sidebar-section-AupYBPL3.js.map → sidebar-section-DTU8Naqm.js.map} +1 -1
  20. package/dist/app/index.html +2 -2
  21. package/dist/app/toolbar.js +3712 -3645
  22. package/dist/app/toolbar.js.map +1 -1
  23. package/dist/chunks/{phase-progress.BIIDRJmI.js → phase-progress.CwSKAAZ-.js} +1364 -1254
  24. package/dist/chunks/phase-progress.CwSKAAZ-.js.map +1 -0
  25. package/dist/cli/index.js +7968 -7466
  26. package/dist/cli/index.js.map +1 -1
  27. package/dist/core/git-pr/pr-lookup.d.ts +33 -1
  28. package/dist/core/git-pr/pr-lookup.d.ts.map +1 -1
  29. package/dist/core/git-pr/pr.d.ts +5 -1
  30. package/dist/core/git-pr/pr.d.ts.map +1 -1
  31. package/dist/core/index.js +107 -101
  32. package/dist/core/parse/schemas.d.ts +8 -0
  33. package/dist/core/parse/schemas.d.ts.map +1 -1
  34. package/dist/core/readers.d.ts +1 -1
  35. package/dist/core/readers.d.ts.map +1 -1
  36. package/dist/types/index.d.ts +53 -2
  37. package/dist/types/index.d.ts.map +1 -1
  38. package/dist/types/index.js +23 -17
  39. package/dist/types/index.js.map +1 -1
  40. package/package.json +1 -1
  41. package/dist/app/assets/index-0_VbynEu.js +0 -4
  42. package/dist/app/assets/index-Bm61MVP8.js +0 -2
  43. package/dist/app/assets/index-CHYyIAaz.js +0 -6
  44. package/dist/app/assets/index-CHYyIAaz.js.map +0 -1
  45. package/dist/app/assets/index-DNRXB82k.js +0 -2
  46. package/dist/app/assets/index-DNRXB82k.js.map +0 -1
  47. package/dist/app/assets/index-Dz77-ZQi.js.map +0 -1
  48. package/dist/app/assets/index-pnCSf_Qk.js +0 -2
  49. package/dist/app/assets/index-pnCSf_Qk.js.map +0 -1
  50. package/dist/app/assets/main-AfQrNPNu.js +0 -217
  51. package/dist/app/assets/main-AfQrNPNu.js.map +0 -1
  52. package/dist/app/assets/main-BuCfycKH.css +0 -1
  53. package/dist/app/assets/tokens-C3C44lLs.js +0 -2
  54. package/dist/app/assets/tokens-C3C44lLs.js.map +0 -1
  55. package/dist/chunks/phase-progress.BIIDRJmI.js.map +0 -1
@@ -5,10 +5,10 @@ const c = [
5
5
  "review",
6
6
  "done",
7
7
  "dropped"
8
- ], a = ["feat", "fix", "chore", "docs", "refactor"], d = ["claude-code", "opencode"], s = {
8
+ ], a = ["feat", "fix", "chore", "docs", "refactor"], d = ["claude-code", "opencode"], f = {
9
9
  "claude-code": "Claude Code",
10
10
  opencode: "OpenCode"
11
- }, f = {
11
+ }, l = {
12
12
  "claude-code": {
13
13
  model: ["opus", "sonnet", "fable", "haiku"],
14
14
  effort: ["low", "medium", "high", "xhigh", "max"]
@@ -17,31 +17,37 @@ const c = [
17
17
  model: null
18
18
  }
19
19
  };
20
- function l(o) {
21
- const n = (t) => d.includes(t) ? t : "claude-code";
22
- if (typeof o == "string") return { agent: n(o) };
23
- const e = o ?? {};
20
+ function s(e) {
21
+ const o = (t) => d.includes(t) ? t : "claude-code";
22
+ if (typeof e == "string") return { agent: o(e) };
23
+ const n = e ?? {};
24
24
  return {
25
- agent: n(e.agent),
26
- ...typeof e.model == "string" && { model: e.model },
27
- ...typeof e.effort == "string" && { effort: e.effort }
25
+ agent: o(n.agent),
26
+ ...typeof n.model == "string" && { model: n.model },
27
+ ...typeof n.effort == "string" && { effort: n.effort }
28
28
  };
29
29
  }
30
- const r = {
30
+ const u = {
31
31
  phase: { agent: "opencode" },
32
32
  planDraft: { agent: "claude-code" },
33
33
  ideaExtend: { agent: "claude-code" },
34
34
  commitSuggest: { agent: "claude-code" },
35
- feedback: { agent: "claude-code", model: "sonnet", effort: "medium" }
36
- }, u = ["focus", "scout", "desk"];
35
+ feedback: { agent: "claude-code", model: "sonnet", effort: "medium" },
36
+ codeReview: { agent: "claude-code", model: "opus", effort: "high" }
37
+ };
38
+ function g(e, o) {
39
+ return e.agent === o.agent && (e.model ?? "") === (o.model ?? "");
40
+ }
41
+ const r = ["focus", "scout", "desk"];
37
42
  export {
38
43
  d as AGENT_IDS,
39
- s as AGENT_LABELS,
40
- f as AGENT_OPTIONS,
41
- r as DEFAULT_AGENTS,
44
+ f as AGENT_LABELS,
45
+ l as AGENT_OPTIONS,
46
+ u as DEFAULT_AGENTS,
42
47
  a as PLAN_KINDS,
43
48
  c as PLAN_STATUSES,
44
- u as TOOLBAR_SEGMENT_IDS,
45
- l as coerceAgentConfig
49
+ r as TOOLBAR_SEGMENT_IDS,
50
+ g as agentConfigsEqual,
51
+ s as coerceAgentConfig
46
52
  };
47
53
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/types/index.ts"],"sourcesContent":["export type PlanStatus = 'idea' | 'planned' | 'in-progress' | 'review' | 'done' | 'dropped';\n\nexport const PLAN_STATUSES: PlanStatus[] = [\n 'idea',\n 'planned',\n 'in-progress',\n 'review',\n 'done',\n 'dropped',\n];\n\nexport interface LogEntry {\n date: string;\n text: string;\n}\n\nexport type PlanKind = 'feat' | 'fix' | 'chore' | 'docs' | 'refactor';\n\nexport const PLAN_KINDS: PlanKind[] = ['feat', 'fix', 'chore', 'docs', 'refactor'];\n\nexport const AGENT_IDS = ['claude-code', 'opencode'] as const;\n\nexport type AgentId = (typeof AGENT_IDS)[number];\n\nexport const AGENT_LABELS: Record<AgentId, string> = {\n 'claude-code': 'Claude Code',\n opencode: 'OpenCode',\n};\n\nexport interface PhaseRun {\n durationMs: number;\n inputTokens: number;\n outputTokens: number;\n model?: string;\n attempts: number;\n}\n\nexport interface PhaseItem {\n done: boolean;\n text: string;\n description?: string;\n source?: 'review';\n run?: PhaseRun;\n}\n\nexport type PhaseMilestone = 'implement' | 'verify' | 'checkbox';\n\n/** A body section anchor is `body` for now — the whole prose block is the only\n * body section a plan/entity has until later phases break it into sub-sections. */\nexport type MarginNoteAnchor = { kind: 'phase'; index: number } | { kind: 'body' };\n\nexport type MarginNoteState = 'open' | 'resolved';\n\nexport type MarginNoteKind = 'note' | 'decision' | 'question';\n\nexport interface MarginNote {\n anchor: MarginNoteAnchor;\n prose: string;\n state: MarginNoteState;\n kind?: MarginNoteKind;\n}\n\n/** What a thread message originally was, before log/review/notes/clarifications folded\n * into one ordered thread on the entity — 'note'/'decision'/'question' carry `state`,\n * the rest are plain historical records. 'chat' is thread-native (no legacy section):\n * Paper Scout conversation, collapsed by default in thread views. */\nexport type ThreadMessageKind =\n | 'log'\n | 'clarification'\n | 'review'\n | 'note'\n | 'decision'\n | 'question'\n | 'chat';\n\nexport interface ThreadMessage {\n kind: ThreadMessageKind;\n /** Absent for messages ported from the old Notes section, which never carried a date. */\n date?: string;\n text: string;\n /** Only meaningful for note/decision/question kinds. */\n state?: MarginNoteState;\n /** Absent means 'user' — no thread message predates this field being agent-authored. */\n from?: 'user' | 'agent';\n}\n\n/** Ambient context a chat mount (desk, toolbar) feeds alongside a message — each\n * mount populates whatever it has (IDEA-130); Scout folds it into the prompt\n * silently, it never becomes a user-visible field. */\nexport interface MountContext {\n route?: string;\n focusedIdeaId?: string;\n viewport?: { width: number; height: number };\n}\n\nexport interface RawEntry {\n title: string;\n fields: Record<string, string>;\n body: string;\n phases: PhaseItem[];\n log?: LogEntry[];\n clarifications?: LogEntry[];\n notes?: MarginNote[];\n review?: LogEntry[];\n}\n\nexport interface ParseWarning {\n title: string;\n message: string;\n}\n\nexport interface ParseResult<T> {\n entries: T[];\n warnings: ParseWarning[];\n}\n\n/** A PR's reviewable/mergeable state, as surfaced by `gh pr list`. */\nexport type PrState = 'draft' | 'open' | 'closed' | 'merged';\n\n/** GitHub's PR review decision, as surfaced by `gh pr list --json reviewDecision`. */\nexport type ReviewDecision = 'approved' | 'changes-requested' | 'review-required';\n\n// Per-comment detail; PrInfo.unresolvedThreadCount only counts these.\nexport interface ReviewThread {\n /** GraphQL node id — what `resolveReviewThread`/`replyToReviewThread` address. */\n id: string;\n /** File path the comment is anchored to; absent for a PR-level (not diff-anchored) comment. */\n path?: string;\n line?: number;\n author?: string;\n body: string;\n}\n\n// Parsed from the JSON object a fix-review agent's prompt requires as its final line.\nexport interface FixReviewResult {\n commit: { title: string; message: string };\n addressed: string[];\n skipped: { threadId: string; why: string }[];\n}\n\nexport interface FeedbackPhaseEdit {\n op: 'add' | 'reword';\n /** 1-based position in the plan's current phase list; required for \"reword\", ignored for \"add\". */\n index?: number;\n text: string;\n description?: string;\n}\n\nexport interface FeedbackEdit {\n phases?: FeedbackPhaseEdit[];\n /** The complete replacement body, when the message corrects body prose. */\n body?: string;\n}\n\n// Parsed from the JSON object a feedback-reply agent's prompt requires as its\n// final line. The chat never creates ideas — a request is either a reply or an\n// edit on the current plan.\nexport interface FeedbackReplyResult {\n reply: string;\n edit?: FeedbackEdit;\n /** True when the user's message answers an open question the agent asked\n * earlier in this thread — the route persists that message as a clarification. */\n answersQuestion?: boolean;\n}\n\n/** Live-resolved PR info for an entity's branch — see `core/pr.ts`. */\nexport interface PrInfo {\n number: number;\n url: string;\n state: PrState;\n /** Undefined when no review has been requested/decided, or when unresolved (offline, closed/merged PR). */\n reviewDecision?: ReviewDecision;\n /** Count of unresolved review threads. Only fetched for open/draft PRs; undefined when not fetched or unresolved. */\n unresolvedThreadCount?: number;\n /** Whether a comment or review landed after the PR's last commit — a proxy for \"since the last agent pass\" (a pass ends with a push). Only fetched for open/draft PRs. */\n hasNewCommentsSincePush?: boolean;\n}\n\nexport interface PlanEntry {\n title: string;\n status: PlanStatus;\n kind?: PlanKind;\n id?: string;\n idea?: string;\n agent?: AgentId;\n created: string;\n updated?: string;\n audited?: string;\n auditedHash?: string;\n /** Version tag (e.g. v0.13.1) that first shipped this idea, stamped from the release train. */\n released?: string;\n tags: string[];\n /** Absent renders under the virtual \"No subject\" group. */\n subject?: string;\n /** Absent means unordered — sorts after all ordered entries, by created date. */\n order?: number;\n body: string;\n phases: PhaseItem[];\n /** Post-build findings, same checkbox grammar as `phases` — see EntityEntry.fixes. */\n fixes?: PhaseItem[];\n log?: LogEntry[];\n clarifications?: LogEntry[];\n notes?: MarginNote[];\n /** Prose written against the whole finished plan, distinct from the flat `log` — an\n * agent later splits each entry into rework phases or a follow-up idea. */\n review?: LogEntry[];\n /** The entity's single ordered feedback thread — see EntityEntry.thread. */\n thread?: ThreadMessage[];\n /** Set by readEntities from which dir the file came from — see EntityEntry.archived. */\n archived?: boolean;\n pr?: PrInfo;\n}\n\nexport interface ArchivableIdea {\n id: string;\n title: string;\n pr: PrInfo;\n}\n\n/** One open `question` thread message, resolved to the idea it's parked on. `ageDays`\n * is `Infinity` for a question ported from the pre-Thread Notes section, which never\n * carried a date — the oldest kind of unresolved question there is. */\nexport interface ParkedQuestion {\n entityId: string;\n entityTitle: string;\n text: string;\n date?: string;\n ageDays: number;\n}\n\n/** The two event-sourced notification kinds (IDEA-153) — 'completed' when a task\n * reaches done/error, 'reply' when an agent posts a non-blocking feedback thread\n * entry. Unlike ParkedQuestion (derived live from thread state), these are stored\n * as discrete events on read, so a since-resolved source can't erase them. */\nexport type StoredNotificationKind = 'completed' | 'reply';\n\nexport interface StoredNotification {\n id: string;\n kind: StoredNotificationKind;\n entityId: string;\n entityTitle: string;\n text: string;\n date: string;\n read: boolean;\n /** Only set for 'completed' — the task outcome that triggered it. */\n outcome?: 'done' | 'error';\n}\n\n/** One unified feed entry (IDEA-153) — a parked question (open→resolved, always\n * unread while it's shown at all) alongside the two stored, read/unread kinds. */\nexport type Notification = (ParkedQuestion & { kind: 'question' }) | StoredNotification;\n\nexport type ConsistencyIssueKind = 'orphan-subject' | 'title-style';\n\nexport interface ConsistencyIssue {\n kind: ConsistencyIssueKind;\n section: 'plans';\n title: string;\n message: string;\n planId?: string;\n}\n\nexport interface CommentStats {\n commentLines: number;\n sourceLines: number;\n ratio: number;\n}\n\nexport interface TasksPerWeek {\n /** ISO week, e.g. \"2026-W05\". */\n week: string;\n count: number;\n}\n\nexport interface UsagePerWeek {\n /** ISO week, e.g. \"2026-W05\". */\n week: string;\n agentMinutes: number;\n inputTokens: number;\n outputTokens: number;\n}\n\nexport interface IdeaCost {\n planId: string;\n planTitle: string;\n inputTokens: number;\n outputTokens: number;\n durationMs: number;\n}\n\nexport interface CapacityStat {\n snapshot: RateLimitSnapshot;\n capturedAt: string;\n}\n\nexport interface ProjectStats {\n generatedAt: string;\n comments: CommentStats;\n testLines: number;\n /** Null when no coverage report has been emitted yet (run `pnpm test`). */\n testCoveragePct: number | null;\n entitiesByStatus: Partial<Record<EntityStatus, number>>;\n openQuestions: number;\n decisions: number;\n tasksPerWeek: TasksPerWeek[];\n usagePerWeek: UsagePerWeek[];\n medianPhaseDurationMs: number | null;\n mostExpensiveIdeas: IdeaCost[];\n capacity: CapacityStat | null;\n}\n\nexport type IdeaKind = 'idea' | 'note';\n\nexport type IdeaStatus = 'open' | 'done' | 'dropped';\n\nexport interface IdeaEntry {\n id: string | null;\n title: string;\n body: string;\n kind?: IdeaKind;\n status?: IdeaStatus;\n /** Absent renders under the virtual \"No subject\" group. */\n subject?: string;\n /** Absent means unordered — sorts after all ordered entries, by created date. */\n order?: number;\n /** Fallback sort key for unordered entries — see `order`. Absent on view-model-only IdeaEntry literals that never enter the worklist sort. */\n created?: string;\n log?: LogEntry[];\n}\n\n// Unified entity — one file per entity, plan as an optional Phases section.\n// Supersedes PlanEntry/IdeaEntry once the migration cutover lands.\n\n/** Work classification — same Conventional-Commits values as PlanKind; `kind` renamed to `type` in the unified schema. */\nexport type EntityType = PlanKind;\n\n/** Plan lifecycle plus the note-only `open`. Notes use open → done/dropped; everything else uses the PlanStatus track. */\nexport type EntityStatus = PlanStatus | 'open';\n\nexport interface EntityEntry {\n id: string;\n title: string;\n /** Absent until the entity is classified (usually when its plan is drafted). */\n type?: EntityType;\n /** \"note\" marks an entity that never grows phases. */\n kind?: 'note';\n /** Stored override, not the source of truth — see entityFrontmatterSchema. */\n status?: EntityStatus;\n agent?: AgentId;\n created: string;\n updated?: string;\n audited?: string;\n auditedHash?: string;\n /** Version tag (e.g. v0.13.1) that first shipped this idea, stamped from the release train. */\n released?: string;\n tags: string[];\n /** Absent renders as the virtual \"No subject\" group. */\n subject?: string;\n /** Absent means unordered — sorts after all ordered entries, by created date. */\n order?: number;\n body: string;\n phases: PhaseItem[];\n /** Post-build findings, same checkbox grammar as `phases` — appended below Phases\n * rather than rewriting the plan's already-finished phase history. */\n fixes?: PhaseItem[];\n /** The entity's single ordered feedback thread — folds what used to be separate\n * log/clarifications/notes/review sections. */\n thread?: ThreadMessage[];\n /** Set by readEntities from which of the two scanned dirs the file came from, not the frontmatter. */\n archived?: boolean;\n}\n\n// No `id`/`status`: it only becomes a real idea if a human promotes it.\nexport interface SuggestionEntry {\n date: string;\n title: string;\n description: string;\n}\n\nexport interface RoadmapItem {\n name: string;\n description: string;\n candidates: string[];\n linked: string[];\n}\n\nexport interface RoadmapHorizon {\n title: string;\n items: RoadmapItem[];\n}\n\nexport interface Roadmap {\n goal: string;\n horizons: RoadmapHorizon[];\n standingConcerns: RoadmapItem[];\n}\n\nexport interface RoadmapLink {\n id: string;\n status: PlanStatus;\n taskRuns: number;\n pr?: PrInfo;\n released: boolean;\n}\n\nexport interface RoadmapRollup {\n total: number;\n done: number;\n}\n\nexport interface ResolvedRoadmapItem extends RoadmapItem {\n links: RoadmapLink[];\n rollup: RoadmapRollup;\n}\n\nexport interface ResolvedRoadmapHorizon {\n title: string;\n items: ResolvedRoadmapItem[];\n rollup: RoadmapRollup;\n}\n\nexport interface ResolvedRoadmap {\n goal: string;\n horizons: ResolvedRoadmapHorizon[];\n events: RoadmapEvent[];\n}\n\nexport type RoadmapEventKind = 'created' | 'task-run';\n\nexport interface RoadmapEvent {\n date: string;\n kind: RoadmapEventKind;\n entityId: string;\n horizonTitle: string;\n itemName: string;\n label: string;\n}\n\nexport interface EnvEntry {\n key: string;\n value: string;\n /** Set on GET responses when the value is withheld — secrets never reach the client. */\n isSet?: boolean;\n}\n\nexport interface AgentConfig {\n agent: AgentId;\n model?: string;\n effort?: string;\n}\n\n/** Model/effort passed to an adapter's buildArgs — the AgentConfig minus the agent id. */\nexport interface AgentRunOptions {\n model?: string;\n effort?: string;\n /** Prior claude-code session id to continue instead of starting cold; ignored by opencode. */\n resume?: string;\n}\n\n/** Maps option names to a fixed value list (renders a Select) or null (free-text or hidden). */\nexport type AgentOptionsDescriptor = Record<string, string[] | null | undefined>;\n\nexport const AGENT_OPTIONS: Record<AgentId, AgentOptionsDescriptor> = {\n 'claude-code': {\n model: ['opus', 'sonnet', 'fable', 'haiku'],\n effort: ['low', 'medium', 'high', 'xhigh', 'max'],\n },\n opencode: {\n model: null,\n },\n};\n\nexport function coerceAgentConfig(v: unknown): AgentConfig {\n const toAgent = (a: unknown): AgentId =>\n AGENT_IDS.includes(a as AgentId) ? (a as AgentId) : 'claude-code';\n if (typeof v === 'string') return { agent: toAgent(v) };\n // A missing key must not throw — that would 500 the /api/config read this protects.\n const obj = (v ?? {}) as Record<string, unknown>;\n return {\n agent: toAgent(obj.agent),\n ...(typeof obj.model === 'string' && { model: obj.model }),\n ...(typeof obj.effort === 'string' && { effort: obj.effort }),\n };\n}\n\nexport interface DefaultAgentsMap {\n phase: AgentConfig;\n planDraft: AgentConfig;\n ideaExtend: AgentConfig;\n commitSuggest: AgentConfig;\n feedback: AgentConfig;\n}\n\nexport const DEFAULT_AGENTS: DefaultAgentsMap = {\n phase: { agent: 'opencode' },\n planDraft: { agent: 'claude-code' },\n ideaExtend: { agent: 'claude-code' },\n commitSuggest: { agent: 'claude-code' },\n feedback: { agent: 'claude-code', model: 'sonnet', effort: 'medium' },\n};\n\n/** Toolbar segments, left to right (IDEA-128/IDEA-133); trimmed per project via `IntegrationConfig.toolbar.segments`. */\nexport const TOOLBAR_SEGMENT_IDS = ['focus', 'scout', 'desk'] as const;\n\nexport type ToolbarSegmentId = (typeof TOOLBAR_SEGMENT_IDS)[number];\n\nexport interface IntegrationToolbarConfig {\n enabled?: boolean;\n segments?: ToolbarSegmentId[];\n /** Opt-in escape hatch: without it, the vite plugin stays off when `mode` is `production`. */\n allowProduction?: boolean;\n}\n\nexport interface IntegrationConfig {\n toolbar?: IntegrationToolbarConfig;\n route?: string;\n}\n\nexport interface DeskService {\n name: string;\n cmd: string;\n port?: number;\n healthcheck?: string;\n}\n\nexport interface DeskCheck {\n name: string;\n cmd: string;\n}\n\nexport interface DeskCi {\n repo: string;\n branch?: string;\n releasePlease?: boolean;\n}\n\n/** Dev-loop manifest (IDEA-119): declared services, one-click checks, and CI/release sources. */\nexport interface DeskConfig {\n services?: DeskService[];\n checks?: DeskCheck[];\n ci?: DeskCi;\n}\n\nexport type ServiceRunStatus = 'stopped' | 'running' | 'stopping' | 'crashed';\n\nexport type ServiceHealth = 'unknown' | 'up' | 'down';\n\n/** Live runtime view of a declared service (IDEA-119), merging manifest + process state. */\nexport interface ServiceState {\n name: string;\n cmd: string;\n port?: number;\n hasHealthcheck: boolean;\n status: ServiceRunStatus;\n health: ServiceHealth;\n pid: number | null;\n startedAt: string | null;\n exitCode: number | null;\n}\n\n/** Live result of a declared one-click check (IDEA-119), mirroring the Stack panel's CheckResult. */\nexport interface DeskCheckState {\n name: string;\n cmd: string;\n status: CheckStatus;\n lastRun: string | null;\n output: string;\n}\n\nexport type CiRunStatus =\n | 'success'\n | 'failure'\n | 'in_progress'\n | 'queued'\n | 'cancelled'\n | 'unknown';\n\nexport interface CiRun {\n workflow: string;\n status: CiRunStatus;\n url: string | null;\n}\n\nexport interface ReleasePr {\n number: number;\n title: string;\n url: string;\n version: string | null;\n}\n\n/** CI & release mirror for a declared repo (IDEA-119): latest Actions runs on the tracked\n * branch, the open release-please PR, and the released vs. queued version. */\nexport interface CiReleaseState {\n repo: string;\n branch: string;\n available: boolean;\n runs: CiRun[];\n releasePr: ReleasePr | null;\n releasedVersion: string | null;\n}\n\nexport interface PaperCampConfig {\n version: string;\n projectName: string;\n initializedAt: string;\n /** The unified-entity `idea` counter; the per-kind plan counters are legacy, present only in pre-migration configs. */\n nextId?: Partial<Record<PlanKind, number>> & { idea?: number };\n port?: number;\n defaultAgents?: DefaultAgentsMap;\n /** Derived from `ROADMAP.md` on every read (IDEA-95), never written to disk; an idea's\n * `subject` not present here renders as \"No subject\". */\n subjects?: string[];\n /** Opts out of the first-run redirect to Settings > Setup while capabilities are incomplete. */\n setupDismissed?: boolean;\n /** In-app dev toolbar (IDEA-128) — the `@dendelion/paper-camp/vite` plugin's mount, toggleable for frontend targets. */\n integration?: IntegrationConfig;\n /** Dev-loop desk manifest (IDEA-119) — declared services, checks, and CI/release sources per project. */\n desk?: DeskConfig;\n /** Project-declared commands the desk/embed can run on demand (IDEA-157). */\n commands?: {\n /** Manual build for the Stack's Build action; no universal default. */\n build?: string;\n };\n}\n\nexport type CheckStatus = 'stale' | 'running' | 'pass' | 'fail';\n\nexport interface CheckResult {\n status: CheckStatus;\n /** The shell command this check runs — empty until a build command is configured. */\n cmd: string;\n lastRun: string | null;\n output: string;\n}\n\nexport type CheckName = 'lint' | 'format' | 'test' | 'consistency' | 'build';\n\nexport type CapabilityStatus = 'ok' | 'warn' | 'missing';\n\nexport interface CapabilityResult {\n id: string;\n status: CapabilityStatus;\n detail: string;\n}\n\nexport interface AgentAuthStatus {\n loggedIn: boolean | null;\n authMethod: string | null;\n apiProvider: string | null;\n}\n\nexport type LoginRelayPhase =\n | 'starting'\n | 'awaiting-authorization'\n | 'success'\n | 'error'\n | 'cancelled';\n\nexport interface LoginRelayState {\n phase: LoginRelayPhase;\n authorizeUrl: string | null;\n error?: string;\n}\n\nexport type ServiceId = 'git' | 'gh' | `agent:${AgentId}`;\n\n/** What a Connections row offers once its service isn't `ok` — copy a command, follow a link, or read plain instructions. */\nexport type ConnectAction =\n /** `runnable` marks a command with no placeholders and no interactive prompts — safe for the server to execute directly instead of just displaying it. */\n | { kind: 'command'; command: string; runnable?: boolean }\n | { kind: 'link'; url: string; label: string }\n | { kind: 'text'; message: string };\n\nexport interface ConnectionResult {\n id: ServiceId;\n label: string;\n unlocks: string;\n status: CapabilityStatus;\n detail: string;\n authenticated: boolean | null;\n connect: ConnectAction | null;\n}\n\nexport interface MergePolicy {\n allowSquashMerge: boolean;\n allowMergeCommit: boolean;\n allowRebaseMerge: boolean;\n squashMergeCommitTitle: string;\n squashMergeCommitMessage: string;\n}\n\nexport type MergePolicyResult =\n | { status: 'ok'; repo: string; policy: MergePolicy }\n | { status: 'unavailable'; reason: string };\n\nexport interface GitStatusEntry {\n path: string;\n status: string;\n staged: boolean;\n renameSource?: string;\n}\n\nexport interface GitStatusResponse {\n branch: string;\n entries: GitStatusEntry[];\n ahead: number;\n behind: number;\n diverged: boolean;\n branchHygiene: BranchHygieneStatus;\n}\n\nexport interface FileDiffEntry {\n path: string;\n renameSource?: string;\n staged: boolean;\n binary: boolean;\n additions: number;\n deletions: number;\n // 'diff' is a unified patch (tracked files); 'raw' is untracked file content, not a\n // patch; 'too-large' means `patch` is empty and the file was skipped.\n contentKind: 'diff' | 'raw' | 'too-large';\n patch: string;\n}\n\nexport type BranchHygieneStatus =\n | 'clean-on-main'\n | 'stale-merged'\n | 'stale-no-upstream'\n | 'dirty'\n | 'fine';\n\nexport interface GitLiveState {\n branch: string;\n ahead: number;\n behind: number;\n dirtyCount: number;\n}\n\nexport interface GitSyncFailure {\n ok: false;\n stage: 'reconcile' | 'stash-pop' | 'conflicted';\n message: string;\n stashPending: boolean;\n // Only set when stage is 'conflicted': the files a rebase left with unresolved\n // markers, for a one-click \"ask the agent to resolve\" rather than a bare error.\n conflictedFiles?: string[];\n // Only set when stage is 'conflicted': the ref the rebase targeted, and each\n // conflicted file's last-seen content (with markers) before the rebase was\n // aborted for safety — the resolve-conflict agent's raw material.\n conflictRef?: string;\n conflictedContent?: { path: string; content: string }[];\n // Prompt for the agent recovery job (see git-sync-recovery.ts) — the deterministic\n // path's failure, the working-tree state, and the goal, packaged for a future\n // launch rather than thrown at the user.\n recoveryPrompt: string;\n // Only set when stage is 'conflicted': a prompt scoped to landing this one rebase\n // (see resolve-conflict-prompt.ts) — launched only on explicit \"ask the agent to\n // resolve\" confirmation from the sync-failed toast, never automatically.\n conflictPrompt?: string;\n}\n\nexport type GitSyncResult = { ok: true } | GitSyncFailure;\n\nexport type AgentTaskStatus = 'starting' | 'running' | 'stopping' | 'done' | 'error' | 'superseded';\n\nexport type TaskKind =\n | 'phase'\n | 'audit'\n | 'batch-reconcile'\n | 'run-all'\n | 'draft'\n | 'extend'\n | 'suggest'\n | 'commit-suggest'\n | 'overlap-check'\n | 'prioritise'\n | 'sync'\n | 'reconcile'\n | 'fix-review'\n | 'resolve-conflict'\n | 'feedback';\n\n// Persisted to papercamp/tasks.log (JSON Lines) — survives a dev-server restart,\n// unlike the in-memory task registry.\nexport interface TaskLogEntry {\n id: string;\n taskKind: TaskKind;\n planId?: string;\n planTitle: string;\n agentId: AgentId;\n startedAt: string;\n endedAt: string;\n outcome: 'done' | 'error' | 'superseded';\n reason?: string;\n usage?: RunUsage;\n phaseRuns?: PhaseRunRecord[];\n rateLimit?: RateLimitSnapshot;\n}\n\nexport interface RunUsage {\n durationMs: number;\n numTurns: number;\n model?: string;\n inputTokens: number;\n outputTokens: number;\n cacheCreationTokens: number;\n cacheReadTokens: number;\n costUsd: number;\n}\n\nexport interface RateLimitSnapshot {\n status: string;\n rateLimitType?: string;\n resetsAt?: number;\n overage?: boolean;\n}\n\nexport interface PhaseRunRecord {\n kind: 'phase' | 'fix';\n index: number;\n usage: RunUsage;\n}\n\nexport interface TrailHop<T> {\n reached: boolean;\n data?: T;\n}\n\nexport interface ProvenanceTrail {\n id: string;\n idea: TrailHop<{ title: string; status?: EntityStatus; type?: EntityType }>;\n phases: TrailHop<PhaseItem[]>;\n taskRuns: TrailHop<TaskLogEntry[]>;\n commits: TrailHop<string[]>;\n pr: TrailHop<PrInfo>;\n releaseLine: TrailHop<string>;\n}\n\nexport interface ReleaseNoteIdea {\n id: string;\n title: string;\n}\n\nexport interface ReleaseNoteSection {\n label: string;\n ideas: ReleaseNoteIdea[];\n}\n\nexport interface AgentTaskState {\n id: string;\n status: AgentTaskStatus;\n taskKind: TaskKind;\n planTitle: string;\n planId?: string;\n phaseIndex?: number;\n fixAttempt?: number;\n fixAttemptCap?: number;\n ideaId?: string;\n agentId: AgentId;\n lines: string[];\n phaseAnchor?: PhaseMilestone;\n anchorEnteredAt?: number;\n lastStreamAt?: number;\n // fix-review only: prefills the commit form once the agent has reported.\n suggestedCommit?: { title: string; message: string };\n errorKind?: 'auth' | 'question';\n rateLimit?: RateLimitSnapshot;\n}\n\nexport interface OverlapVerdict {\n verdict: 'existing' | 'extend' | 'new';\n targetId: string | null;\n reasoning: string;\n}\n\n/** `why` carries one line per entry in `order`, same index — the reason for that id's placement. */\nexport interface PrioritiseVerdict {\n order: string[];\n why: string;\n}\n\nexport interface ReconcileQueueItem {\n planId: string;\n title: string;\n before: { body: string; phases: PhaseItem[] };\n}\n"],"names":["PLAN_STATUSES","PLAN_KINDS","AGENT_IDS","AGENT_LABELS","AGENT_OPTIONS","coerceAgentConfig","v","toAgent","a","obj","DEFAULT_AGENTS","TOOLBAR_SEGMENT_IDS"],"mappings":"AAEO,MAAMA,IAA8B;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GASaC,IAAyB,CAAC,QAAQ,OAAO,SAAS,QAAQ,UAAU,GAEpEC,IAAY,CAAC,eAAe,UAAU,GAItCC,IAAwC;AAAA,EACnD,eAAe;AAAA,EACf,UAAU;AACZ,GAmbaC,IAAyD;AAAA,EACpE,eAAe;AAAA,IACb,OAAO,CAAC,QAAQ,UAAU,SAAS,OAAO;AAAA,IAC1C,QAAQ,CAAC,OAAO,UAAU,QAAQ,SAAS,KAAK;AAAA,EAAA;AAAA,EAElD,UAAU;AAAA,IACR,OAAO;AAAA,EAAA;AAEX;AAEO,SAASC,EAAkBC,GAAyB;AACzD,QAAMC,IAAU,CAACC,MACfN,EAAU,SAASM,CAAY,IAAKA,IAAgB;AACtD,MAAI,OAAOF,KAAM,SAAU,QAAO,EAAE,OAAOC,EAAQD,CAAC,EAAA;AAEpD,QAAMG,IAAOH,KAAK,CAAA;AAClB,SAAO;AAAA,IACL,OAAOC,EAAQE,EAAI,KAAK;AAAA,IACxB,GAAI,OAAOA,EAAI,SAAU,YAAY,EAAE,OAAOA,EAAI,MAAA;AAAA,IAClD,GAAI,OAAOA,EAAI,UAAW,YAAY,EAAE,QAAQA,EAAI,OAAA;AAAA,EAAO;AAE/D;AAUO,MAAMC,IAAmC;AAAA,EAC9C,OAAO,EAAE,OAAO,WAAA;AAAA,EAChB,WAAW,EAAE,OAAO,cAAA;AAAA,EACpB,YAAY,EAAE,OAAO,cAAA;AAAA,EACrB,eAAe,EAAE,OAAO,cAAA;AAAA,EACxB,UAAU,EAAE,OAAO,eAAe,OAAO,UAAU,QAAQ,SAAA;AAC7D,GAGaC,IAAsB,CAAC,SAAS,SAAS,MAAM;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/types/index.ts"],"sourcesContent":["export type PlanStatus = 'idea' | 'planned' | 'in-progress' | 'review' | 'done' | 'dropped';\n\nexport const PLAN_STATUSES: PlanStatus[] = [\n 'idea',\n 'planned',\n 'in-progress',\n 'review',\n 'done',\n 'dropped',\n];\n\nexport interface LogEntry {\n date: string;\n text: string;\n}\n\nexport type PlanKind = 'feat' | 'fix' | 'chore' | 'docs' | 'refactor';\n\nexport const PLAN_KINDS: PlanKind[] = ['feat', 'fix', 'chore', 'docs', 'refactor'];\n\nexport const AGENT_IDS = ['claude-code', 'opencode'] as const;\n\nexport type AgentId = (typeof AGENT_IDS)[number];\n\nexport const AGENT_LABELS: Record<AgentId, string> = {\n 'claude-code': 'Claude Code',\n opencode: 'OpenCode',\n};\n\nexport interface PhaseRun {\n durationMs: number;\n inputTokens: number;\n outputTokens: number;\n model?: string;\n attempts: number;\n}\n\nexport interface PhaseItem {\n done: boolean;\n text: string;\n description?: string;\n source?: 'review' | 'manual';\n run?: PhaseRun;\n}\n\nexport type PhaseMilestone = 'implement' | 'verify' | 'checkbox';\n\n/** A body section anchor is `body` for now — the whole prose block is the only\n * body section a plan/entity has until later phases break it into sub-sections. */\nexport type MarginNoteAnchor = { kind: 'phase'; index: number } | { kind: 'body' };\n\nexport type MarginNoteState = 'open' | 'resolved';\n\nexport type MarginNoteKind = 'note' | 'decision' | 'question';\n\nexport interface MarginNote {\n anchor: MarginNoteAnchor;\n prose: string;\n state: MarginNoteState;\n kind?: MarginNoteKind;\n}\n\n/** What a thread message originally was, before log/review/notes/clarifications folded\n * into one ordered thread on the entity — 'note'/'decision'/'question' carry `state`,\n * the rest are plain historical records. 'chat' is thread-native (no legacy section):\n * Paper Scout conversation, collapsed by default in thread views. */\nexport type ThreadMessageKind =\n | 'log'\n | 'clarification'\n | 'review'\n | 'note'\n | 'decision'\n | 'question'\n | 'chat';\n\nexport interface ThreadMessage {\n kind: ThreadMessageKind;\n /** Absent for messages ported from the old Notes section, which never carried a date. */\n date?: string;\n text: string;\n /** Only meaningful for note/decision/question kinds. */\n state?: MarginNoteState;\n /** Absent means 'user' — no thread message predates this field being agent-authored. */\n from?: 'user' | 'agent';\n}\n\n/** Ambient context a chat mount (desk, toolbar) feeds alongside a message — each\n * mount populates whatever it has (IDEA-130); Scout folds it into the prompt\n * silently, it never becomes a user-visible field. */\nexport interface MountContext {\n route?: string;\n focusedIdeaId?: string;\n viewport?: { width: number; height: number };\n}\n\nexport interface RawEntry {\n title: string;\n fields: Record<string, string>;\n body: string;\n phases: PhaseItem[];\n log?: LogEntry[];\n clarifications?: LogEntry[];\n notes?: MarginNote[];\n review?: LogEntry[];\n}\n\nexport interface ParseWarning {\n title: string;\n message: string;\n}\n\nexport interface ParseResult<T> {\n entries: T[];\n warnings: ParseWarning[];\n}\n\n/** A PR's reviewable/mergeable state, as surfaced by `gh pr list`. */\nexport type PrState = 'draft' | 'open' | 'closed' | 'merged';\n\n/** GitHub's PR review decision, as surfaced by `gh pr list --json reviewDecision`. */\nexport type ReviewDecision = 'approved' | 'changes-requested' | 'review-required';\n\n// Per-comment detail; PrInfo.unresolvedThreadCount only counts these.\nexport interface ReviewThread {\n /** GraphQL node id — what `resolveReviewThread`/`replyToReviewThread` address. */\n id: string;\n /** File path the comment is anchored to; absent for a PR-level (not diff-anchored) comment. */\n path?: string;\n line?: number;\n author?: string;\n body: string;\n}\n\n// Parsed from the JSON object a fix-review agent's prompt requires as its final line.\nexport interface FixReviewResult {\n commit: { title: string; message: string };\n addressed: string[];\n skipped: { threadId: string; why: string }[];\n}\n\nexport interface PrReviewFinding {\n path: string;\n line: number;\n body: string;\n}\n\nexport type PrReviewVerdict = 'approve' | 'comment' | 'request-changes';\n\n// Parsed from the JSON object a pr-review agent's prompt requires as its final\n// line — see buildPrReviewPrompt. findings become per-line PR review comments;\n// the other fields are rendered per destination (IDEA-170, IDEA-175).\nexport interface PrReviewResult {\n verdict: PrReviewVerdict;\n assessment: string;\n concerns: string[];\n findings: PrReviewFinding[];\n}\n\nexport interface FeedbackPhaseEdit {\n op: 'add' | 'reword';\n /** 1-based position in the plan's current phase list; required for \"reword\", ignored for \"add\". */\n index?: number;\n text: string;\n description?: string;\n}\n\nexport interface FeedbackEdit {\n phases?: FeedbackPhaseEdit[];\n /** The complete replacement body, when the message corrects body prose. */\n body?: string;\n}\n\n// Parsed from the JSON object a feedback-reply agent's prompt requires as its\n// final line. The chat never creates ideas — a request is either a reply or an\n// edit on the current plan.\nexport interface FeedbackReplyResult {\n reply: string;\n edit?: FeedbackEdit;\n /** True when the user's message answers an open question the agent asked\n * earlier in this thread — the route persists that message as a clarification. */\n answersQuestion?: boolean;\n}\n\n/** Live-resolved PR info for an entity's branch — see `core/pr.ts`. */\nexport interface PrInfo {\n number: number;\n url: string;\n state: PrState;\n /** Undefined when no review has been requested/decided, or when unresolved (offline, closed/merged PR). */\n reviewDecision?: ReviewDecision;\n /** Count of unresolved review threads. Only fetched for open/draft PRs; undefined when not fetched or unresolved. */\n unresolvedThreadCount?: number;\n /** Whether a comment or review landed after the PR's last commit — a proxy for \"since the last agent pass\" (a pass ends with a push). Only fetched for open/draft PRs. */\n hasNewCommentsSincePush?: boolean;\n /** Full SHA of the PR's current head commit — what a pr-review is scoped to (IDEA-170). */\n headSha?: string;\n headBranch?: string;\n /** A posted review's footer names this entity and `headSha` — set once the poll\n * observes it (IDEA-175). */\n scoutReviewObserved?: boolean;\n}\n\n/** Advisory info for the \"Review PR\" action — nothing here gates the button,\n * it only labels it (IDEA-174 fix 2). */\nexport interface PrReviewStatus {\n ready: boolean;\n headSha: string | null;\n lastReviewedSha: string | null;\n /** null when no CI is configured, or the PR's branch has no runs yet. */\n ciGreen: boolean | null;\n}\n\nexport interface PlanEntry {\n title: string;\n status: PlanStatus;\n kind?: PlanKind;\n id?: string;\n idea?: string;\n agent?: AgentId;\n created: string;\n updated?: string;\n audited?: string;\n auditedHash?: string;\n /** Version tag (e.g. v0.13.1) that first shipped this idea, stamped from the release train. */\n released?: string;\n tags: string[];\n /** Absent renders under the virtual \"No subject\" group. */\n subject?: string;\n /** Absent means unordered — sorts after all ordered entries, by created date. */\n order?: number;\n body: string;\n phases: PhaseItem[];\n /** Post-build findings, same checkbox grammar as `phases` — see EntityEntry.fixes. */\n fixes?: PhaseItem[];\n log?: LogEntry[];\n clarifications?: LogEntry[];\n notes?: MarginNote[];\n /** Prose written against the whole finished plan, distinct from the flat `log` — an\n * agent later splits each entry into rework phases or a follow-up idea. */\n review?: LogEntry[];\n /** The entity's single ordered feedback thread — see EntityEntry.thread. */\n thread?: ThreadMessage[];\n /** Set by readEntities from which dir the file came from — see EntityEntry.archived. */\n archived?: boolean;\n pr?: PrInfo;\n}\n\nexport interface ArchivableIdea {\n id: string;\n title: string;\n pr: PrInfo;\n}\n\n/** One open `question` thread message, resolved to the idea it's parked on. `ageDays`\n * is `Infinity` for a question ported from the pre-Thread Notes section, which never\n * carried a date — the oldest kind of unresolved question there is. */\nexport interface ParkedQuestion {\n entityId: string;\n entityTitle: string;\n text: string;\n date?: string;\n ageDays: number;\n}\n\n/** The two event-sourced notification kinds (IDEA-153) — 'completed' when a task\n * reaches done/error, 'reply' when an agent posts a non-blocking feedback thread\n * entry. Unlike ParkedQuestion (derived live from thread state), these are stored\n * as discrete events on read, so a since-resolved source can't erase them. */\nexport type StoredNotificationKind = 'completed' | 'reply';\n\nexport interface StoredNotification {\n id: string;\n kind: StoredNotificationKind;\n entityId: string;\n entityTitle: string;\n text: string;\n date: string;\n read: boolean;\n /** Only set for 'completed' — the task outcome that triggered it. */\n outcome?: 'done' | 'error';\n}\n\n/** One unified feed entry (IDEA-153) — a parked question (open→resolved, always\n * unread while it's shown at all) alongside the two stored, read/unread kinds. */\nexport type Notification = (ParkedQuestion & { kind: 'question' }) | StoredNotification;\n\nexport type ConsistencyIssueKind = 'orphan-subject' | 'title-style';\n\nexport interface ConsistencyIssue {\n kind: ConsistencyIssueKind;\n section: 'plans';\n title: string;\n message: string;\n planId?: string;\n}\n\nexport interface CommentStats {\n commentLines: number;\n sourceLines: number;\n ratio: number;\n}\n\nexport interface TasksPerWeek {\n /** ISO week, e.g. \"2026-W05\". */\n week: string;\n count: number;\n}\n\nexport interface UsagePerWeek {\n /** ISO week, e.g. \"2026-W05\". */\n week: string;\n agentMinutes: number;\n inputTokens: number;\n outputTokens: number;\n}\n\nexport interface IdeaCost {\n planId: string;\n planTitle: string;\n inputTokens: number;\n outputTokens: number;\n durationMs: number;\n}\n\nexport interface CapacityStat {\n snapshot: RateLimitSnapshot;\n capturedAt: string;\n}\n\nexport interface ProjectStats {\n generatedAt: string;\n comments: CommentStats;\n testLines: number;\n /** Null when no coverage report has been emitted yet (run `pnpm test`). */\n testCoveragePct: number | null;\n entitiesByStatus: Partial<Record<EntityStatus, number>>;\n openQuestions: number;\n decisions: number;\n tasksPerWeek: TasksPerWeek[];\n usagePerWeek: UsagePerWeek[];\n medianPhaseDurationMs: number | null;\n mostExpensiveIdeas: IdeaCost[];\n capacity: CapacityStat | null;\n}\n\nexport type IdeaKind = 'idea' | 'note';\n\nexport type IdeaStatus = 'open' | 'done' | 'dropped';\n\nexport interface IdeaEntry {\n id: string | null;\n title: string;\n body: string;\n kind?: IdeaKind;\n status?: IdeaStatus;\n /** Absent renders under the virtual \"No subject\" group. */\n subject?: string;\n /** Absent means unordered — sorts after all ordered entries, by created date. */\n order?: number;\n /** Fallback sort key for unordered entries — see `order`. Absent on view-model-only IdeaEntry literals that never enter the worklist sort. */\n created?: string;\n log?: LogEntry[];\n}\n\n// Unified entity — one file per entity, plan as an optional Phases section.\n// Supersedes PlanEntry/IdeaEntry once the migration cutover lands.\n\n/** Work classification — same Conventional-Commits values as PlanKind; `kind` renamed to `type` in the unified schema. */\nexport type EntityType = PlanKind;\n\n/** Plan lifecycle plus the note-only `open`. Notes use open → done/dropped; everything else uses the PlanStatus track. */\nexport type EntityStatus = PlanStatus | 'open';\n\nexport interface EntityEntry {\n id: string;\n title: string;\n /** Absent until the entity is classified (usually when its plan is drafted). */\n type?: EntityType;\n /** \"note\" marks an entity that never grows phases. */\n kind?: 'note';\n /** Stored override, not the source of truth — see entityFrontmatterSchema. */\n status?: EntityStatus;\n agent?: AgentId;\n created: string;\n updated?: string;\n audited?: string;\n auditedHash?: string;\n /** Version tag (e.g. v0.13.1) that first shipped this idea, stamped from the release train. */\n released?: string;\n tags: string[];\n /** Absent renders as the virtual \"No subject\" group. */\n subject?: string;\n /** Absent means unordered — sorts after all ordered entries, by created date. */\n order?: number;\n body: string;\n phases: PhaseItem[];\n /** Post-build findings, same checkbox grammar as `phases` — appended below Phases\n * rather than rewriting the plan's already-finished phase history. */\n fixes?: PhaseItem[];\n /** The entity's single ordered feedback thread — folds what used to be separate\n * log/clarifications/notes/review sections. */\n thread?: ThreadMessage[];\n /** Set by readEntities from which of the two scanned dirs the file came from, not the frontmatter. */\n archived?: boolean;\n}\n\n// No `id`/`status`: it only becomes a real idea if a human promotes it.\nexport interface SuggestionEntry {\n date: string;\n title: string;\n description: string;\n}\n\nexport interface RoadmapItem {\n name: string;\n description: string;\n candidates: string[];\n linked: string[];\n}\n\nexport interface RoadmapHorizon {\n title: string;\n items: RoadmapItem[];\n}\n\nexport interface Roadmap {\n goal: string;\n horizons: RoadmapHorizon[];\n standingConcerns: RoadmapItem[];\n}\n\nexport interface RoadmapLink {\n id: string;\n status: PlanStatus;\n taskRuns: number;\n pr?: PrInfo;\n released: boolean;\n}\n\nexport interface RoadmapRollup {\n total: number;\n done: number;\n}\n\nexport interface ResolvedRoadmapItem extends RoadmapItem {\n links: RoadmapLink[];\n rollup: RoadmapRollup;\n}\n\nexport interface ResolvedRoadmapHorizon {\n title: string;\n items: ResolvedRoadmapItem[];\n rollup: RoadmapRollup;\n}\n\nexport interface ResolvedRoadmap {\n goal: string;\n horizons: ResolvedRoadmapHorizon[];\n events: RoadmapEvent[];\n}\n\nexport type RoadmapEventKind = 'created' | 'task-run';\n\nexport interface RoadmapEvent {\n date: string;\n kind: RoadmapEventKind;\n entityId: string;\n horizonTitle: string;\n itemName: string;\n label: string;\n}\n\nexport interface EnvEntry {\n key: string;\n value: string;\n /** Set on GET responses when the value is withheld — secrets never reach the client. */\n isSet?: boolean;\n}\n\nexport interface AgentConfig {\n agent: AgentId;\n model?: string;\n effort?: string;\n}\n\n/** Model/effort passed to an adapter's buildArgs — the AgentConfig minus the agent id. */\nexport interface AgentRunOptions {\n model?: string;\n effort?: string;\n /** Prior claude-code session id to continue instead of starting cold; ignored by opencode. */\n resume?: string;\n}\n\n/** Maps option names to a fixed value list (renders a Select) or null (free-text or hidden). */\nexport type AgentOptionsDescriptor = Record<string, string[] | null | undefined>;\n\nexport const AGENT_OPTIONS: Record<AgentId, AgentOptionsDescriptor> = {\n 'claude-code': {\n model: ['opus', 'sonnet', 'fable', 'haiku'],\n effort: ['low', 'medium', 'high', 'xhigh', 'max'],\n },\n opencode: {\n model: null,\n },\n};\n\nexport function coerceAgentConfig(v: unknown): AgentConfig {\n const toAgent = (a: unknown): AgentId =>\n AGENT_IDS.includes(a as AgentId) ? (a as AgentId) : 'claude-code';\n if (typeof v === 'string') return { agent: toAgent(v) };\n // A missing key must not throw — that would 500 the /api/config read this protects.\n const obj = (v ?? {}) as Record<string, unknown>;\n return {\n agent: toAgent(obj.agent),\n ...(typeof obj.model === 'string' && { model: obj.model }),\n ...(typeof obj.effort === 'string' && { effort: obj.effort }),\n };\n}\n\nexport interface DefaultAgentsMap {\n phase: AgentConfig;\n planDraft: AgentConfig;\n ideaExtend: AgentConfig;\n commitSuggest: AgentConfig;\n feedback: AgentConfig;\n codeReview: AgentConfig;\n}\n\nexport const DEFAULT_AGENTS: DefaultAgentsMap = {\n phase: { agent: 'opencode' },\n planDraft: { agent: 'claude-code' },\n ideaExtend: { agent: 'claude-code' },\n commitSuggest: { agent: 'claude-code' },\n feedback: { agent: 'claude-code', model: 'sonnet', effort: 'medium' },\n codeReview: { agent: 'claude-code', model: 'opus', effort: 'high' },\n};\n\n/** A reviewer must not use the same model as the task that wrote the code (IDEA-170) — self-review rubber-stamps. */\nexport function agentConfigsEqual(a: AgentConfig, b: AgentConfig): boolean {\n return a.agent === b.agent && (a.model ?? '') === (b.model ?? '');\n}\n\n/** Toolbar segments, left to right (IDEA-128/IDEA-133); trimmed per project via `IntegrationConfig.toolbar.segments`. */\nexport const TOOLBAR_SEGMENT_IDS = ['focus', 'scout', 'desk'] as const;\n\nexport type ToolbarSegmentId = (typeof TOOLBAR_SEGMENT_IDS)[number];\n\nexport interface IntegrationToolbarConfig {\n enabled?: boolean;\n segments?: ToolbarSegmentId[];\n /** Opt-in escape hatch: without it, the vite plugin stays off when `mode` is `production`. */\n allowProduction?: boolean;\n}\n\nexport interface IntegrationConfig {\n toolbar?: IntegrationToolbarConfig;\n route?: string;\n}\n\nexport interface DeskService {\n name: string;\n cmd: string;\n port?: number;\n healthcheck?: string;\n}\n\nexport interface DeskCheck {\n name: string;\n cmd: string;\n}\n\nexport interface DeskCi {\n repo: string;\n branch?: string;\n releasePlease?: boolean;\n}\n\n/** Dev-loop manifest (IDEA-119): declared services, one-click checks, and CI/release sources. */\nexport interface DeskConfig {\n services?: DeskService[];\n checks?: DeskCheck[];\n ci?: DeskCi;\n}\n\nexport type ServiceRunStatus = 'stopped' | 'running' | 'stopping' | 'crashed';\n\nexport type ServiceHealth = 'unknown' | 'up' | 'down';\n\n/** Live runtime view of a declared service (IDEA-119), merging manifest + process state. */\nexport interface ServiceState {\n name: string;\n cmd: string;\n port?: number;\n hasHealthcheck: boolean;\n status: ServiceRunStatus;\n health: ServiceHealth;\n pid: number | null;\n startedAt: string | null;\n exitCode: number | null;\n}\n\n/** Live result of a declared one-click check (IDEA-119), mirroring the Stack panel's CheckResult. */\nexport interface DeskCheckState {\n name: string;\n cmd: string;\n status: CheckStatus;\n lastRun: string | null;\n output: string;\n}\n\nexport type CiRunStatus =\n | 'success'\n | 'failure'\n | 'in_progress'\n | 'queued'\n | 'cancelled'\n | 'unknown';\n\nexport interface CiRun {\n workflow: string;\n status: CiRunStatus;\n url: string | null;\n}\n\nexport interface ReleasePr {\n number: number;\n title: string;\n url: string;\n version: string | null;\n}\n\n/** CI & release mirror for a declared repo (IDEA-119): latest Actions runs on the tracked\n * branch, the open release-please PR, and the released vs. queued version. */\nexport interface CiReleaseState {\n repo: string;\n branch: string;\n available: boolean;\n runs: CiRun[];\n releasePr: ReleasePr | null;\n releasedVersion: string | null;\n}\n\nexport interface PaperCampConfig {\n version: string;\n projectName: string;\n initializedAt: string;\n /** The unified-entity `idea` counter; the per-kind plan counters are legacy, present only in pre-migration configs. */\n nextId?: Partial<Record<PlanKind, number>> & { idea?: number };\n port?: number;\n defaultAgents?: DefaultAgentsMap;\n /** Derived from `ROADMAP.md` on every read (IDEA-95), never written to disk; an idea's\n * `subject` not present here renders as \"No subject\". */\n subjects?: string[];\n /** Opts out of the first-run redirect to Settings > Setup while capabilities are incomplete. */\n setupDismissed?: boolean;\n /** In-app dev toolbar (IDEA-128) — the `@dendelion/paper-camp/vite` plugin's mount, toggleable for frontend targets. */\n integration?: IntegrationConfig;\n /** Dev-loop desk manifest (IDEA-119) — declared services, checks, and CI/release sources per project. */\n desk?: DeskConfig;\n /** Project-declared commands the desk/embed can run on demand (IDEA-157). */\n commands?: {\n /** Manual build for the Stack's Build action; no universal default. */\n build?: string;\n };\n}\n\nexport type CheckStatus = 'stale' | 'running' | 'pass' | 'fail';\n\nexport interface CheckResult {\n status: CheckStatus;\n /** The shell command this check runs — empty until a build command is configured. */\n cmd: string;\n lastRun: string | null;\n output: string;\n}\n\nexport type CheckName = 'lint' | 'format' | 'test' | 'consistency' | 'build';\n\nexport type CapabilityStatus = 'ok' | 'warn' | 'missing';\n\nexport interface CapabilityResult {\n id: string;\n status: CapabilityStatus;\n detail: string;\n}\n\nexport interface AgentAuthStatus {\n loggedIn: boolean | null;\n authMethod: string | null;\n apiProvider: string | null;\n}\n\nexport type LoginRelayPhase =\n | 'starting'\n | 'awaiting-authorization'\n | 'success'\n | 'error'\n | 'cancelled';\n\nexport interface LoginRelayState {\n phase: LoginRelayPhase;\n authorizeUrl: string | null;\n error?: string;\n}\n\nexport type ServiceId = 'git' | 'gh' | `agent:${AgentId}`;\n\n/** What a Connections row offers once its service isn't `ok` — copy a command, follow a link, or read plain instructions. */\nexport type ConnectAction =\n /** `runnable` marks a command with no placeholders and no interactive prompts — safe for the server to execute directly instead of just displaying it. */\n | { kind: 'command'; command: string; runnable?: boolean }\n | { kind: 'link'; url: string; label: string }\n | { kind: 'text'; message: string };\n\nexport interface ConnectionResult {\n id: ServiceId;\n label: string;\n unlocks: string;\n status: CapabilityStatus;\n detail: string;\n authenticated: boolean | null;\n connect: ConnectAction | null;\n}\n\nexport interface MergePolicy {\n allowSquashMerge: boolean;\n allowMergeCommit: boolean;\n allowRebaseMerge: boolean;\n squashMergeCommitTitle: string;\n squashMergeCommitMessage: string;\n}\n\nexport type MergePolicyResult =\n | { status: 'ok'; repo: string; policy: MergePolicy }\n | { status: 'unavailable'; reason: string };\n\nexport interface GitStatusEntry {\n path: string;\n status: string;\n staged: boolean;\n renameSource?: string;\n}\n\nexport interface GitStashEntry {\n index: number;\n branch: string;\n message: string;\n ageDays: number;\n own: boolean;\n}\n\nexport interface GitStatusResponse {\n branch: string;\n entries: GitStatusEntry[];\n ahead: number;\n behind: number;\n diverged: boolean;\n branchHygiene: BranchHygieneStatus;\n stashPending: boolean;\n stashes: GitStashEntry[];\n}\n\nexport interface FileDiffEntry {\n path: string;\n renameSource?: string;\n status: string;\n staged: boolean;\n binary: boolean;\n additions: number;\n deletions: number;\n // 'diff' is a unified patch (tracked files); 'raw' is untracked file content, not a\n // patch; 'too-large' means `patch` is empty and the file was skipped.\n contentKind: 'diff' | 'raw' | 'too-large';\n patch: string;\n}\n\nexport type BranchHygieneStatus =\n | 'clean-on-main'\n | 'stale-merged'\n | 'stale-no-upstream'\n | 'dirty'\n | 'fine';\n\nexport interface GitLiveState {\n branch: string;\n ahead: number;\n behind: number;\n dirtyCount: number;\n}\n\n// null means the entity file doesn't exist at that ref (never drafted there yet, or archived).\nexport type PhaseState = { done: number; total: number } | null;\n\n// The ref that's ahead of the current branch's phase state, and its own count — see IDEA-171.\nexport interface StaleBaseRef {\n ref: string;\n done: number;\n total: number;\n}\n\nexport interface GitSyncFailure {\n ok: false;\n stage: 'reconcile' | 'stash-pop' | 'conflicted';\n message: string;\n stashPending: boolean;\n // Only set when stage is 'conflicted': the files a rebase left with unresolved\n // markers, for a one-click \"ask the agent to resolve\" rather than a bare error.\n conflictedFiles?: string[];\n // Only set when stage is 'conflicted': the ref the rebase targeted, and each\n // conflicted file's last-seen content (with markers) before the rebase was\n // aborted for safety — the resolve-conflict agent's raw material.\n conflictRef?: string;\n conflictedContent?: { path: string; content: string }[];\n // Prompt for the agent recovery job (see git-sync-recovery.ts) — the deterministic\n // path's failure, the working-tree state, and the goal, packaged for a future\n // launch rather than thrown at the user.\n recoveryPrompt: string;\n // Only set when stage is 'conflicted': a prompt scoped to landing this one rebase\n // (see resolve-conflict-prompt.ts) — launched only on explicit \"ask the agent to\n // resolve\" confirmation from the sync-failed toast, never automatically.\n conflictPrompt?: string;\n}\n\nexport type GitSyncResult = { ok: true } | GitSyncFailure;\n\nexport type AgentTaskStatus = 'starting' | 'running' | 'stopping' | 'done' | 'error' | 'superseded';\n\nexport type TaskKind =\n | 'phase'\n | 'audit'\n | 'batch-reconcile'\n | 'batch-draft'\n | 'run-all'\n | 'draft'\n | 'extend'\n | 'suggest'\n | 'commit-suggest'\n | 'overlap-check'\n | 'prioritise'\n | 'sync'\n | 'reconcile'\n | 'fix-review'\n | 'resolve-conflict'\n | 'feedback'\n | 'pr-review';\n\n// Persisted to papercamp/tasks.log (JSON Lines) — survives a dev-server restart,\n// unlike the in-memory task registry.\nexport interface TaskLogEntry {\n id: string;\n taskKind: TaskKind;\n planId?: string;\n planTitle: string;\n agentId: AgentId;\n startedAt: string;\n endedAt: string;\n outcome: 'done' | 'error' | 'superseded';\n reason?: string;\n usage?: RunUsage;\n phaseRuns?: PhaseRunRecord[];\n rateLimit?: RateLimitSnapshot;\n}\n\nexport interface RunUsage {\n durationMs: number;\n numTurns: number;\n model?: string;\n inputTokens: number;\n outputTokens: number;\n cacheCreationTokens: number;\n cacheReadTokens: number;\n costUsd: number;\n}\n\nexport interface RateLimitSnapshot {\n status: string;\n rateLimitType?: string;\n resetsAt?: number;\n overage?: boolean;\n}\n\nexport interface PhaseRunRecord {\n kind: 'phase' | 'fix';\n index: number;\n usage: RunUsage;\n}\n\nexport interface TrailHop<T> {\n reached: boolean;\n data?: T;\n}\n\nexport interface ProvenanceTrail {\n id: string;\n idea: TrailHop<{ title: string; status?: EntityStatus; type?: EntityType }>;\n phases: TrailHop<PhaseItem[]>;\n taskRuns: TrailHop<TaskLogEntry[]>;\n commits: TrailHop<string[]>;\n pr: TrailHop<PrInfo>;\n releaseLine: TrailHop<string>;\n}\n\nexport interface ReleaseNoteIdea {\n id: string;\n title: string;\n}\n\nexport interface ReleaseNoteSection {\n label: string;\n ideas: ReleaseNoteIdea[];\n}\n\nexport interface AgentTaskState {\n id: string;\n status: AgentTaskStatus;\n taskKind: TaskKind;\n planTitle: string;\n startedAt: string;\n planId?: string;\n phaseIndex?: number;\n fixAttempt?: number;\n fixAttemptCap?: number;\n ideaId?: string;\n agentId: AgentId;\n lines: string[];\n phaseAnchor?: PhaseMilestone;\n anchorEnteredAt?: number;\n lastStreamAt?: number;\n // fix-review only: prefills the commit form once the agent has reported.\n suggestedCommit?: { title: string; message: string };\n // pr-review only: the PR being reviewed, e.g. https://github.com/o/r/pull/7.\n prReviewUrl?: string;\n errorKind?: 'auth' | 'question';\n rateLimit?: RateLimitSnapshot;\n}\n\nexport interface OverlapVerdict {\n verdict: 'existing' | 'extend' | 'new';\n targetId: string | null;\n reasoning: string;\n}\n\n/** `why` carries one line per entry in `order`, same index — the reason for that id's placement. */\nexport interface PrioritiseVerdict {\n order: string[];\n why: string;\n}\n\nexport interface ReconcileQueueItem {\n planId: string;\n title: string;\n before: { body: string; phases: PhaseItem[] };\n}\n"],"names":["PLAN_STATUSES","PLAN_KINDS","AGENT_IDS","AGENT_LABELS","AGENT_OPTIONS","coerceAgentConfig","v","toAgent","a","obj","DEFAULT_AGENTS","agentConfigsEqual","b","TOOLBAR_SEGMENT_IDS"],"mappings":"AAEO,MAAMA,IAA8B;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GASaC,IAAyB,CAAC,QAAQ,OAAO,SAAS,QAAQ,UAAU,GAEpEC,IAAY,CAAC,eAAe,UAAU,GAItCC,IAAwC;AAAA,EACnD,eAAe;AAAA,EACf,UAAU;AACZ,GAqdaC,IAAyD;AAAA,EACpE,eAAe;AAAA,IACb,OAAO,CAAC,QAAQ,UAAU,SAAS,OAAO;AAAA,IAC1C,QAAQ,CAAC,OAAO,UAAU,QAAQ,SAAS,KAAK;AAAA,EAAA;AAAA,EAElD,UAAU;AAAA,IACR,OAAO;AAAA,EAAA;AAEX;AAEO,SAASC,EAAkBC,GAAyB;AACzD,QAAMC,IAAU,CAACC,MACfN,EAAU,SAASM,CAAY,IAAKA,IAAgB;AACtD,MAAI,OAAOF,KAAM,SAAU,QAAO,EAAE,OAAOC,EAAQD,CAAC,EAAA;AAEpD,QAAMG,IAAOH,KAAK,CAAA;AAClB,SAAO;AAAA,IACL,OAAOC,EAAQE,EAAI,KAAK;AAAA,IACxB,GAAI,OAAOA,EAAI,SAAU,YAAY,EAAE,OAAOA,EAAI,MAAA;AAAA,IAClD,GAAI,OAAOA,EAAI,UAAW,YAAY,EAAE,QAAQA,EAAI,OAAA;AAAA,EAAO;AAE/D;AAWO,MAAMC,IAAmC;AAAA,EAC9C,OAAO,EAAE,OAAO,WAAA;AAAA,EAChB,WAAW,EAAE,OAAO,cAAA;AAAA,EACpB,YAAY,EAAE,OAAO,cAAA;AAAA,EACrB,eAAe,EAAE,OAAO,cAAA;AAAA,EACxB,UAAU,EAAE,OAAO,eAAe,OAAO,UAAU,QAAQ,SAAA;AAAA,EAC3D,YAAY,EAAE,OAAO,eAAe,OAAO,QAAQ,QAAQ,OAAA;AAC7D;AAGO,SAASC,EAAkBH,GAAgBI,GAAyB;AACzE,SAAOJ,EAAE,UAAUI,EAAE,UAAUJ,EAAE,SAAS,SAASI,EAAE,SAAS;AAChE;AAGO,MAAMC,IAAsB,CAAC,SAAS,SAAS,MAAM;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dendelion/paper-camp",
3
- "version": "0.18.1",
3
+ "version": "0.19.0",
4
4
  "description": "Local-first, AI-native project management with retro aesthetics",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.12.1",
@@ -1,4 +0,0 @@
1
- import{u as g,m as L,r as c,C as O,j as e,F as P,v as T,J as y,G as M,H as B,a as D,z as F,P as k,I as U,K as $,M as A,g as w,S as N,L as q,R as _,N as V,O as H,i as z,Q as G,T as J,U as K,p as I}from"./main-AfQrNPNu.js";import{V as xe}from"./main-AfQrNPNu.js";const C="__no-subject__",Q=({horizonTitle:s,item:t,candidateName:o,onClose:d,onPromoted:a})=>{const m=g(x=>x.promoteRoadmapItem),i=g(x=>x.launchIdeaExtend),{subjects:b,available:j}=L(),[u,h]=c.useState(C),[f,n]=c.useState(!1),[p,v]=c.useState(null),{toast:l}=O();c.useEffect(()=>{t&&(h(o?t.name:C),n(!1),v(null))},[t,o]);const r=async()=>{if(!(!t||!s)){n(!0),v(null);try{const x=await m(s,t,u===C?void 0:u,o??void 0),S=g.getState().ideaEntries.find(R=>R.id===x);if(S)try{await i(x,M(S,s))}catch(R){l({title:"Idea created, but the refine agent failed to launch",description:B(R.message),variant:"error"})}a(),d()}catch(x){v(x.message)}finally{n(!1)}}};return e.jsx(P,{open:t!==null,onClose:d,title:o??(t==null?void 0:t.name)??"",size:"small",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[!o&&e.jsx("p",{className:"m-0 opacity-80",children:t==null?void 0:t.description}),e.jsx("div",{children:e.jsx(T,{size:"small",value:u,onChange:h,disabled:f||!j,options:[{value:C,label:"No subject"},...!j&&u!==C?[{value:u,label:u}]:[],...b.map(x=>({value:x,label:x}))]})}),p&&e.jsx("p",{className:"m-0 text-watercolor-rose-dark text-sm",children:p}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(y,{type:"button",variant:"ghost",onClick:d,disabled:f,children:"Cancel"}),e.jsx(y,{type:"button",variant:"primary",onClick:r,disabled:f,children:f?"Promoting…":"Promote to idea"})]})]})})},W=s=>({shipped:s.filter(t=>t.status==="done").length,queued:s.filter(t=>t.status!=="done"&&t.status!=="dropped").length}),Z="font-handwritten text-md font-semibold opacity-70 leading-none pt-2 px-1 pb-0",X=({size:s=14})=>e.jsx("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})}),Y=({name:s,onPromote:t})=>e.jsx(_,{size:"small",texture:"kraft",className:"plan-row-card",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex-1",children:s}),e.jsx(y,{type:"button",variant:"ghost",size:"small",onClick:t,children:"Promote to idea"})]})}),ee=({onAdd:s})=>{const[t,o]=c.useState(""),[d,a]=c.useState(!1),m=async()=>{if(t.trim()){a(!0);try{await s(t.trim()),o("")}finally{a(!1)}}};return e.jsxs("div",{className:"flex gap-2",children:[e.jsx(z,{size:"small",value:t,onChange:i=>o(i.target.value),onKeyDown:i=>{i.key==="Enter"&&m()},placeholder:"Add option…",disabled:d,className:"flex-1"}),e.jsx(y,{type:"button",variant:"ghost",size:"small",onClick:m,disabled:d||!t.trim(),children:"Add"})]})},se=(s,t)=>{const o=new Set,d=t.map(a=>(a.id&&o.add(a.id),a.idea&&o.add(a.idea),{key:a.title,label:a.title,status:a.status,pr:a.pr,planId:a.id,planTitle:a.title}));for(const a of s)o.has(a.id)||d.push({key:a.id,label:a.id,status:a.status,pr:a.pr});return d},te=({idea:s,onOpen:t})=>e.jsx(_,{size:"small",texture:"kraft",className:"plan-row-card",children:e.jsxs("div",{className:"flex items-center gap-3",children:[t?e.jsx("button",{type:"button",onClick:t,className:"flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap bg-transparent border-none p-0 cursor-pointer [font:inherit] text-inherit text-left",children:s.label}):e.jsx("span",{className:"flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:s.label}),s.pr&&e.jsx(V,{pr:s.pr}),e.jsx(w,{size:"small",fillColor:N[s.status].fill,textColor:N[s.status].text,children:H[s.status]})]})}),ae=({done:s,total:t})=>{const o=t>0?Math.round(s/t*100):0;return e.jsx("div",{className:"w-24 h-1.5 rounded-full bg-black/[0.08] overflow-hidden shrink-0",children:e.jsx("div",{className:`h-full rounded-full ${t>0?"bg-watercolor-green":"bg-transparent"}`,style:{width:`${o}%`}})})},ne=({item:s,graduated:t,highlighted:o,onPromote:d,onPromoteCandidate:a,onAddCandidate:m,onOpenGraduated:i})=>{const[b,j]=c.useState(o),{shipped:u,queued:h}=W(t),f=s.candidates.length,n=se(s.links,t);return c.useEffect(()=>{o&&j(!0)},[o]),e.jsxs("div",{className:`border-b border-black/10 last:border-b-0 ${o?"roadmap-item-highlighted outline outline-2 outline-offset-[-2px] outline-[rgba(200,154,90,0.5)]":""}`,children:[e.jsxs("button",{type:"button","aria-expanded":b,onClick:()=>j(p=>!p),className:"flex w-full items-center gap-3 py-2.5 px-0 bg-transparent border-none cursor-pointer text-left [font:inherit] text-inherit",children:[e.jsx("span",{className:`inline-flex items-center opacity-50 shrink-0 ${b?"rotate-90":""}`,children:e.jsx(X,{})}),e.jsx("span",{className:"font-semibold flex-1 min-w-0 truncate",children:s.name}),e.jsx(ae,{done:s.rollup.done,total:s.rollup.total}),h>0&&e.jsxs(w,{size:"small",fillColor:N.planned.fill,textColor:N.planned.text,children:[h," in queue"]}),u>0&&e.jsxs(w,{size:"small",fillColor:N.done.fill,textColor:N.done.text,children:[u," shipped"]}),f>0&&e.jsxs(w,{size:"small",fillColor:"rgba(0, 0, 0, 0.06)",textColor:"rgba(0, 0, 0, 0.55)",children:[f," candidate",f===1?"":"s"]})]}),b&&e.jsxs("div",{className:"flex flex-col gap-1 pl-6 pb-4",children:[e.jsx("span",{className:"text-sm opacity-70",children:s.description}),n.map(p=>e.jsx(te,{idea:p,onOpen:p.planTitle?()=>i(p.planId,p.planTitle):void 0},p.key)),s.candidates.map(p=>e.jsx(Y,{name:p,onPromote:()=>a(p)},p)),e.jsx(ee,{onAdd:m}),e.jsx(y,{type:"button",variant:"ghost",size:"small",onClick:d,className:"self-start",children:"Promote to idea"})]})]})},le=({goal:s})=>{const[t,o]=c.useState(!1),[d,...a]=s.split(/\n{2,}/),m=a.length>0;return e.jsxs("div",{className:"mb-6 pb-4 border-b border-black/[8%]",children:[e.jsx("span",{className:"font-handwritten text-xs font-semibold opacity-[0.55]",children:"The goal"}),e.jsxs("div",{className:"text-sm leading-relaxed opacity-80 mt-2",children:[e.jsx(A,{children:d}),t&&m&&e.jsx(A,{children:a.join(`
2
-
3
- `)})]}),m&&e.jsx("button",{type:"button",onClick:()=>o(i=>!i),className:"bg-transparent border-none p-0 mt-2 cursor-pointer text-2xs opacity-[0.65] underline",children:t?"Show less":"Show more"})]})},de=()=>{const s=g(l=>l.roadmap),t=g(l=>l.roadmapError),o=g(l=>l.loadRoadmap),d=g(l=>l.roadmapFilters),[a,m]=c.useState(null),i=g(l=>l.plans),b=D(),{item:j}=F({from:"/roadmap"}),u=c.useRef(null);if(c.useEffect(()=>{o()},[o]),c.useEffect(()=>{var r;if(!j||!s)return;const l=(r=u.current)==null?void 0:r.querySelector(".roadmap-item-highlighted");l==null||l.scrollIntoView({behavior:"smooth",block:"center"})},[j,s]),t)return e.jsxs("div",{children:[e.jsx(k,{children:"Roadmap"}),e.jsx("p",{className:"opacity-50",children:"Couldn't load the roadmap — the server may need a restart to pick up new routes."})]});if(!s)return e.jsxs("div",{children:[e.jsx(k,{children:"Roadmap"}),e.jsx("p",{className:"opacity-50",children:"Loading…"})]});if(s.horizons.length===0)return e.jsxs("div",{children:[e.jsx(k,{children:"Roadmap"}),e.jsx("p",{className:"opacity-50",children:"No `ROADMAP.md` found at the project root."})]});const h=l=>(i==null?void 0:i.entries.filter(r=>r.subject===l.name))??[],f=async(l,r,x)=>{await q(l,r,x),await o()},n=U(s,d),p=n.reduce((l,r)=>l+r.items.length,0),v=d.horizons.length>0||d.statuses.length>0;return e.jsxs("div",{ref:u,children:[e.jsx(k,{children:"Roadmap"}),e.jsx(le,{goal:s.goal}),p===0?e.jsx("p",{className:"opacity-50 py-6 px-0 text-center",children:v?"Nothing matches these filters — clear one from the sidebar to see more.":"No roadmap items yet — add one from the sidebar."}):e.jsx("div",{className:"flex flex-col gap-6",children:n.filter(l=>l.items.length>0).map(l=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("div",{className:Z,children:l.title}),e.jsx("div",{className:"flex flex-col",children:l.items.map(r=>e.jsx(ne,{item:r,graduated:h(r),highlighted:r.name===j,onPromote:()=>m({horizonTitle:l.title,item:r}),onPromoteCandidate:x=>m({horizonTitle:l.title,item:r,candidateName:x}),onAddCandidate:x=>f(l.title,r.name,x),onOpenGraduated:(x,S)=>b({to:"/plans/$planId",params:{planId:$(x,S)}})},r.name))})]},l.title))}),e.jsx(Q,{horizonTitle:(a==null?void 0:a.horizonTitle)??null,item:(a==null?void 0:a.item)??null,candidateName:a==null?void 0:a.candidateName,onClose:()=>m(null),onPromoted:o})]})},oe=({open:s,horizonTitles:t,onClose:o})=>{const d=g(r=>r.loadRoadmap),[a,m]=c.useState(t[0]??""),[i,b]=c.useState(""),[j,u]=c.useState(""),[h,f]=c.useState(!1),[n,p]=c.useState(null),v=c.useRef(t);v.current=t,c.useEffect(()=>{s&&(m(v.current[0]??""),b(""),u(""),p(null),f(!1))},[s]);const l=async()=>{if(!(!i.trim()||!a)){f(!0),p(null);try{await G(a,i.trim(),j.trim()),await d(),o()}catch(r){p(r.message)}finally{f(!1)}}};return e.jsx(P,{open:s,onClose:o,title:"Add roadmap item",size:"small",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(T,{size:"small",value:a,onChange:m,disabled:h,options:t.map(r=>({value:r,label:r}))}),e.jsx(z,{size:"small",value:i,onChange:r=>b(r.target.value),placeholder:"Item name…",disabled:h,autoFocus:!0}),e.jsx(z,{size:"small",value:j,onChange:r=>u(r.target.value),onKeyDown:r=>{r.key==="Enter"&&l()},placeholder:"Description…",disabled:h}),n&&e.jsx("p",{className:"m-0 text-watercolor-rose-dark text-sm",children:n}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(y,{type:"button",variant:"ghost",onClick:o,disabled:h,children:"Cancel"}),e.jsx(y,{type:"button",variant:"primary",onClick:l,disabled:h||!i.trim()||!a,children:h?"Adding…":"Add item"})]})]})})},re=["in-progress","review","planned","idea","done","dropped"],E="text-2xs font-semibold tracking-[0.08em] uppercase text-ink-300 mb-2",ce=()=>{const s=g(n=>n.roadmap),t=g(n=>n.roadmapFilters),o=g(n=>n.toggleRoadmapHorizon),d=g(n=>n.toggleRoadmapStatus),[a,m]=c.useState(!1);if(!s)return null;const i=s.horizons.map(n=>n.title),b=J(s,t),j=K(s,t),u=new Set(t.horizons),h=new Set(t.statuses),f=re.filter(n=>(j[n]??0)>0||h.has(n));return e.jsxs("div",{className:"flex flex-col gap-8 -mt-5",children:[e.jsx(y,{type:"button",variant:"primary",size:"small",onClick:()=>m(!0),disabled:i.length===0,children:"+ Add item"}),e.jsxs("div",{children:[e.jsx("div",{className:E,children:"Horizon"}),e.jsx("div",{className:"flex flex-col gap-1",children:i.map(n=>e.jsx(I,{size:"small",active:u.has(n),onClick:()=>o(n),className:"text-xs leading-4 py-2",action:e.jsx("span",{className:"text-2xs text-ink-500",children:b[n]??0}),children:n},n))})]}),e.jsxs("div",{children:[e.jsx("div",{className:E,children:"Status"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[f.length===0&&e.jsx("span",{className:"opacity-50 text-2xs",children:"No linked ideas"}),f.map(n=>e.jsx(I,{size:"small",active:h.has(n),onClick:()=>d(n),className:"text-xs leading-4 py-2",icon:e.jsx("span",{className:"w-[9px] h-[9px] rounded-full shrink-0",style:{background:N[n].text}}),action:e.jsx("span",{className:"text-2xs text-ink-500",children:j[n]??0}),children:H[n]},n))]})]}),e.jsx(oe,{open:a,horizonTitles:i,onClose:()=>m(!1)})]})};export{de as RoadmapPage,ce as RoadmapSidebar,xe as useRoadmapItemNames};
4
- //# sourceMappingURL=index-0_VbynEu.js.map
@@ -1,2 +0,0 @@
1
- import{c as m,r as o,j as e,P as u,W as i,X as h,O as j,Y as r,Z as p,g as d,_ as g,a0 as v,R as N}from"./main-AfQrNPNu.js";import{c}from"./tokens-C3C44lLs.js";const f=async()=>{const s=await fetch(m("/api/stats"));if(!s.ok)throw new Error(`Failed to fetch stats: ${s.status}`);return s.json()},y=["open",...h],T={...j,open:"Open"},b=s=>`${Math.round(s*100)}%`,l=({title:s,children:a})=>e.jsx("div",{className:"flex-[1_1_260px] max-w-[360px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none",children:e.jsx(N,{size:"small",texture:"kraft",className:"h-full",children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"font-handwritten text-xs font-semibold opacity-[0.55]",children:s}),a]})})}),n=({label:s,value:a})=>e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"opacity-70",children:s}),e.jsx("span",{className:"font-semibold",children:a})]}),S=({comments:s})=>e.jsxs(l,{title:"Comment ratio",children:[e.jsx(i,{value:s.ratio*100,color:c.accentSlate}),e.jsx(n,{label:"Ratio",value:b(s.ratio)}),e.jsx(n,{label:"Comment lines",value:s.commentLines}),e.jsx(n,{label:"Source lines",value:s.sourceLines})]}),C=({testCoveragePct:s})=>e.jsx(l,{title:"Test coverage",children:s===null?e.jsx("p",{className:"opacity-50 m-0",children:"Run `pnpm test` to generate a coverage report."}):e.jsxs(e.Fragment,{children:[e.jsx(i,{value:s,color:c.accentGreen}),e.jsx(n,{label:"Line coverage",value:`${Math.round(s)}%`})]})}),L=({sourceLines:s,testLines:a})=>e.jsxs(l,{title:"Codebase size",children:[e.jsx(n,{label:"Source lines",value:s}),e.jsx(n,{label:"Test lines",value:a})]}),w=({entitiesByStatus:s})=>e.jsxs(l,{title:"Entities by status",children:[y.filter(a=>s[a]).map(a=>e.jsx(n,{label:T[a],value:s[a]},a)),Object.keys(s).length===0&&e.jsx("p",{className:"opacity-50 m-0",children:"No entities yet."})]}),A=({openQuestions:s,decisions:a})=>e.jsxs(l,{title:"Notes",children:[e.jsx(n,{label:"Open questions",value:s}),e.jsx(n,{label:"Decisions",value:a})]}),M=({tasksPerWeek:s})=>{const a=Math.max(1,...s.map(t=>t.count));return e.jsxs(l,{title:"Tasks per week",children:[s.length===0&&e.jsx("p",{className:"opacity-50 m-0",children:"No tasks run yet."}),s.map(t=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(n,{label:t.week,value:t.count}),e.jsx(i,{value:t.count,max:a,color:c.accentAmber,height:4})]},t.week))]})},E=({usagePerWeek:s})=>{const a=Math.max(1,...s.map(t=>t.agentMinutes));return e.jsxs(l,{title:"Usage per week",children:[s.length===0&&e.jsx("p",{className:"opacity-50 m-0",children:"No usage recorded yet."}),s.map(t=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(n,{label:t.week,value:`${t.agentMinutes}m`}),e.jsx(i,{value:t.agentMinutes,max:a,color:c.accentAmber,height:4}),e.jsxs("span",{className:"text-2xs opacity-50",children:[r(t.inputTokens)," in · ",r(t.outputTokens)," out"]})]},t.week))]})},k=({medianPhaseDurationMs:s})=>e.jsx(l,{title:"Median phase duration",children:s===null?e.jsx("p",{className:"opacity-50 m-0",children:"No phase runs recorded yet."}):e.jsx(n,{label:"Median",value:p(s)})}),_=({mostExpensiveIdeas:s})=>e.jsxs(l,{title:"Most expensive ideas",children:[s.length===0&&e.jsx("p",{className:"opacity-50 m-0",children:"No usage recorded yet."}),s.map(a=>e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx(n,{label:a.planId,value:`${r(a.inputTokens)} in · ${r(a.outputTokens)} out`}),e.jsx("span",{className:"text-2xs opacity-50 truncate",children:a.planTitle})]},a.planId))]}),D={allowed:"success",warning:"warning",rejected:"error"},P=({capacity:s})=>{const[a,t]=o.useState(()=>Date.now());return o.useEffect(()=>{const x=setInterval(()=>t(Date.now()),3e4);return()=>clearInterval(x)},[]),e.jsx(l,{title:"Claude capacity",children:s===null?e.jsx("p",{className:"opacity-50 m-0",children:"No agent run has reported capacity yet."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{size:"small",variant:D[g(s.snapshot.status)],children:s.snapshot.status}),s.snapshot.overage&&e.jsx(d,{size:"small",variant:"warning",children:"overage"})]}),s.snapshot.rateLimitType&&e.jsx(n,{label:"Window",value:s.snapshot.rateLimitType}),s.snapshot.resetsAt!==void 0&&e.jsx(n,{label:"Resets",value:new Date(v(s.snapshot.resetsAt)).toLocaleTimeString()}),e.jsxs("span",{className:"text-2xs opacity-50",children:["as of last agent run,"," ",p(Math.max(0,a-Date.parse(s.capturedAt)))," ago"]})]})})},U=()=>{const[s,a]=o.useState(null),[t,x]=o.useState(!1);return o.useEffect(()=>{f().then(a).catch(()=>x(!0))},[]),e.jsxs("div",{children:[e.jsx(u,{children:"Stats"}),e.jsx("p",{className:"opacity-50 mb-6",children:"A read-only look at project health — every number here is informational, none of them gate anything."}),t&&e.jsx("p",{className:"opacity-50",children:"Couldn't load stats."}),!t&&!s&&e.jsx("p",{className:"opacity-50",children:"Loading…"}),s&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-start gap-2.5",children:[e.jsx(S,{comments:s.comments}),e.jsx(C,{testCoveragePct:s.testCoveragePct}),e.jsx(L,{sourceLines:s.comments.sourceLines,testLines:s.testLines}),e.jsx(w,{entitiesByStatus:s.entitiesByStatus}),e.jsx(A,{openQuestions:s.openQuestions,decisions:s.decisions}),e.jsx(M,{tasksPerWeek:s.tasksPerWeek}),e.jsx(E,{usagePerWeek:s.usagePerWeek}),e.jsx(k,{medianPhaseDurationMs:s.medianPhaseDurationMs}),e.jsx(_,{mostExpensiveIdeas:s.mostExpensiveIdeas}),e.jsx(P,{capacity:s.capacity})]}),e.jsxs("p",{className:"opacity-[0.4] text-2xs mt-6",children:["Generated ",new Date(s.generatedAt).toLocaleString()]})]})]})};export{U as StatsPage};
2
- //# sourceMappingURL=index-Bm61MVP8.js.map
@@ -1,6 +0,0 @@
1
- import{j as e,g as b,a as k,u as r,r as x,a1 as F,a2 as P,a3 as C,a4 as S,w as E,E as y,a5 as $,$ as A,J as v,a6 as D,a7 as I,a8 as z,p as B}from"./main-AfQrNPNu.js";function L(s){if(!s)return[];const t=(s.endsWith(`
2
- `)?s.slice(0,-1):s).split(`
3
- `),i=[];let l=null;for(const n of t){if(n.startsWith("@@ ")){l={header:n,lines:[]},i.push(l);continue}l&&(n.startsWith("+")?l.lines.push({type:"add",text:n.slice(1)}):n.startsWith("-")?l.lines.push({type:"remove",text:n.slice(1)}):l.lines.push({type:"context",text:n.startsWith(" ")?n.slice(1):n}))}return i}function R(s){return s?[{header:"",lines:(s.endsWith(`
4
- `)?s.slice(0,-1):s).split(`
5
- `).map(i=>({type:"add",text:i}))}]:[]}const W={add:"bg-watercolor-green/[18%] text-watercolor-green-dark",remove:"bg-watercolor-rose/[18%] text-watercolor-rose-dark",context:""},T={add:"+",remove:"-",context:" "},G=({additions:s,deletions:t})=>e.jsxs("span",{className:"inline-flex shrink-0 gap-2 font-mono text-2xs",children:[e.jsxs("span",{className:"text-watercolor-green-dark",children:["+",s]}),e.jsxs("span",{className:"text-watercolor-rose-dark",children:["-",t]})]}),H=({entry:s})=>e.jsxs("div",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:[e.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap font-mono text-xs",children:s.renameSource?`${s.renameSource} → ${s.path}`:s.path}),e.jsxs("span",{className:"flex shrink-0 items-center gap-2",children:[s.staged&&e.jsx(b,{size:"small",children:"staged"}),!s.binary&&e.jsx(G,{additions:s.additions,deletions:s.deletions})]})]}),M=({entry:s})=>{if(s.binary)return e.jsx("p",{className:"m-0 opacity-60",children:"Binary file not shown."});if(s.contentKind==="too-large")return e.jsx("p",{className:"m-0 opacity-60",children:"File too large to preview."});const t=s.contentKind==="raw"?R(s.patch):L(s.patch);return t.length===0?s.renameSource?e.jsx("p",{className:"m-0 opacity-60",children:s.additions===0&&s.deletions===0?"Renamed, no content changes.":"Renamed with unrelated content — diff omitted."}):e.jsx("p",{className:"m-0 opacity-60",children:"No changes to preview."}):e.jsx("div",{className:"flex min-w-0 max-w-full flex-col gap-3",children:t.map((i,l)=>e.jsxs("div",{className:"min-w-0 max-w-full",children:[i.header&&e.jsx("div",{className:"mb-1 font-mono text-2xs opacity-50",children:i.header}),e.jsx("pre",{className:"m-0 min-w-0 max-w-full overflow-x-auto font-mono text-2xs",children:i.lines.map((n,c)=>e.jsxs("span",{className:`block ${W[n.type]}`,children:[T[n.type],n.text]},`${n.type}-${c}`))})]},`${i.header}-${l}`))})},q=({entry:s})=>e.jsxs("div",{"data-diff-path":s.path,className:"min-w-0 max-w-full scroll-mt-4",children:[e.jsx("div",{className:"mb-3",children:e.jsx(H,{entry:s})}),e.jsx(M,{entry:s})]}),w=()=>{const s=r(o=>o.gitAhead),t=r(o=>o.gitBranchHygiene),{pushing:i,syncing:l,pulling:n,gitActionBusy:c,handlePush:j,handleSync:p,handlePull:h}=$();return e.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[e.jsx(A,{content:t==="clean-on-main"?"Already on clean main":void 0,children:e.jsx(v,{size:"small",icon:e.jsx(D,{size:14}),disabled:c||t==="clean-on-main",onClick:p,children:l?"Syncing…":"Sync to main"})}),e.jsx(v,{size:"small",icon:e.jsx(I,{size:14}),disabled:c||s===0,onClick:j,children:i?"Pushing…":s>0?`Push (${s})`:"Push"}),e.jsx(v,{size:"small",icon:e.jsx(z,{size:14}),disabled:c,onClick:h,children:n?"Pulling…":"Pull"})]})},V=()=>{const s=k(),t=r(a=>a.diffFiles),i=r(a=>a.diffLoadFailed),l=r(a=>a.loadDiffFiles),n=r(a=>a.setActiveDiffPath),c=x.useRef(null),j=x.useMemo(()=>(t==null?void 0:t.map(a=>a.path))??[],[t]),p=F(void 0,j);x.useEffect(()=>{l()},[l]),x.useEffect(()=>{let a;const d=P(u=>{u.message==="changed"&&(a&&clearTimeout(a),a=setTimeout(l,250))}),m=()=>l();return window.addEventListener("focus",m),()=>{a&&clearTimeout(a),window.removeEventListener("focus",m),d()}},[l]),x.useEffect(()=>{const a=c.current;if(!a)return;const d=Array.from(a.querySelectorAll("[data-diff-path]"));if(d.length===0)return;const m=new Set,u=new IntersectionObserver(g=>{for(const f of g)f.isIntersecting?m.add(f.target):m.delete(f.target);const N=d.find(f=>m.has(f));N&&n(N.dataset.diffPath??null)},{rootMargin:"0px 0px -70% 0px"});for(const g of d)u.observe(g);return()=>u.disconnect()},[t,n]);const h=e.jsx("div",{className:"mb-4",children:e.jsx(y,{items:[{id:"plans",label:"Plans",onClick:()=>s({to:"/"})},{id:"git",label:"Git"}]})}),o="min-h-page";return i?e.jsxs("div",{children:[h,e.jsx(w,{}),e.jsx("div",{className:o,children:e.jsx("p",{className:"opacity-50",children:"Couldn't load the working-tree diff."})})]}):t?e.jsxs("div",{children:[h,e.jsx(w,{}),t.length===0?e.jsx("div",{className:o,children:e.jsx("p",{className:"opacity-50",children:"No changed files."})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-6 flex items-start gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(C,{state:p,filesEmpty:!1})}),e.jsx(S,{state:p,filesEmpty:!1})]}),e.jsx("div",{ref:c,className:`flex min-w-0 flex-col gap-6 ${o}`,children:t.map((a,d)=>e.jsxs(x.Fragment,{children:[d>0&&e.jsx(E,{}),e.jsx(q,{entry:a})]},a.path))})]})]}):e.jsxs("div",{children:[h,e.jsx(w,{}),e.jsx("div",{className:o,children:e.jsx("p",{className:"opacity-50",children:"Loading…"})})]})},J="text-2xs font-semibold tracking-[0.08em] uppercase text-ink-300 mb-2",K=({additions:s,deletions:t})=>e.jsxs("span",{className:"inline-flex gap-2 font-mono text-2xs",children:[e.jsxs("span",{className:"text-watercolor-green-dark",children:["+",s]}),e.jsxs("span",{className:"text-watercolor-rose-dark",children:["-",t]})]}),_=s=>{var t;(t=document.querySelector(`[data-diff-path="${CSS.escape(s)}"]`))==null||t.scrollIntoView({behavior:"smooth",block:"start"})},X=()=>{const s=r(i=>i.diffFiles),t=r(i=>i.activeDiffPath);return!s||s.length===0?null:e.jsx("div",{className:"flex flex-col gap-8 -mt-5",children:e.jsxs("div",{children:[e.jsx("div",{className:J,children:"Changed files"}),e.jsx("div",{className:"flex flex-col gap-1",children:s.map(i=>e.jsx(B,{size:"small",active:i.path===t,onClick:()=>_(i.path),action:e.jsxs("span",{className:"flex items-center gap-2",children:[i.staged&&e.jsx(b,{size:"small",children:"staged"}),!i.binary&&e.jsx(K,{additions:i.additions,deletions:i.deletions})]}),children:e.jsx("span",{className:"block overflow-hidden text-ellipsis whitespace-nowrap font-mono text-2xs",children:i.path})},i.path))})]})})};export{X as GitFileList,V as GitPage};
6
- //# sourceMappingURL=index-CHYyIAaz.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-CHYyIAaz.js","sources":["../../../src/app/utils/parse-diff.ts","../../../src/app/features/git/file-diff-section.tsx","../../../src/app/features/git/git-page.tsx","../../../src/app/features/git/git-file-list.tsx"],"sourcesContent":["export type DiffLineType = 'add' | 'remove' | 'context';\n\nexport interface DiffLine {\n type: DiffLineType;\n text: string;\n}\n\nexport interface DiffHunk {\n header: string;\n lines: DiffLine[];\n}\n\n// Parses a unified diff (git.ts getWorkingDiff, contentKind: 'diff'). A real diff\n// with no hunks (pure rename, mode-only change) is just the preamble, so it yields [].\nexport function parsePatch(patch: string): DiffHunk[] {\n if (!patch) return [];\n const lines = (patch.endsWith('\\n') ? patch.slice(0, -1) : patch).split('\\n');\n\n const hunks: DiffHunk[] = [];\n let current: DiffHunk | null = null;\n for (const line of lines) {\n if (line.startsWith('@@ ')) {\n current = { header: line, lines: [] };\n hunks.push(current);\n continue;\n }\n if (!current) continue; // preamble: diff --git / index / --- / +++\n if (line.startsWith('+')) current.lines.push({ type: 'add', text: line.slice(1) });\n else if (line.startsWith('-')) current.lines.push({ type: 'remove', text: line.slice(1) });\n else current.lines.push({ type: 'context', text: line.startsWith(' ') ? line.slice(1) : line });\n }\n return hunks;\n}\n\n// Untracked files store raw content, not a diff (git.ts getWorkingDiff, contentKind:\n// 'raw') — synthesize a single all-added hunk so the renderer only has one shape to draw.\nexport function rawContentHunks(content: string): DiffHunk[] {\n if (!content) return [];\n const lines = (content.endsWith('\\n') ? content.slice(0, -1) : content).split('\\n');\n return [{ header: '', lines: lines.map((text) => ({ type: 'add', text })) }];\n}\n","import { type DiffLineType, parsePatch, rawContentHunks } from '@/app/utils/parse-diff';\nimport type { FileDiffEntry } from '@/types/index';\nimport { Stamp } from '@dendelion/paper-ui';\n\nconst LINE_CLASS: Record<DiffLineType, string> = {\n add: 'bg-watercolor-green/[18%] text-watercolor-green-dark',\n remove: 'bg-watercolor-rose/[18%] text-watercolor-rose-dark',\n context: '',\n};\n\nconst LINE_PREFIX: Record<DiffLineType, string> = { add: '+', remove: '-', context: ' ' };\n\ninterface CountBadgeProps {\n additions: number;\n deletions: number;\n}\n\nconst CountBadge = ({ additions, deletions }: CountBadgeProps) => (\n <span className=\"inline-flex shrink-0 gap-2 font-mono text-2xs\">\n <span className=\"text-watercolor-green-dark\">+{additions}</span>\n <span className=\"text-watercolor-rose-dark\">-{deletions}</span>\n </span>\n);\n\ninterface FileHeaderProps {\n entry: FileDiffEntry;\n}\n\nconst FileHeader = ({ entry }: FileHeaderProps) => (\n <div className=\"flex w-full min-w-0 items-center justify-between gap-3\">\n <span className=\"overflow-hidden text-ellipsis whitespace-nowrap font-mono text-xs\">\n {entry.renameSource ? `${entry.renameSource} → ${entry.path}` : entry.path}\n </span>\n <span className=\"flex shrink-0 items-center gap-2\">\n {entry.staged && <Stamp size=\"small\">staged</Stamp>}\n {!entry.binary && <CountBadge additions={entry.additions} deletions={entry.deletions} />}\n </span>\n </div>\n);\n\ninterface DiffBodyProps {\n entry: FileDiffEntry;\n}\n\nconst DiffBody = ({ entry }: DiffBodyProps) => {\n if (entry.binary) {\n return <p className=\"m-0 opacity-60\">Binary file not shown.</p>;\n }\n if (entry.contentKind === 'too-large') {\n return <p className=\"m-0 opacity-60\">File too large to preview.</p>;\n }\n const hunks =\n entry.contentKind === 'raw' ? rawContentHunks(entry.patch) : parsePatch(entry.patch);\n if (hunks.length === 0) {\n if (entry.renameSource) {\n return (\n <p className=\"m-0 opacity-60\">\n {entry.additions === 0 && entry.deletions === 0\n ? 'Renamed, no content changes.'\n : 'Renamed with unrelated content — diff omitted.'}\n </p>\n );\n }\n return <p className=\"m-0 opacity-60\">No changes to preview.</p>;\n }\n return (\n <div className=\"flex min-w-0 max-w-full flex-col gap-3\">\n {hunks.map((hunk, i) => (\n <div key={`${hunk.header}-${i}`} className=\"min-w-0 max-w-full\">\n {hunk.header && <div className=\"mb-1 font-mono text-2xs opacity-50\">{hunk.header}</div>}\n {/* paper-ui's CodeBlock has no per-line add/remove styling. */}\n <pre className=\"m-0 min-w-0 max-w-full overflow-x-auto font-mono text-2xs\">\n {hunk.lines.map((line, j) => (\n <span key={`${line.type}-${j}`} className={`block ${LINE_CLASS[line.type]}`}>\n {LINE_PREFIX[line.type]}\n {line.text}\n </span>\n ))}\n </pre>\n </div>\n ))}\n </div>\n );\n};\n\ninterface FileDiffSectionProps {\n entry: FileDiffEntry;\n}\n\nexport const FileDiffSection = ({ entry }: FileDiffSectionProps) => (\n <div data-diff-path={entry.path} className=\"min-w-0 max-w-full scroll-mt-4\">\n <div className=\"mb-3\">\n <FileHeader entry={entry} />\n </div>\n <DiffBody entry={entry} />\n </div>\n);\n","import { MergeIcon, PullIcon, PushIcon } from '@/app/components/icons';\nimport { FileDiffSection } from '@/app/features/git/file-diff-section';\nimport {\n DeliverCommitButton,\n DeliverCommitInputRow,\n useDeliverCommitForm,\n} from '@/app/features/plans/components/deliver-controls';\nimport { useBranchSync } from '@/app/hooks/use-branch-sync';\nimport { subscribeToActivityStream } from '@/app/services/activity-stream';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { Breadcrumb, Button, Divider, Tooltip } from '@dendelion/paper-ui';\nimport { useNavigate } from '@tanstack/react-router';\nimport { Fragment, useEffect, useMemo, useRef } from 'react';\n\nconst GitActionsRow = () => {\n const gitAhead = useAppStore((s) => s.gitAhead);\n const gitBranchHygiene = useAppStore((s) => s.gitBranchHygiene);\n const { pushing, syncing, pulling, gitActionBusy, handlePush, handleSync, handlePull } =\n useBranchSync();\n\n return (\n <div className=\"mb-4 flex items-center gap-2\">\n <Tooltip content={gitBranchHygiene === 'clean-on-main' ? 'Already on clean main' : undefined}>\n <Button\n size=\"small\"\n icon={<MergeIcon size={14} />}\n disabled={gitActionBusy || gitBranchHygiene === 'clean-on-main'}\n onClick={handleSync}\n >\n {syncing ? 'Syncing…' : 'Sync to main'}\n </Button>\n </Tooltip>\n <Button\n size=\"small\"\n icon={<PushIcon size={14} />}\n disabled={gitActionBusy || gitAhead === 0}\n onClick={handlePush}\n >\n {pushing ? 'Pushing…' : gitAhead > 0 ? `Push (${gitAhead})` : 'Push'}\n </Button>\n <Button\n size=\"small\"\n icon={<PullIcon size={14} />}\n disabled={gitActionBusy}\n onClick={handlePull}\n >\n {pulling ? 'Pulling…' : 'Pull'}\n </Button>\n </div>\n );\n};\n\nexport const GitPage = () => {\n const navigate = useNavigate();\n const files = useAppStore((s) => s.diffFiles);\n const loadFailed = useAppStore((s) => s.diffLoadFailed);\n const loadDiffFiles = useAppStore((s) => s.loadDiffFiles);\n const setActiveDiffPath = useAppStore((s) => s.setActiveDiffPath);\n const sectionsRef = useRef<HTMLDivElement>(null);\n const commitFiles = useMemo(() => files?.map((entry) => entry.path) ?? [], [files]);\n const commitForm = useDeliverCommitForm(undefined, commitFiles);\n\n useEffect(() => {\n loadDiffFiles();\n }, [loadDiffFiles]);\n\n useEffect(() => {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const unsubscribe = subscribeToActivityStream((payload) => {\n if (payload.message !== 'changed') return;\n if (timer) clearTimeout(timer);\n timer = setTimeout(loadDiffFiles, 250);\n });\n const onFocus = () => loadDiffFiles();\n window.addEventListener('focus', onFocus);\n return () => {\n if (timer) clearTimeout(timer);\n window.removeEventListener('focus', onFocus);\n unsubscribe();\n };\n }, [loadDiffFiles]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: files is the trigger to rebuild the observer, not a value read in the body.\n useEffect(() => {\n const root = sectionsRef.current;\n if (!root) return;\n const sections = Array.from(root.querySelectorAll<HTMLElement>('[data-diff-path]'));\n if (sections.length === 0) return;\n const visible = new Set<HTMLElement>();\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n if (entry.isIntersecting) visible.add(entry.target as HTMLElement);\n else visible.delete(entry.target as HTMLElement);\n }\n const topmost = sections.find((el) => visible.has(el));\n if (topmost) setActiveDiffPath(topmost.dataset.diffPath ?? null);\n },\n { rootMargin: '0px 0px -70% 0px' },\n );\n for (const el of sections) observer.observe(el);\n return () => observer.disconnect();\n }, [files, setActiveDiffPath]);\n\n const breadcrumb = (\n <div className=\"mb-4\">\n <Breadcrumb\n items={[\n { id: 'plans', label: 'Plans', onClick: () => navigate({ to: '/' }) },\n { id: 'git', label: 'Git' },\n ]}\n />\n </div>\n );\n\n const contentClass = 'min-h-page';\n\n if (loadFailed) {\n return (\n <div>\n {breadcrumb}\n <GitActionsRow />\n <div className={contentClass}>\n <p className=\"opacity-50\">Couldn't load the working-tree diff.</p>\n </div>\n </div>\n );\n }\n\n if (!files) {\n return (\n <div>\n {breadcrumb}\n <GitActionsRow />\n <div className={contentClass}>\n <p className=\"opacity-50\">Loading…</p>\n </div>\n </div>\n );\n }\n\n return (\n <div>\n {breadcrumb}\n <GitActionsRow />\n {files.length === 0 ? (\n <div className={contentClass}>\n <p className=\"opacity-50\">No changed files.</p>\n </div>\n ) : (\n <>\n <div className=\"mb-6 flex items-start gap-2\">\n <div className=\"flex-1\">\n <DeliverCommitInputRow state={commitForm} filesEmpty={false} />\n </div>\n <DeliverCommitButton state={commitForm} filesEmpty={false} />\n </div>\n <div ref={sectionsRef} className={`flex min-w-0 flex-col gap-6 ${contentClass}`}>\n {files.map((entry, idx) => (\n <Fragment key={entry.path}>\n {idx > 0 && <Divider />}\n <FileDiffSection entry={entry} />\n </Fragment>\n ))}\n </div>\n </>\n )}\n </div>\n );\n};\n","import { useAppStore } from '@/app/stores/app-store';\nimport { ListItem, Stamp } from '@dendelion/paper-ui';\n\nconst sectionLabelClass = 'text-2xs font-semibold tracking-[0.08em] uppercase text-ink-300 mb-2';\n\ninterface CountBadgeProps {\n additions: number;\n deletions: number;\n}\n\nconst CountBadge = ({ additions, deletions }: CountBadgeProps) => (\n <span className=\"inline-flex gap-2 font-mono text-2xs\">\n <span className=\"text-watercolor-green-dark\">+{additions}</span>\n <span className=\"text-watercolor-rose-dark\">-{deletions}</span>\n </span>\n);\n\nconst scrollToFile = (path: string) => {\n document\n .querySelector(`[data-diff-path=\"${CSS.escape(path)}\"]`)\n ?.scrollIntoView({ behavior: 'smooth', block: 'start' });\n};\n\nexport const GitFileList = () => {\n const files = useAppStore((s) => s.diffFiles);\n const activePath = useAppStore((s) => s.activeDiffPath);\n\n if (!files || files.length === 0) return null;\n\n return (\n <div className=\"flex flex-col gap-8 -mt-5\">\n <div>\n <div className={sectionLabelClass}>Changed files</div>\n <div className=\"flex flex-col gap-1\">\n {files.map((entry) => (\n <ListItem\n key={entry.path}\n size=\"small\"\n active={entry.path === activePath}\n onClick={() => scrollToFile(entry.path)}\n action={\n <span className=\"flex items-center gap-2\">\n {entry.staged && <Stamp size=\"small\">staged</Stamp>}\n {!entry.binary && (\n <CountBadge additions={entry.additions} deletions={entry.deletions} />\n )}\n </span>\n }\n >\n <span className=\"block overflow-hidden text-ellipsis whitespace-nowrap font-mono text-2xs\">\n {entry.path}\n </span>\n </ListItem>\n ))}\n </div>\n </div>\n </div>\n );\n};\n"],"names":["parsePatch","patch","lines","hunks","current","line","rawContentHunks","content","text","LINE_CLASS","LINE_PREFIX","CountBadge","additions","deletions","jsxs","FileHeader","entry","jsx","Stamp","DiffBody","hunk","i","j","FileDiffSection","GitActionsRow","gitAhead","useAppStore","s","gitBranchHygiene","pushing","syncing","pulling","gitActionBusy","handlePush","handleSync","handlePull","useBranchSync","Tooltip","Button","MergeIcon","PushIcon","PullIcon","GitPage","navigate","useNavigate","files","loadFailed","loadDiffFiles","setActiveDiffPath","sectionsRef","useRef","commitFiles","useMemo","commitForm","useDeliverCommitForm","useEffect","timer","unsubscribe","subscribeToActivityStream","payload","onFocus","root","sections","visible","observer","entries","topmost","el","breadcrumb","Breadcrumb","contentClass","Fragment","DeliverCommitInputRow","DeliverCommitButton","idx","Divider","sectionLabelClass","scrollToFile","path","_a","GitFileList","activePath","ListItem"],"mappings":"sKAcO,SAASA,EAAWC,EAA2B,CACpD,GAAI,CAACA,EAAO,MAAO,CAAA,EACnB,MAAMC,GAASD,EAAM,SAAS;AAAA,CAAI,EAAIA,EAAM,MAAM,EAAG,EAAE,EAAIA,GAAO,MAAM;AAAA,CAAI,EAEtEE,EAAoB,CAAA,EAC1B,IAAIC,EAA2B,KAC/B,UAAWC,KAAQH,EAAO,CACxB,GAAIG,EAAK,W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M,IAAI,EACtC,OACEF,EAAAA,KAAC,OAAA,CAAK,UAAU,0BACb,SAAA,CAAAE,EAAM,QAAUC,EAAAA,IAACC,EAAA,CAAM,KAAK,QAAQ,SAAA,SAAM,EAC1C,CAACF,EAAM,QACNC,EAAAA,IAACN,EAAA,CAAW,UAAWK,EAAM,UAAW,UAAWA,EAAM,SAAA,CAAW,CAAA,EAExE,EAGF,SAAAC,EAAAA,IAAC,OAAA,CAAK,UAAU,2EACb,WAAM,IAAA,CACT,CAAA,EAfKD,EAAM,IAAA,CAiBd,CAAA,CACH,CAAA,CAAA,CACF,CAAA,CACF,CAEJ"}
@@ -1,2 +0,0 @@
1
- import{c as K,r as d,C as _,j as e,e as z,g as P,R as F,J as f,w as v,h as $,k as X,$ as te,l as ae,s as R,u as T,t as Q,m as ne,a as Z,n as ee,P as le,o as ie,i as G,D,q as oe,A as O,v as q,x as re,y as ce,p as L}from"./main-AfQrNPNu.js";import{c as de}from"./tokens-C3C44lLs.js";import{S as V}from"./sidebar-section-AupYBPL3.js";const me=async()=>{try{const s=await fetch(K("/api/merge-policy"));return s.ok?await s.json():null}catch{return null}},pe=async()=>{try{const s=await fetch(K("/api/merge-policy/apply"),{method:"POST"});return s.ok?await s.json():null}catch{return null}},se={allowSquashMerge:!0,allowMergeCommit:!1,allowRebaseMerge:!1,squashMergeCommitTitle:"PR_TITLE",squashMergeCommitMessage:"PR_BODY"},B=[{key:"allowSquashMerge",label:"Allow squash merge"},{key:"allowMergeCommit",label:"Allow merge commit"},{key:"allowRebaseMerge",label:"Allow rebase merge"},{key:"squashMergeCommitTitle",label:"Squash commit title"},{key:"squashMergeCommitMessage",label:"Squash commit message"}];function W(s){return typeof s=="boolean"?s?"Yes":"No":s}function he(s){return B.every(t=>s[t.key]===se[t.key])}const ue=({label:s,current:t,recommended:r,isLast:l})=>{const p=t===r;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 pb-2 pt-2",children:[e.jsx("span",{className:"flex-1",children:s}),e.jsx("span",{className:p?"opacity-[0.65] font-normal":"font-semibold",children:W(t)}),!p&&e.jsxs("span",{className:"opacity-[0.45]",children:["→ ",W(r)]})]}),!l&&e.jsx(v,{})]})},xe=()=>{const[s,t]=d.useState(void 0),[r,l]=d.useState(!1),{toast:p}=_();d.useEffect(()=>{me().then(t)},[]);const u=async()=>{l(!0);const n=await pe();l(!1),(n==null?void 0:n.status)==="ok"?(t(n),p({title:"Merge policy applied",variant:"success"})):p({title:"Failed to apply merge policy",description:(n==null?void 0:n.status)==="unavailable"?n.reason:void 0,variant:"error"})},h=(s==null?void 0:s.status)==="ok"&&he(s.policy);return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"m-0",children:"Merge Policy"}),e.jsx("p",{className:"opacity-50 mt-1",children:"Paper Camp's canonical policy: squash-only merges, with the commit title and body taken from the PR."})]}),s===void 0&&e.jsx("p",{children:"Loading…"}),s===null&&e.jsx(z,{variant:"warning",children:"Failed to load merge policy."}),(s==null?void 0:s.status)==="unavailable"&&e.jsx(z,{variant:"warning",children:s.reason}),(s==null?void 0:s.status)==="ok"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("span",{className:"font-medium",children:s.repo}),e.jsx(P,{size:"small",fillColor:h?"rgba(143, 185, 150, 0.25)":"rgba(212, 163, 115, 0.25)",textColor:h?"#5E8A66":"#A67B4F",children:h?"Matches recommended policy":"Differs from recommended policy"})]}),e.jsx(F,{size:"small",texture:"kraft",children:B.map((n,c)=>e.jsx(ue,{label:n.label,current:s.policy[n.key],recommended:se[n.key],isLast:c===B.length-1},n.key))}),e.jsx("div",{className:"mt-4",children:e.jsx(f,{size:"small",onClick:u,disabled:r||h,children:r?"Applying…":"Apply recommended policy"})})]})]})},je=2e3,ge="agent:claude-code",fe=["claude auth login","claude setup-token"],be=()=>e.jsxs("div",{className:"mt-2 flex flex-col gap-2",children:[e.jsx("p",{className:"opacity-[0.65] text-sm m-0",children:"The in-app relay couldn't complete. Run one of these in a terminal instead:"}),fe.map(s=>e.jsx(Q,{code:s},s)),e.jsxs("p",{className:"opacity-50 text-sm m-0",children:["Alternatively, set ",e.jsx("code",{children:"ANTHROPIC_API_KEY"})," in the server's environment — that bills as API usage rather than your Max subscription, so treat it as a fallback, not the default."]})]}),ve=({onSignedIn:s})=>{const t=T(c=>c.loginRelay),r=T(c=>c.startLoginRelay),l=T(c=>c.loadLoginRelayStatus),p=T(c=>c.cancelLoginRelay),{toast:u}=_(),h=d.useRef(null),n=t==null?void 0:t.phase;return d.useEffect(()=>{if(n!=="starting"&&n!=="awaiting-authorization")return;const c=window.setInterval(()=>l(),je);return()=>window.clearInterval(c)},[n,l]),d.useEffect(()=>{const c=t==null?void 0:t.authorizeUrl;n!=="awaiting-authorization"||!c||h.current===c||(h.current=c,window.open(c,"_blank","noopener,noreferrer"))},[n,t==null?void 0:t.authorizeUrl]),d.useEffect(()=>{n==="success"?(u({title:"Signed in",variant:"success"}),s()):n==="error"&&u({title:"Sign-in failed",description:t==null?void 0:t.error,variant:"error"})},[n]),n==="starting"?e.jsx(f,{size:"small",disabled:!0,children:"Starting…"}):n==="awaiting-authorization"?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{size:"small",onClick:()=>(t==null?void 0:t.authorizeUrl)&&window.open(t.authorizeUrl,"_blank","noopener,noreferrer"),children:"Reopen sign-in tab"}),e.jsx(f,{size:"small",onClick:()=>p(),children:"Cancel"})]}):e.jsxs("div",{children:[e.jsx(f,{size:"small",onClick:()=>r(),children:"Sign in"}),n==="error"&&e.jsx(be,{})]})},ye={ok:{fill:"rgba(143, 185, 150, 0.25)",text:"#5E8A66",label:"Ready"},warn:{fill:"rgba(212, 163, 115, 0.25)",text:"#A67B4F",label:"Needs attention"},missing:{fill:"rgba(201, 139, 139, 0.25)",text:"#6E3A3A",label:"Missing"}},Ne=({connection:s,onConnect:t,connecting:r})=>{const{connect:l}=s;return l?l.kind==="command"&&l.runnable?e.jsx(f,{size:"small",onClick:()=>t(s.id),disabled:r,children:r?"Running…":`Run \`${l.command}\``}):l.kind==="command"?e.jsx("div",{className:"mt-2",children:e.jsx(Q,{code:l.command})}):l.kind==="link"?e.jsx(f,{size:"small",onClick:()=>window.open(l.url,"_blank","noopener,noreferrer"),children:l.label}):e.jsx("p",{className:"opacity-[0.65] text-sm mt-2 mx-0 mb-0",children:l.message}):null},Se=({connection:s,isLast:t,onRecheck:r,rechecking:l,onConnect:p,connecting:u})=>{const h=ye[s.status];return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pb-3 pt-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex-1 font-medium",children:s.label}),s.authenticated===!1&&e.jsx(te,{content:"Installed, but not signed in",children:e.jsx(P,{size:"small",variant:"warning",children:"Not signed in"})}),e.jsx(P,{size:"small",fillColor:h.fill,textColor:h.text,children:h.label}),e.jsx(f,{size:"small",onClick:()=>r(s.id),disabled:l,children:l?"Checking…":"Recheck"})]}),e.jsxs("p",{className:"opacity-[0.65] text-sm mt-1 mx-0 mb-0",children:["Unlocks: ",s.unlocks]}),e.jsx("p",{className:"opacity-50 text-sm mt-1 mx-0 mb-0",children:s.detail}),e.jsx("div",{className:"mt-2",children:s.id===ge&&s.authenticated===!1?e.jsx(ve,{onSignedIn:()=>r(s.id)}):e.jsx(Ne,{connection:s,onConnect:p,connecting:u})})]}),!t&&e.jsx(v,{})]})},ke=()=>{const[s,t]=d.useState(null),[r,l]=d.useState(!1),[p,u]=d.useState(null),[h,n]=d.useState(null),[c,S]=d.useState(!1),{toast:y}=_(),N=d.useCallback(i=>{if(i===null){l(!0);return}l(!1),t(i)},[]);d.useEffect(()=>{$().then(N),X().then(i=>S((i==null?void 0:i.setupDismissed)??!1))},[N]);const A=async i=>{u(i),N(await $()),u(null)},m=async i=>{n(i);const b=await ae(i);b?t(C=>(C==null?void 0:C.map(M=>M.id===i?b:M))??C):y({title:"Failed to connect",variant:"error"}),n(null)},x=async()=>{const i=!c,{ok:b}=await R({setupDismissed:i});b?(S(i),y({title:"Saved",variant:"success"})):y({title:"Failed to save",variant:"error"})},k=(s==null?void 0:s.every(i=>i.status==="ok"))??!0;return e.jsxs("div",{children:[e.jsx("div",{className:"mb-6",children:e.jsx("h2",{className:"m-0",children:"Setup"})}),s===null&&!r&&e.jsx("p",{children:"Loading…"}),r&&e.jsx("div",{className:"mb-4",children:e.jsx(z,{variant:"warning",children:"Failed to load connections. Try refreshing."})}),s&&e.jsxs(e.Fragment,{children:[!k&&e.jsx("div",{className:"mb-4",children:e.jsx(z,{variant:"warning",children:"Some connections are incomplete — features that depend on them stay disabled until fixed. Run the connect command below, then recheck."})}),e.jsx(F,{size:"small",texture:"kraft",children:s.map((i,b)=>e.jsx(Se,{connection:i,isLast:b===s.length-1,onRecheck:A,rechecking:p===i.id,onConnect:m,connecting:h===i.id},i.id))}),e.jsx("div",{className:"mt-4",children:e.jsx(f,{size:"small",onClick:x,children:c?"Show Setup on open again":"Don't show Setup on open"})})]})]})},we=()=>{const{subjects:s,loading:t,available:r}=ne(),l=Z();return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"m-0",children:"Subjects"}),e.jsx("p",{className:"opacity-50 mt-1",children:"Subjects are the roadmap's bets and standing concerns. Edit the vocabulary on the Roadmap page."})]}),t&&e.jsx("p",{children:"Loading…"}),!t&&!r&&e.jsx("p",{className:"opacity-60 m-0",children:"Couldn't load subjects — check the server config."}),!t&&r&&e.jsxs(F,{size:"small",texture:"kraft",children:[s.length===0&&e.jsx("p",{className:"opacity-[0.45] m-0 pb-2",children:"No subjects yet."}),s.map((p,u)=>e.jsxs("div",{children:[e.jsx("div",{className:"pb-2 pt-2",children:p}),u<s.length-1&&e.jsx(v,{})]},p)),s.length>0&&e.jsx(v,{}),e.jsx("div",{className:"pt-3",children:e.jsx(f,{size:"small",onClick:()=>l({to:"/roadmap"}),children:"Go to Roadmap"})})]})]})},J=["phase","planDraft","ideaExtend","commitSuggest","feedback"],Ae={phase:"Phase run",planDraft:"Plan draft",ideaExtend:"Idea extend",commitSuggest:"Commit suggest",feedback:"Scout chat"},Ce=140,Ee=160,Ie=110,De=()=>e.jsxs("div",{className:"flex items-center gap-3 pb-1",children:[e.jsx("span",{className:"w-[110px] shrink-0 text-sm opacity-[0.45]",children:"Task"}),e.jsx("span",{className:"w-[140px] shrink-0 text-sm opacity-[0.45]",children:"Agent"}),e.jsx("span",{className:"w-[160px] shrink-0 text-sm opacity-[0.45]",children:"Model"}),e.jsx("span",{className:"w-[110px] shrink-0 text-sm opacity-[0.45]",children:"Effort"})]}),Re=({taskKey:s,agentConfig:t,isLast:r,onSave:l})=>{const p=O[t.agent]??O["claude-code"],u=p.model,h=p.effort,[n,c]=d.useState(t.model??"");d.useEffect(()=>{c(t.model??"")},[t.model]);const S=m=>{var b;const x=m,k=O[x],i={agent:x};t.model&&(k.model===null||(b=k.model)!=null&&b.includes(t.model))&&(i.model=t.model),t.effort&&Array.isArray(k.effort)&&(i.effort=t.effort),l(s,i)},y=m=>{l(s,{...t,model:m||void 0})},N=()=>{l(s,{...t,model:n||void 0})},A=m=>{l(s,{...t,effort:m||void 0})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 pb-2 pt-2",children:[e.jsx("span",{className:"w-[110px] shrink-0 text-sm opacity-[0.65]",children:Ae[s]}),e.jsx(q,{size:"small",width:Ce,value:t.agent,onChange:S,options:re.map(m=>({value:m,label:ce[m]}))}),Array.isArray(u)?e.jsx(q,{size:"small",width:Ee,value:t.model??"",onChange:y,options:[{value:"",label:"Default"},...u.map(m=>({value:m,label:m}))]}):u===null?e.jsx(G,{size:"small",className:"w-[160px]",value:n,placeholder:"Default model",onChange:m=>c(m.target.value),onBlur:N}):null,e.jsx("div",{className:Array.isArray(h)?"visible":"invisible",children:e.jsx(q,{size:"small",width:Ie,value:t.effort??"",onChange:A,options:[{value:"",label:"Default"},...(Array.isArray(h)?h:[]).map(m=>({value:m,label:m}))]})})]}),!r&&e.jsx(v,{})]})},ze=()=>{var Y,H;const s=d.useRef(null),[t,r]=d.useState(void 0),{iconDataUri:l,loading:p}=ie(),[u,h]=d.useState(null),n=u??l,[c,S]=d.useState(!1),[y,N]=d.useState(""),[A,m]=d.useState(""),{toast:x}=_();d.useEffect(()=>{X().then(a=>{r(a),(a==null?void 0:a.port)!==void 0&&N(String(a.port)),(a==null?void 0:a.projectName)!==void 0&&m(a.projectName)})},[]);const k=async(a,g)=>{const o=t==null?void 0:t.defaultAgents,j={phase:(o==null?void 0:o.phase)??D.phase,planDraft:(o==null?void 0:o.planDraft)??D.planDraft,ideaExtend:(o==null?void 0:o.ideaExtend)??D.ideaExtend,commitSuggest:(o==null?void 0:o.commitSuggest)??D.commitSuggest,feedback:(o==null?void 0:o.feedback)??D.feedback,[a]:g},{ok:w,error:E}=await R({defaultAgents:j});w?(r(I=>I&&{...I,defaultAgents:j}),x({title:"Saved",variant:"success"})):x({title:"Failed to save",description:E,variant:"error"})},i=async()=>{const a=Number(y);if(!t||!Number.isInteger(a)||a<=0||a===t.port)return;const{ok:g,error:o}=await R({port:a});g?(r(j=>j&&{...j,port:a}),x({title:"Saved",description:"Restart `paper-camp dev` to apply the new port.",variant:"success"})):x({title:"Failed to save",description:o,variant:"error"})},b=async()=>{var w,E,I;if(!t)return;const a=!(((E=(w=t.integration)==null?void 0:w.toolbar)==null?void 0:E.enabled)??!0),g={...t.integration,toolbar:{...(I=t.integration)==null?void 0:I.toolbar,enabled:a}},{ok:o,error:j}=await R({integration:g});o?(r(U=>U&&{...U,integration:g}),x({title:"Saved",variant:"success"})):x({title:"Failed to save",description:j,variant:"error"})},C=async()=>{const a=A.trim();if(!t||!a||a===t.projectName)return;const{ok:g,error:o}=await R({projectName:a});g?(r(j=>j&&{...j,projectName:a}),m(a),x({title:"Saved",variant:"success"})):x({title:"Failed to save",description:o,variant:"error"})},M=async a=>{var j;const g=(j=a.target.files)==null?void 0:j[0];if(!g)return;S(!0);const o=new FileReader;o.onloadend=async()=>{const w=o.result,E=await oe(w);S(!1),E?(h(w),x({title:"Saved",variant:"success"})):x({title:"Failed to save",variant:"error"})},o.readAsDataURL(g)};return e.jsxs("div",{children:[e.jsx("div",{className:"mb-6",children:e.jsx("h2",{className:"m-0",children:"Project Info"})}),t===void 0&&e.jsx("p",{children:"Loading…"}),t===null&&e.jsxs(z,{variant:"warning",children:["No papercamp/config.json found — run ",e.jsx("code",{children:"paper-camp init"})," in this directory first."]}),t&&e.jsxs(F,{size:"small",texture:"kraft",children:[e.jsxs("div",{className:"flex items-end gap-3 pb-3",children:[e.jsx(G,{value:A,onChange:a=>m(a.target.value),onBlur:C,label:"Project Name"}),e.jsxs(P,{size:"small",fillColor:"rgba(143, 185, 150, 0.25)",textColor:de.accentGreenDark,children:["v",t.version]})]}),e.jsx(v,{}),e.jsxs("div",{className:"flex items-center gap-3 pb-3 pt-3",children:[n&&e.jsx("img",{src:n,alt:"Project icon",className:"w-10 h-10 object-contain shrink-0 rounded"}),e.jsxs("div",{children:[e.jsx("input",{ref:s,type:"file",accept:".svg,.png,.jpg,.jpeg,.gif,.webp",onChange:M,className:"hidden"}),e.jsx(f,{size:"small",onClick:()=>{var a;return(a=s.current)==null?void 0:a.click()},disabled:c,children:c?"Uploading…":"Choose File"}),p&&e.jsx("p",{className:"text-sm opacity-50 mt-1 mx-0 mb-0",children:"Loading…"}),!p&&!n&&!c&&e.jsx("p",{className:"text-sm opacity-[0.45] mt-1 mx-0 mb-0",children:"No icon set."})]})]}),e.jsx(v,{}),e.jsx("div",{className:"flex items-end gap-3 pb-3 pt-3",children:e.jsx(G,{type:"number",value:y,onChange:a=>N(a.target.value),onBlur:i,label:"Port",helperText:"Default for `paper-camp dev`. Restart the server to apply a change."})}),e.jsx(v,{}),e.jsxs("div",{className:"flex items-center justify-between gap-3 pb-3 pt-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"m-0",children:"In-app dev toolbar"}),e.jsx("p",{className:"opacity-[0.45] text-sm mt-1 mx-0 mb-0",children:"Inject the paper-camp toolbar into this project's dev server via the Vite plugin."})]}),e.jsx(f,{size:"small",onClick:b,children:((H=(Y=t.integration)==null?void 0:Y.toolbar)==null?void 0:H.enabled)??!0?"Disable":"Enable"})]}),e.jsx(v,{}),e.jsx(De,{}),J.map((a,g)=>{var o;return e.jsx(Re,{taskKey:a,agentConfig:((o=t.defaultAgents)==null?void 0:o[a])??D[a],isLast:g===J.length-1,onSave:k},a)})]}),e.jsxs("p",{className:"opacity-[0.45] text-sm mt-4",children:[e.jsx("strong",{children:"Initialized:"})," ",t?new Date(t.initializedAt).toLocaleString():"—"]})]})},Pe=()=>{const s=ee();return e.jsxs("div",{children:[e.jsx(le,{children:"Settings"}),s==="subjects"?e.jsx(we,{}):s==="setup"?e.jsx(ke,{}):s==="merge-policy"?e.jsx(xe,{}):e.jsx(ze,{})]})},_e=()=>{const s=ee(),t=Z();return e.jsxs(e.Fragment,{children:[e.jsxs(V,{label:"General",children:[e.jsx(L,{size:"small",active:s===null,onClick:()=>t({to:"/settings"}),children:"Project Info"}),e.jsx(L,{size:"small",active:s==="setup",onClick:()=>t({to:"/settings/$section",params:{section:"setup"}}),children:"Setup"}),e.jsx(L,{size:"small",active:s==="merge-policy",onClick:()=>t({to:"/settings/$section",params:{section:"merge-policy"}}),children:"Merge Policy"})]}),e.jsx(V,{label:"Ideas",children:e.jsx(L,{size:"small",active:s==="subjects",onClick:()=>t({to:"/settings/$section",params:{section:"subjects"}}),children:"Subjects"})})]})};export{Pe as SettingsPage,_e as SettingsSidebar};
2
- //# sourceMappingURL=index-DNRXB82k.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-DNRXB82k.js","sources":["../../../src/app/services/system/merge-policy-api.ts","../../../src/app/features/settings/components/merge-policy-section.tsx","../../../src/app/features/settings/components/setup-section.tsx","../../../src/app/features/settings/components/subjects-section.tsx","../../../src/app/features/settings/settings-page.tsx","../../../src/app/features/settings/components/settings-sidebar.tsx"],"sourcesContent":["import type { MergePolicyResult } from '@/types/index';\nimport { apiUrl } from '../api-base';\n\nexport const fetchMergePolicy = async (): Promise<MergePolicyResult | null> => {\n try {\n const response = await fetch(apiUrl('/api/merge-policy'));\n if (!response.ok) return null;\n return (await response.json()) as MergePolicyResult;\n } catch {\n return null;\n }\n};\n\nexport const applyMergePolicy = async (): Promise<MergePolicyResult | null> => {\n try {\n const response = await fetch(apiUrl('/api/merge-policy/apply'), { method: 'POST' });\n if (!response.ok) return null;\n return (await response.json()) as MergePolicyResult;\n } catch {\n return null;\n }\n};\n","import { applyMergePolicy, fetchMergePolicy } from '@/app/services/system';\nimport type { MergePolicy, MergePolicyResult } from '@/types/index';\nimport { Alert, Button, Card, Divider, Stamp, useToast } from '@dendelion/paper-ui';\nimport { useEffect, useState } from 'react';\n\nconst RECOMMENDED: MergePolicy = {\n allowSquashMerge: true,\n allowMergeCommit: false,\n allowRebaseMerge: false,\n squashMergeCommitTitle: 'PR_TITLE',\n squashMergeCommitMessage: 'PR_BODY',\n};\n\nconst POLICY_ROWS: { key: keyof MergePolicy; label: string }[] = [\n { key: 'allowSquashMerge', label: 'Allow squash merge' },\n { key: 'allowMergeCommit', label: 'Allow merge commit' },\n { key: 'allowRebaseMerge', label: 'Allow rebase merge' },\n { key: 'squashMergeCommitTitle', label: 'Squash commit title' },\n { key: 'squashMergeCommitMessage', label: 'Squash commit message' },\n];\n\nfunction formatValue(value: boolean | string): string {\n return typeof value === 'boolean' ? (value ? 'Yes' : 'No') : value;\n}\n\nfunction matchesRecommended(policy: MergePolicy): boolean {\n return POLICY_ROWS.every((row) => policy[row.key] === RECOMMENDED[row.key]);\n}\n\ninterface PolicyRowProps {\n label: string;\n current: boolean | string;\n recommended: boolean | string;\n isLast: boolean;\n}\n\nconst PolicyRow = ({ label, current, recommended, isLast }: PolicyRowProps) => {\n const matches = current === recommended;\n return (\n <>\n <div className=\"flex items-center gap-3 pb-2 pt-2\">\n <span className=\"flex-1\">{label}</span>\n <span className={matches ? 'opacity-[0.65] font-normal' : 'font-semibold'}>\n {formatValue(current)}\n </span>\n {!matches && <span className=\"opacity-[0.45]\">→ {formatValue(recommended)}</span>}\n </div>\n {!isLast && <Divider />}\n </>\n );\n};\n\nexport const MergePolicySection = () => {\n const [result, setResult] = useState<MergePolicyResult | null | undefined>(undefined);\n const [applying, setApplying] = useState(false);\n const { toast } = useToast();\n\n useEffect(() => {\n fetchMergePolicy().then(setResult);\n }, []);\n\n const handleApply = async () => {\n setApplying(true);\n const applied = await applyMergePolicy();\n setApplying(false);\n if (applied?.status === 'ok') {\n setResult(applied);\n toast({ title: 'Merge policy applied', variant: 'success' });\n } else {\n toast({\n title: 'Failed to apply merge policy',\n description: applied?.status === 'unavailable' ? applied.reason : undefined,\n variant: 'error',\n });\n }\n };\n\n const upToDate = result?.status === 'ok' && matchesRecommended(result.policy);\n\n return (\n <div>\n <div className=\"mb-6\">\n <h2 className=\"m-0\">Merge Policy</h2>\n <p className=\"opacity-50 mt-1\">\n Paper Camp's canonical policy: squash-only merges, with the commit title and body taken\n from the PR.\n </p>\n </div>\n {result === undefined && <p>Loading…</p>}\n {result === null && <Alert variant=\"warning\">Failed to load merge policy.</Alert>}\n {result?.status === 'unavailable' && <Alert variant=\"warning\">{result.reason}</Alert>}\n {result?.status === 'ok' && (\n <>\n <div className=\"flex items-center gap-3 mb-3\">\n <span className=\"font-medium\">{result.repo}</span>\n <Stamp\n size=\"small\"\n fillColor={upToDate ? 'rgba(143, 185, 150, 0.25)' : 'rgba(212, 163, 115, 0.25)'}\n textColor={upToDate ? '#5E8A66' : '#A67B4F'}\n >\n {upToDate ? 'Matches recommended policy' : 'Differs from recommended policy'}\n </Stamp>\n </div>\n <Card size=\"small\" texture=\"kraft\">\n {POLICY_ROWS.map((row, idx) => (\n <PolicyRow\n key={row.key}\n label={row.label}\n current={result.policy[row.key]}\n recommended={RECOMMENDED[row.key]}\n isLast={idx === POLICY_ROWS.length - 1}\n />\n ))}\n </Card>\n <div className=\"mt-4\">\n <Button size=\"small\" onClick={handleApply} disabled={applying || upToDate}>\n {applying ? 'Applying…' : 'Apply recommended policy'}\n </Button>\n </div>\n </>\n )}\n </div>\n );\n};\n","import { connectService, fetchConfig, fetchConnections, saveConfig } from '@/app/services/system';\nimport { useAppStore } from '@/app/stores/app-store';\nimport type { CapabilityStatus, ConnectionResult } from '@/types/index';\nimport {\n Alert,\n Button,\n Card,\n CodeBlock,\n Divider,\n Stamp,\n Tooltip,\n useToast,\n} from '@dendelion/paper-ui';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nconst RELAY_POLL_MS = 2000;\n\n// Only claude-code exposes `auth login`/`auth status` (see agentAuthenticated in server/services.ts).\nconst RELAY_CONNECTION_ID: ConnectionResult['id'] = 'agent:claude-code';\n\n// Same two commands the relay drives interactively — shown as copy-paste fallback\n// when the relay itself can't run (no PTY, offline, unsupported CLI version).\nconst AUTH_FIX_COMMANDS = ['claude auth login', 'claude setup-token'] as const;\n\nconst RelayFallbackGuide = () => (\n <div className=\"mt-2 flex flex-col gap-2\">\n <p className=\"opacity-[0.65] text-sm m-0\">\n The in-app relay couldn't complete. Run one of these in a terminal instead:\n </p>\n {AUTH_FIX_COMMANDS.map((cmd) => (\n <CodeBlock key={cmd} code={cmd} />\n ))}\n <p className=\"opacity-50 text-sm m-0\">\n {/* paper-ui has no inline-code component, only the block-level CodeBlock */}\n Alternatively, set <code>ANTHROPIC_API_KEY</code> in the server's environment — that bills as\n API usage rather than your Max subscription, so treat it as a fallback, not the default.\n </p>\n </div>\n);\n\nconst SignInAction = ({ onSignedIn }: { onSignedIn: () => void }) => {\n const loginRelay = useAppStore((s) => s.loginRelay);\n const startLoginRelay = useAppStore((s) => s.startLoginRelay);\n const loadLoginRelayStatus = useAppStore((s) => s.loadLoginRelayStatus);\n const cancelLoginRelay = useAppStore((s) => s.cancelLoginRelay);\n const { toast } = useToast();\n const openedUrlRef = useRef<string | null>(null);\n const phase = loginRelay?.phase;\n\n useEffect(() => {\n if (phase !== 'starting' && phase !== 'awaiting-authorization') return;\n const id = window.setInterval(() => loadLoginRelayStatus(), RELAY_POLL_MS);\n return () => window.clearInterval(id);\n }, [phase, loadLoginRelayStatus]);\n\n useEffect(() => {\n const url = loginRelay?.authorizeUrl;\n if (phase !== 'awaiting-authorization' || !url || openedUrlRef.current === url) return;\n openedUrlRef.current = url;\n window.open(url, '_blank', 'noopener,noreferrer');\n }, [phase, loginRelay?.authorizeUrl]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: keyed on phase transitions only — toast/onSignedIn aren't stable across renders, and including them would refire on every relay poll\n useEffect(() => {\n if (phase === 'success') {\n toast({ title: 'Signed in', variant: 'success' });\n onSignedIn();\n } else if (phase === 'error') {\n toast({ title: 'Sign-in failed', description: loginRelay?.error, variant: 'error' });\n }\n }, [phase]);\n\n if (phase === 'starting') {\n return (\n <Button size=\"small\" disabled>\n Starting…\n </Button>\n );\n }\n if (phase === 'awaiting-authorization') {\n return (\n <div className=\"flex items-center gap-2\">\n <Button\n size=\"small\"\n onClick={() =>\n loginRelay?.authorizeUrl &&\n window.open(loginRelay.authorizeUrl, '_blank', 'noopener,noreferrer')\n }\n >\n Reopen sign-in tab\n </Button>\n <Button size=\"small\" onClick={() => cancelLoginRelay()}>\n Cancel\n </Button>\n </div>\n );\n }\n return (\n <div>\n <Button size=\"small\" onClick={() => startLoginRelay()}>\n Sign in\n </Button>\n {phase === 'error' && <RelayFallbackGuide />}\n </div>\n );\n};\n\nconst STATUS_STAMP: Record<CapabilityStatus, { fill: string; text: string; label: string }> = {\n ok: { fill: 'rgba(143, 185, 150, 0.25)', text: '#5E8A66', label: 'Ready' },\n warn: { fill: 'rgba(212, 163, 115, 0.25)', text: '#A67B4F', label: 'Needs attention' },\n missing: { fill: 'rgba(201, 139, 139, 0.25)', text: '#6E3A3A', label: 'Missing' },\n};\n\nconst ConnectActionView = ({\n connection,\n onConnect,\n connecting,\n}: {\n connection: ConnectionResult;\n onConnect: (id: string) => void;\n connecting: boolean;\n}) => {\n const { connect } = connection;\n if (!connect) return null;\n if (connect.kind === 'command' && connect.runnable) {\n return (\n <Button size=\"small\" onClick={() => onConnect(connection.id)} disabled={connecting}>\n {connecting ? 'Running…' : `Run \\`${connect.command}\\``}\n </Button>\n );\n }\n if (connect.kind === 'command') {\n return (\n <div className=\"mt-2\">\n <CodeBlock code={connect.command} />\n </div>\n );\n }\n if (connect.kind === 'link') {\n return (\n <Button\n size=\"small\"\n onClick={() => window.open(connect.url, '_blank', 'noopener,noreferrer')}\n >\n {connect.label}\n </Button>\n );\n }\n return <p className=\"opacity-[0.65] text-sm mt-2 mx-0 mb-0\">{connect.message}</p>;\n};\n\nconst ConnectionRow = ({\n connection,\n isLast,\n onRecheck,\n rechecking,\n onConnect,\n connecting,\n}: {\n connection: ConnectionResult;\n isLast: boolean;\n onRecheck: (id: string) => void;\n rechecking: boolean;\n onConnect: (id: string) => void;\n connecting: boolean;\n}) => {\n const stamp = STATUS_STAMP[connection.status];\n return (\n <>\n <div className=\"pb-3 pt-3\">\n <div className=\"flex items-center gap-3\">\n <span className=\"flex-1 font-medium\">{connection.label}</span>\n {connection.authenticated === false && (\n <Tooltip content=\"Installed, but not signed in\">\n <Stamp size=\"small\" variant=\"warning\">\n Not signed in\n </Stamp>\n </Tooltip>\n )}\n <Stamp size=\"small\" fillColor={stamp.fill} textColor={stamp.text}>\n {stamp.label}\n </Stamp>\n <Button size=\"small\" onClick={() => onRecheck(connection.id)} disabled={rechecking}>\n {rechecking ? 'Checking…' : 'Recheck'}\n </Button>\n </div>\n <p className=\"opacity-[0.65] text-sm mt-1 mx-0 mb-0\">Unlocks: {connection.unlocks}</p>\n <p className=\"opacity-50 text-sm mt-1 mx-0 mb-0\">{connection.detail}</p>\n <div className=\"mt-2\">\n {connection.id === RELAY_CONNECTION_ID && connection.authenticated === false ? (\n <SignInAction onSignedIn={() => onRecheck(connection.id)} />\n ) : (\n <ConnectActionView\n connection={connection}\n onConnect={onConnect}\n connecting={connecting}\n />\n )}\n </div>\n </div>\n {!isLast && <Divider />}\n </>\n );\n};\n\nexport const SetupSection = () => {\n const [connections, setConnections] = useState<ConnectionResult[] | null>(null);\n const [loadFailed, setLoadFailed] = useState(false);\n const [reloadingId, setReloadingId] = useState<string | null>(null);\n const [connectingId, setConnectingId] = useState<string | null>(null);\n const [setupDismissed, setSetupDismissed] = useState(false);\n const { toast } = useToast();\n\n const applyConnections = useCallback((result: ConnectionResult[] | null) => {\n if (result === null) {\n setLoadFailed(true);\n return;\n }\n setLoadFailed(false);\n setConnections(result);\n }, []);\n\n useEffect(() => {\n fetchConnections().then(applyConnections);\n fetchConfig().then((c) => setSetupDismissed(c?.setupDismissed ?? false));\n }, [applyConnections]);\n\n const handleRecheck = async (id: string) => {\n setReloadingId(id);\n applyConnections(await fetchConnections());\n setReloadingId(null);\n };\n\n const handleConnect = async (id: string) => {\n setConnectingId(id);\n const updated = await connectService(id);\n if (updated) {\n setConnections((prev) => prev?.map((c) => (c.id === id ? updated : c)) ?? prev);\n } else {\n toast({ title: 'Failed to connect', variant: 'error' });\n }\n setConnectingId(null);\n };\n\n const handleDismissToggle = async () => {\n const next = !setupDismissed;\n const { ok } = await saveConfig({ setupDismissed: next });\n if (ok) {\n setSetupDismissed(next);\n toast({ title: 'Saved', variant: 'success' });\n } else {\n toast({ title: 'Failed to save', variant: 'error' });\n }\n };\n\n const allOk = connections?.every((c) => c.status === 'ok') ?? true;\n\n return (\n <div>\n <div className=\"mb-6\">\n <h2 className=\"m-0\">Setup</h2>\n </div>\n {connections === null && !loadFailed && <p>Loading…</p>}\n {loadFailed && (\n <div className=\"mb-4\">\n <Alert variant=\"warning\">Failed to load connections. Try refreshing.</Alert>\n </div>\n )}\n {connections && (\n <>\n {!allOk && (\n <div className=\"mb-4\">\n <Alert variant=\"warning\">\n Some connections are incomplete — features that depend on them stay disabled until\n fixed. Run the connect command below, then recheck.\n </Alert>\n </div>\n )}\n <Card size=\"small\" texture=\"kraft\">\n {connections.map((c, idx) => (\n <ConnectionRow\n key={c.id}\n connection={c}\n isLast={idx === connections.length - 1}\n onRecheck={handleRecheck}\n rechecking={reloadingId === c.id}\n onConnect={handleConnect}\n connecting={connectingId === c.id}\n />\n ))}\n </Card>\n <div className=\"mt-4\">\n <Button size=\"small\" onClick={handleDismissToggle}>\n {setupDismissed ? 'Show Setup on open again' : \"Don't show Setup on open\"}\n </Button>\n </div>\n </>\n )}\n </div>\n );\n};\n","import { useSubjectVocabulary } from '@/app/hooks';\nimport { Button, Card, Divider } from '@dendelion/paper-ui';\nimport { useNavigate } from '@tanstack/react-router';\n\nexport const SubjectsSection = () => {\n const { subjects, loading, available } = useSubjectVocabulary();\n const navigate = useNavigate();\n\n return (\n <div>\n <div className=\"mb-6\">\n <h2 className=\"m-0\">Subjects</h2>\n <p className=\"opacity-50 mt-1\">\n Subjects are the roadmap's bets and standing concerns. Edit the vocabulary on the Roadmap\n page.\n </p>\n </div>\n {loading && <p>Loading…</p>}\n {!loading && !available && (\n <p className=\"opacity-60 m-0\">Couldn't load subjects — check the server config.</p>\n )}\n {!loading && available && (\n <Card size=\"small\" texture=\"kraft\">\n {subjects.length === 0 && <p className=\"opacity-[0.45] m-0 pb-2\">No subjects yet.</p>}\n {subjects.map((name, idx) => (\n <div key={name}>\n <div className=\"pb-2 pt-2\">{name}</div>\n {idx < subjects.length - 1 && <Divider />}\n </div>\n ))}\n {subjects.length > 0 && <Divider />}\n <div className=\"pt-3\">\n <Button size=\"small\" onClick={() => navigate({ to: '/roadmap' })}>\n Go to Roadmap\n </Button>\n </div>\n </Card>\n )}\n </div>\n );\n};\n","import { PageTitle } from '@/app/components/page-title';\nimport { useActiveSettingsSection, useProjectIdentity } from '@/app/hooks';\nimport { fetchConfig, saveConfig, uploadIcon } from '@/app/services/system';\nimport { color } from '@/app/styles/tokens';\nimport {\n AGENT_IDS,\n AGENT_LABELS,\n AGENT_OPTIONS,\n type AgentConfig,\n type AgentId,\n DEFAULT_AGENTS,\n type DefaultAgentsMap,\n type PaperCampConfig,\n} from '@/types/index';\nimport { Alert, Button, Card, Divider, Input, Select, Stamp, useToast } from '@dendelion/paper-ui';\nimport { useEffect, useRef, useState } from 'react';\nimport { MergePolicySection } from './components/merge-policy-section';\nimport { SetupSection } from './components/setup-section';\nimport { SubjectsSection } from './components/subjects-section';\n\nconst TASK_TYPE_KEYS = ['phase', 'planDraft', 'ideaExtend', 'commitSuggest', 'feedback'] as const;\ntype TaskTypeKey = (typeof TASK_TYPE_KEYS)[number];\n\nconst TASK_TYPE_LABELS: Record<TaskTypeKey, string> = {\n phase: 'Phase run',\n planDraft: 'Plan draft',\n ideaExtend: 'Idea extend',\n commitSuggest: 'Commit suggest',\n feedback: 'Scout chat',\n};\n\ninterface AgentTaskRowProps {\n taskKey: TaskTypeKey;\n agentConfig: AgentConfig;\n isLast: boolean;\n onSave: (key: TaskTypeKey, config: AgentConfig) => Promise<void>;\n}\n\nconst TASK_COLUMN_WIDTH = 110;\nconst AGENT_COLUMN_WIDTH = 140;\nconst MODEL_COLUMN_WIDTH = 160;\nconst EFFORT_COLUMN_WIDTH = 110;\n\nconst AgentTaskRowHeader = () => (\n <div className=\"flex items-center gap-3 pb-1\">\n <span className=\"w-[110px] shrink-0 text-sm opacity-[0.45]\">Task</span>\n <span className=\"w-[140px] shrink-0 text-sm opacity-[0.45]\">Agent</span>\n <span className=\"w-[160px] shrink-0 text-sm opacity-[0.45]\">Model</span>\n <span className=\"w-[110px] shrink-0 text-sm opacity-[0.45]\">Effort</span>\n </div>\n);\n\nconst AgentTaskRow = ({ taskKey, agentConfig, isLast, onSave }: AgentTaskRowProps) => {\n // Fall back if the config carries an unknown agent id — never white-screen the page.\n const opts = AGENT_OPTIONS[agentConfig.agent] ?? AGENT_OPTIONS['claude-code'];\n const modelOpts = opts.model;\n const effortOpts = opts.effort;\n const [localModel, setLocalModel] = useState(agentConfig.model ?? '');\n\n useEffect(() => {\n setLocalModel(agentConfig.model ?? '');\n }, [agentConfig.model]);\n\n const handleAgentChange = (v: string) => {\n const newId = v as AgentId;\n const newOpts = AGENT_OPTIONS[newId];\n const newConfig: AgentConfig = { agent: newId };\n // Only carry the model over if the new agent accepts it — otherwise a claude\n // model like 'opus' would leak into opencode and fail at launch.\n if (\n agentConfig.model &&\n (newOpts.model === null || newOpts.model?.includes(agentConfig.model))\n ) {\n newConfig.model = agentConfig.model;\n }\n if (agentConfig.effort && Array.isArray(newOpts.effort)) newConfig.effort = agentConfig.effort;\n onSave(taskKey, newConfig);\n };\n\n const handleModelSelectChange = (v: string) => {\n onSave(taskKey, { ...agentConfig, model: v || undefined });\n };\n\n const handleModelInputBlur = () => {\n onSave(taskKey, { ...agentConfig, model: localModel || undefined });\n };\n\n const handleEffortChange = (v: string) => {\n onSave(taskKey, { ...agentConfig, effort: v || undefined });\n };\n\n return (\n <>\n <div className=\"flex items-center gap-3 pb-2 pt-2\">\n <span className=\"w-[110px] shrink-0 text-sm opacity-[0.65]\">\n {TASK_TYPE_LABELS[taskKey]}\n </span>\n <Select\n size=\"small\"\n width={AGENT_COLUMN_WIDTH}\n value={agentConfig.agent}\n onChange={handleAgentChange}\n options={AGENT_IDS.map((id) => ({ value: id, label: AGENT_LABELS[id] }))}\n />\n {Array.isArray(modelOpts) ? (\n <Select\n size=\"small\"\n width={MODEL_COLUMN_WIDTH}\n value={agentConfig.model ?? ''}\n onChange={handleModelSelectChange}\n options={[\n { value: '', label: 'Default' },\n ...modelOpts.map((m) => ({ value: m, label: m })),\n ]}\n />\n ) : modelOpts === null ? (\n <Input\n size=\"small\"\n className=\"w-[160px]\"\n value={localModel}\n placeholder=\"Default model\"\n onChange={(e) => setLocalModel(e.target.value)}\n onBlur={handleModelInputBlur}\n />\n ) : null}\n {/* Reserve the effort slot even when the agent has no effort options, so\n switching agents doesn't change the control count and shift the row. */}\n <div className={Array.isArray(effortOpts) ? 'visible' : 'invisible'}>\n <Select\n size=\"small\"\n width={EFFORT_COLUMN_WIDTH}\n value={agentConfig.effort ?? ''}\n onChange={handleEffortChange}\n options={[\n { value: '', label: 'Default' },\n ...(Array.isArray(effortOpts) ? effortOpts : []).map((e) => ({ value: e, label: e })),\n ]}\n />\n </div>\n </div>\n {!isLast && <Divider />}\n </>\n );\n};\n\nconst GeneralSection = () => {\n const fileRef = useRef<HTMLInputElement>(null);\n const [config, setConfig] = useState<PaperCampConfig | null | undefined>(undefined);\n const { iconDataUri: fetchedIconDataUri, loading: identityLoading } = useProjectIdentity();\n const [uploadedIconDataUri, setUploadedIconDataUri] = useState<string | null>(null);\n const iconDataUri = uploadedIconDataUri ?? fetchedIconDataUri;\n const [uploading, setUploading] = useState(false);\n const [portInput, setPortInput] = useState('');\n const [nameInput, setNameInput] = useState('');\n const { toast } = useToast();\n\n useEffect(() => {\n fetchConfig().then((c) => {\n setConfig(c);\n if (c?.port !== undefined) setPortInput(String(c.port));\n if (c?.projectName !== undefined) setNameInput(c.projectName);\n });\n }, []);\n\n const handleSaveAgentConfig = async (key: TaskTypeKey, newEntry: AgentConfig) => {\n const current = config?.defaultAgents;\n const updated: DefaultAgentsMap = {\n phase: current?.phase ?? DEFAULT_AGENTS.phase,\n planDraft: current?.planDraft ?? DEFAULT_AGENTS.planDraft,\n ideaExtend: current?.ideaExtend ?? DEFAULT_AGENTS.ideaExtend,\n commitSuggest: current?.commitSuggest ?? DEFAULT_AGENTS.commitSuggest,\n feedback: current?.feedback ?? DEFAULT_AGENTS.feedback,\n [key]: newEntry,\n };\n const { ok, error } = await saveConfig({ defaultAgents: updated });\n if (ok) {\n setConfig((prev) => (prev ? { ...prev, defaultAgents: updated } : prev));\n toast({ title: 'Saved', variant: 'success' });\n } else {\n toast({ title: 'Failed to save', description: error, variant: 'error' });\n }\n };\n\n const handleSavePort = async () => {\n const port = Number(portInput);\n if (!config || !Number.isInteger(port) || port <= 0 || port === config.port) return;\n const { ok, error } = await saveConfig({ port });\n if (ok) {\n setConfig((prev) => (prev ? { ...prev, port } : prev));\n toast({\n title: 'Saved',\n description: 'Restart `paper-camp dev` to apply the new port.',\n variant: 'success',\n });\n } else {\n toast({ title: 'Failed to save', description: error, variant: 'error' });\n }\n };\n\n const handleToggleIntegration = async () => {\n if (!config) return;\n const next = !(config.integration?.toolbar?.enabled ?? true);\n const integration = {\n ...config.integration,\n toolbar: { ...config.integration?.toolbar, enabled: next },\n };\n const { ok, error } = await saveConfig({ integration });\n if (ok) {\n setConfig((prev) => (prev ? { ...prev, integration } : prev));\n toast({ title: 'Saved', variant: 'success' });\n } else {\n toast({ title: 'Failed to save', description: error, variant: 'error' });\n }\n };\n\n const handleSaveName = async () => {\n const projectName = nameInput.trim();\n if (!config || !projectName || projectName === config.projectName) return;\n const { ok, error } = await saveConfig({ projectName });\n if (ok) {\n setConfig((prev) => (prev ? { ...prev, projectName } : prev));\n setNameInput(projectName);\n toast({ title: 'Saved', variant: 'success' });\n } else {\n toast({ title: 'Failed to save', description: error, variant: 'error' });\n }\n };\n\n const handleFile = async (e: React.ChangeEvent<HTMLInputElement>) => {\n const file = e.target.files?.[0];\n if (!file) return;\n setUploading(true);\n const reader = new FileReader();\n reader.onloadend = async () => {\n const dataUri = reader.result as string;\n const ok = await uploadIcon(dataUri);\n setUploading(false);\n if (ok) {\n setUploadedIconDataUri(dataUri);\n toast({ title: 'Saved', variant: 'success' });\n } else {\n toast({ title: 'Failed to save', variant: 'error' });\n }\n };\n reader.readAsDataURL(file);\n };\n\n return (\n <div>\n <div className=\"mb-6\">\n <h2 className=\"m-0\">Project Info</h2>\n </div>\n {config === undefined && <p>Loading…</p>}\n {config === null && (\n <Alert variant=\"warning\">\n No papercamp/config.json found — run <code>paper-camp init</code> in this directory first.\n </Alert>\n )}\n {config && (\n <Card size=\"small\" texture=\"kraft\">\n <div className=\"flex items-end gap-3 pb-3\">\n <Input\n value={nameInput}\n onChange={(e) => setNameInput(e.target.value)}\n onBlur={handleSaveName}\n label=\"Project Name\"\n />\n <Stamp\n size=\"small\"\n fillColor=\"rgba(143, 185, 150, 0.25)\"\n textColor={color.accentGreenDark}\n >\n v{config.version}\n </Stamp>\n </div>\n <Divider />\n\n <div className=\"flex items-center gap-3 pb-3 pt-3\">\n {iconDataUri && (\n <img\n src={iconDataUri}\n alt=\"Project icon\"\n className=\"w-10 h-10 object-contain shrink-0 rounded\"\n />\n )}\n <div>\n {/* paper-ui has no file-input component, so this raw input is intentional */}\n <input\n ref={fileRef}\n type=\"file\"\n accept=\".svg,.png,.jpg,.jpeg,.gif,.webp\"\n onChange={handleFile}\n className=\"hidden\"\n />\n <Button size=\"small\" onClick={() => fileRef.current?.click()} disabled={uploading}>\n {uploading ? 'Uploading…' : 'Choose File'}\n </Button>\n {identityLoading && <p className=\"text-sm opacity-50 mt-1 mx-0 mb-0\">Loading…</p>}\n {!identityLoading && !iconDataUri && !uploading && (\n <p className=\"text-sm opacity-[0.45] mt-1 mx-0 mb-0\">No icon set.</p>\n )}\n </div>\n </div>\n <Divider />\n\n <div className=\"flex items-end gap-3 pb-3 pt-3\">\n <Input\n type=\"number\"\n value={portInput}\n onChange={(e) => setPortInput(e.target.value)}\n onBlur={handleSavePort}\n label=\"Port\"\n helperText=\"Default for `paper-camp dev`. Restart the server to apply a change.\"\n />\n </div>\n <Divider />\n\n <div className=\"flex items-center justify-between gap-3 pb-3 pt-3\">\n <div>\n <p className=\"m-0\">In-app dev toolbar</p>\n <p className=\"opacity-[0.45] text-sm mt-1 mx-0 mb-0\">\n Inject the paper-camp toolbar into this project's dev server via the Vite plugin.\n </p>\n </div>\n <Button size=\"small\" onClick={handleToggleIntegration}>\n {(config.integration?.toolbar?.enabled ?? true) ? 'Disable' : 'Enable'}\n </Button>\n </div>\n <Divider />\n\n <AgentTaskRowHeader />\n {TASK_TYPE_KEYS.map((key, idx) => (\n <AgentTaskRow\n key={key}\n taskKey={key}\n agentConfig={config.defaultAgents?.[key] ?? DEFAULT_AGENTS[key]}\n isLast={idx === TASK_TYPE_KEYS.length - 1}\n onSave={handleSaveAgentConfig}\n />\n ))}\n </Card>\n )}\n\n <p className=\"opacity-[0.45] text-sm mt-4\">\n <strong>Initialized:</strong>{' '}\n {config ? new Date(config.initializedAt).toLocaleString() : '—'}\n </p>\n </div>\n );\n};\n\nexport const SettingsPage = () => {\n const section = useActiveSettingsSection();\n return (\n <div>\n <PageTitle>Settings</PageTitle>\n {section === 'subjects' ? (\n <SubjectsSection />\n ) : section === 'setup' ? (\n <SetupSection />\n ) : section === 'merge-policy' ? (\n <MergePolicySection />\n ) : (\n <GeneralSection />\n )}\n </div>\n );\n};\n","import { useActiveSettingsSection } from '@/app/hooks';\nimport { ListItem } from '@dendelion/paper-ui';\nimport { useNavigate } from '@tanstack/react-router';\nimport { SidebarSection } from '../../plans/components/sidebar-section';\n\nexport const SettingsSidebar = () => {\n const section = useActiveSettingsSection();\n const navigate = useNavigate();\n\n return (\n <>\n <SidebarSection label=\"General\">\n <ListItem\n size=\"small\"\n active={section === null}\n onClick={() => navigate({ to: '/settings' })}\n >\n Project Info\n </ListItem>\n <ListItem\n size=\"small\"\n active={section === 'setup'}\n onClick={() => navigate({ to: '/settings/$section', params: { section: 'setup' } })}\n >\n Setup\n </ListItem>\n <ListItem\n size=\"small\"\n active={section === 'merge-policy'}\n onClick={() =>\n navigate({ to: '/settings/$section', params: { section: 'merge-policy' } })\n }\n >\n Merge Policy\n </ListItem>\n </SidebarSection>\n <SidebarSection label=\"Ideas\">\n <ListItem\n size=\"small\"\n active={section === 'subjects'}\n onClick={() => navigate({ to: '/settings/$section', params: { section: 'subjects' } })}\n >\n Subjects\n </ListItem>\n </SidebarSection>\n </>\n );\n};\n"],"names":["fetchMergePolicy","response","apiUrl","applyMergePolicy","RECOMMENDED","POLICY_ROWS","formatValue","value","matchesRecommended","policy","row","PolicyRow","label","current","recommended","isLast","matches","jsxs","Fragment","jsx","Divider","MergePolicySection","result","setResult","useState","applying","setApplying","toast","useToast","useEffect","handleApply","applied","upToDate","Alert","Stamp","Card","idx","Button","RELAY_POLL_MS","RELAY_CONNECTION_ID","AUTH_FIX_COMMANDS","RelayFallbackGuide","cmd","CodeBlock","SignInAction","onSignedIn","loginRelay","useAppStore","s","startLoginRelay","loadLoginRelayStatus","cancelLoginRelay","openedUrlRef","useRef","phase","id","url","STATUS_STAMP","ConnectActionView","connection","onConnect","connecting","connect","ConnectionRow","onRecheck","rechecking","stamp","Tooltip","SetupSection","connections","setConnections","loadFailed","setLoadFailed","reloadingId","setReloadingId","connectingId","setConnectingId","setupDismissed","setSetupDismissed","applyConnections","useCallback","fetchConnections","fetchConfig","c","handleRecheck","handleConnect","updated","connectService","prev","handleDismissToggle","next","ok","saveConfig","allOk","SubjectsSection","subjects","loading","available","useSubjectVocabulary","navigate","useNavigate","name","TASK_TYPE_KEYS","TASK_TYPE_LABELS","AGENT_COLUMN_WIDTH","MODEL_COLUMN_WIDTH","EFFORT_COLUMN_WIDTH","AgentTaskRowHeader","AgentTaskRow","taskKey","agentConfig","onSave","opts","AGENT_OPTIONS","modelOpts","effortOpts","localModel","setLocalModel","handleAgentChange","v","newId","newOpts","newConfig","_a","handleModelSelectChange","handleModelInputBlur","handleEffortChange","Select","AGENT_IDS","AGENT_LABELS","Input","e","GeneralSection","fileRef","config","setConfig","fetchedIconDataUri","identityLoading","useProjectIdentity","uploadedIconDataUri","setUploadedIconDataUri","iconDataUri","uploading","setUploading","portInput","setPortInput","nameInput","setNameInput","handleSaveAgentConfig","key","newEntry","DEFAULT_AGENTS","error","handleSavePort","port","handleToggleIntegration","_b","integration","_c","handleSaveName","projectName","handleFile","file","reader","dataUri","uploadIcon","color","SettingsPage","section","useActiveSettingsSection","PageTitle","SettingsSidebar","SidebarSection","ListItem"],"mappings":"2UAGO,MAAMA,GAAmB,SAA+C,CAC7E,GAAI,CACF,MAAMC,EAAW,MAAM,MAAMC,EAAO,mBAAmB,CAAC,EACxD,OAAKD,EAAS,GACN,MAAMA,EAAS,KAAA,EADE,IAE3B,MAAQ,CACN,OAAO,IACT,CACF,EAEaE,GAAmB,SAA+C,CAC7E,GAAI,CACF,MAAMF,E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