68aeefa296
* feat(gitlab): add GitLab integration with MR / discussions support Adds a GitLab integration parallel to the GitHub one: PAT and glab CLI auth, self-managed host configuration, MR feedback (approvals + discussions + pipelines), and discussion reply / resolve so agents can address review comments. The pr skill detects the host from git remote and creates a real GitLab merge request via glab or REST. Closes #820 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * refactor(gitlab): address review feedback and tighten lint surface - Add service_test.go covering ConfigureToken / ClearToken / ConfigureHost. - Drop speculative MRWatch / TaskMR / ReviewWatch / IssueWatch / preset scaffolding that had no migrations or handlers behind it. - Consolidate /approvals into one round-trip via fetchApprovals. - Use http.DefaultClient in CheckHost (context already carries the deadline). - Rename misleading id → configured in ConfigureToken. - Introduce mrStateOpen constant so the lint goconst rule passes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(gitlab): address PR review feedback (CodeQL SSRF, races, atomicity) - connectivity: parse host with url.Parse, validate http/https scheme, build probe URL via &url.URL{} so user-controlled host can't smuggle into the request — clears the CodeQL go/request-forgery alert. - pat_client: guard cached username with sync.RWMutex; IsAuthenticated now propagates non-401/403 errors instead of masking transport failures; GetMRStatus skips pipelines query when HeadSHA / HeadBranch are both empty; parseNextLink drops cross-host links instead of returning bare absolute URLs that get() would double-prefix. - service: findTokenSecret returns (bool, string, error) and all callers propagate the secrets.List error so a backend outage isn't mistaken for "token absent"; ConfigureHost persists to hostStore before mutating in-memory host + client + authMethod under one lock. - repoclone: SSH clone URL falls back to ssh:// form when the host has a port (scp-style git@host:path can't carry one). - gitlab/client_helpers: namespace fallback uses LastIndex("/") so subgroup paths (acme/team/squad/repo) are preserved. - pr skill / plan doc: drop hardcoded --target-branch main, derive host from git remote instead of $CI_SERVER_URL, build curl payload with jq -n; fix /pipelines/:id/jobs → :pipeline_id typo. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(gitlab): preserve host base path in CheckHost; broaden validation; test - connectivity: extract validateHost so the parse / scheme / hostname / userinfo / opaque-URL checks each have a single home. Preserve the configured base path (TrimRight slash) so a host like https://gitlab.acme.corp/gitlab probes /gitlab/api/v4/version instead of dropping the prefix. - connectivity_test: cover validateHost (default, https, http, trailing slash, subpath, missing scheme, ftp, empty host, userinfo) and CheckHost end-to-end (version endpoint, base-path preservation, scheme rejection, unreachable host). - pr skill: drop the broken `glab repo view --json defaultBranch` branch — glab doesn't accept --json, so the lookup silently fell back to "main" every time. Fetch default_branch via the GitLab REST API directly using the PAT we already have. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(gitlab): override filter defaults, refresh auth uncached, mock pipelines - appendFilter: Del before re-Add so user-supplied filter keys actually override caller defaults (e.g. state=closed swaps the seeded state=opened instead of appending a second value GitLab silently ignored). - IsAuthenticated: probe /user directly instead of routing through the username cache; a token revoked upstream now surfaces as not-connected immediately. Cache is opportunistically refreshed on success. - MockClient.GetMRFeedback: include pipeline state in HasIssues, matching the real PATClient behavior so test flows can't miss a broken MR. - pr skill: document `glab mr note create --reply <id>` for replies (bare `glab mr note` opens a new thread); fix host-extraction block to handle ssh://host:2222/team/repo.git without leaking the port into PROJECT. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(gitlab): guard mock pipelines on empty MR head; preserve HTTPS port in pr skill - MockClient.GetMRFeedback now mirrors PATClient: skip the pipelines fetch when HeadSHA and HeadBranch are both empty. The mock'\''s ListPipelines ignores its branch argument and returns every pipeline seeded under the project, so without this guard a brand-new MR would inherit a sibling MR'\''s failing pipeline and flip HasIssues to true. Tests cover both the empty-head and head-present cases. - pr skill: derive HOST scheme-aware so https://host:8443 keeps the port (HTTPS API endpoint), ssh://host:2222 strips it (different transport), and scp-style git@host stays portless. Avoids silently re-routing self-managed API calls to the default 443. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(gitlab): export SeedPipelines; mock GetMRStatus parity; drain bodies; test cache hit - MockClient: add exported SeedPipelines(project, iid, []) alongside the other Seed* methods; mirror PATClient.GetMRStatus by populating PipelineState / jobs counts via summarizePipelines, guarded on a non-empty head ref. Brings mock parity with the real client so any future test seeding pipelines sees the same MRStatus shape. - PATClient HTTP plumbing: drain resp.Body via io.Copy(io.Discard, ...) when result == nil in both getWithTotal and doWrite, so HTTP/1.1 can reuse the connection instead of opening a new TCP socket per call. - TestPATClient_GetAuthenticatedUser: assert calls == 1 after the second GetAuthenticatedUser hit so the cache contract is actually verified (a non-caching implementation would have passed the prior version). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(gitlab): surface connection errors, align MR pipeline guards, fix mock seed key - service.GetStatus now captures the IsAuthenticated error into a new Status.ConnectionError field (empty on healthy / 401-403, populated on network / 5xx / parse failures). Frontend GitLabStatus + settings page render a distinct "Unreachable" badge + alert so users don't delete a still-valid token during a transient GitLab outage. - PATClient.GetMRFeedback now guards on HeadSHA || HeadBranch, matching GetMRStatus and MockClient.GetMRFeedback (which had been updated in an earlier round). The three call sites were inconsistent — a mock test with HeadBranch-but-no-SHA would pass while the real client silently dropped pipelines. - MockClient.pipelines is now keyed by project alone (was map[mockMRKey][]Pipeline). SeedPipelines takes (project, []) so successive seeds for the same project deterministically overwrite, instead of leaving multiple entries that ListPipelines would resolve in Go's unspecified map-iteration order. - Tests: TestService_GetStatus_{PopulatesConnectionErrorOn5xx, ClearsConnectionErrorOn401} cover the new error surface; TestMockClient_SeedPipelines_OverwritesByProject locks the key change. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(gitlab): tighten validateHost; init Status scopes; close token-host race - validateHost: drop the parsed.Opaque != "" branch — Go only sets Opaque for opaque URIs, which have an empty Host the prior check already rejects. Narrow the userinfo error to mention the actual user:password@host shape so the message matches what users see. - service.GetStatus: initialize RequiredScopes: []string{} on the nil-client defensive branch so the JSON payload keeps the always-an-array contract declared on the TypeScript side. The branch is effectively unreachable (every Provide path returns at least a NoopClient) but the empty-slice fallback costs nothing. - service.ConfigureToken: build the installed client inside the write lock using the up-to-date s.host instead of the pre-probe snapshot. A concurrent ConfigureHost between RUnlock and Lock used to leave s.client pointing at the prior host while s.host advertised the new one — every subsequent API call would silently target the wrong instance until the next reconfigure. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(gitlab): drop MR-commit stats fields; rename AuthorName; log post-lock host - MRCommitInfo: drop Additions / Deletions / FilesChanged. GitLab's /merge_requests/:iid/commits endpoint doesn't return a stats object, so those fields were always 0 — better to omit them than feed callers silently-wrong numbers. Rename AuthorUsername to AuthorName since the API returns a display name, not a login handle. Doc-comment records the per-commit endpoint to use if a future revision wants real stats. - ListMRCommits: drop the Stats anonymous struct from the JSON decode target now that the destination fields are gone. - service.ConfigureToken: capture installedHost inside the write lock and log that value. The previous log used the pre-validation host snapshot, so a concurrent ConfigureHost between snapshot and lock would leave the log entry referring to a stale value while the client itself was correctly built against the new host. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(gitlab): encode subgroup paths; sentinel-route errors; mock approval parity - pat_client.SearchGroupProjects now encodes the group path through a new groupRef helper that %2F-substitutes slashes (mirrors projectRef). Subgroup paths like "acme/team" used to land at /groups/acme/team/projects, which GitLab routed to the parent group only and returned 404 for. Subgroups now work end-to-end. - service.ErrInvalidToken sentinel + controller errors.Is routing: token validation failures now wrap a package-level sentinel and the HTTP layer switches on it via errors.Is, replacing the fragile strings.Contains prefix check that would silently fall through to 500 if the message ever changed. Coverage: TestService_ConfigureToken_WrapsErrInvalidToken. - MockClient gains seedable approvals: SeedApprovals(project, iid, list, required) backs a dedicated approvals + requiredApprovals map. ListMRApprovals, GetMRFeedback, and GetMRStatus all consume them so ApprovalState / ApprovalCount / RequiredApprovals match what the real PATClient.GetMRStatus computes. Coverage: TestMockClient_GetMRStatus_UsesSeededApprovals. - ClearToken: same host-snapshot race ConfigureToken was fixed for last round — NewClient now runs under the write lock against s.host rather than a pre-acquired snapshot. - CheckHost: drain resp.Body before close so http.DefaultClient's keep-alive pool can reuse the connection for the next probe. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(gitlab): full-path projectRef round-trip; unlock during glab probe - splitFullReference now returns (namespace, fullPath) where fullPath is the namespace-qualified project path ("group/sub/project") instead of the last segment alone. Callers can pass MR.ProjectPath straight to projectRef for round-trip API calls (GetMR, GetMRFeedback, etc.) — matches GitLab's own path_with_namespace convention. Existing test cases updated. - ClearToken: build the fallback client OUTSIDE the write lock so NewClient's glab subprocess (bounded by glabAuthTimeout = 10s) doesn't freeze every concurrent GetStatus / GetMRFeedback / Client() RLock reader for the duration. Brief WLock now only wraps the field swap. Tradeoff with the concurrent-ConfigureHost race is documented in-code: narrow stale-host window vs. 10s of blocked readers, and the next reconfigure resolves it. - New regression test TestPATClient_SearchGroupProjects_EncodesSubgroupSlash asserts the request URL is /groups/acme%2Fteam/projects so a future refactor that swapped groupRef back to a bare url.PathEscape would fail visibly instead of silently 404ing subgroup lookups. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(gitlab): equality-guard ClearToken's client swap against ConfigureHost race ClearToken builds the fallback client outside the write lock to avoid blocking RLock readers for up to 10s while glab auth-probes. The swap-only critical section now compares s.host against the pre-probe snapshot before assigning — if a concurrent ConfigureHost moved the host underneath us, we leave its (newer, correctly-targeted) client alone instead of overwriting with our stale-host build. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(web): add GitLab to the settings integrations sidebar The /settings/integrations/gitlab page existed and the index card listed GitLab alongside the other integrations, but the settings sidebar nav (IntegrationsNavGroup) only listed GitHub / Jira / Linear / Slack. The page was unreachable through the standard sidebar. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * feat(gitlab): task-MR topbar surface + DB-backed task↔MR store Phase 1 of the GitLab UI build-out: brings the MR side of the task topbar to parity with the existing GitHub PR button. Backend - gitlab_task_mrs table + Store wiring (UpsertTaskMR, ListTaskMRsByTask, ListTaskMRsByWorkspaceID, DeleteTaskMR), uniqued on (task_id, repository_id, project_path, mr_iid) for multi-repo. - service.SyncTaskMR folds a live GetMRStatus probe into an upsert; ListTaskMRsByTask / ListTaskMRsByWorkspace expose the rows. - Three HTTP endpoints: GET /workspaces/:id/task-mrs, GET /tasks/:taskID/mrs, POST /tasks/:taskID/mrs/sync. - initGitLabService now takes a *db.Pool and constructs gitlab.Store. Failures non-fatal: integration keeps working without the table. Frontend - TaskMR type + listWorkspaceTaskMRs / listTaskMRs / syncTaskMR API. - lib/state/slices/gitlab slice (taskMRs.byTaskId) wired through default-state, store.ts AppState, and slices/index exports. - hooks/domains/gitlab/use-task-mr.ts: useWorkspaceMRs (fetch-on- workspace-switch) and useTaskMRs (per-task selector). - components/gitlab/mr-topbar-button.tsx — single/multi MR variants, status icons mirroring pr-task-icon priority order. - task-top-bar.tsx renders PRTopbarButton and MRTopbarButton side-by- side; each returns null when empty, so the union handles GitHub-only, GitLab-only, and multi-repo tasks without an explicit switch. - kanban-board.tsx hydrates useWorkspaceMRs alongside useWorkspacePRs. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * feat(gitlab): add /gitlab page for browsing user MRs and issues Adds the GitLab counterpart to /github so users can browse their own merge requests and issues from inside kandev, parallel to the existing GitHub "My GitHub" page. Backend - /api/v1/gitlab/user/mrs and /user/issues — paginated wrappers around the existing SearchMRsPaged / ListIssuesPaged client methods. paginationFromQuery clamps page/per_page the same way as the client. Frontend - /gitlab SSR page + client with MR/Issue tabs, scope filters (assigned / created / review-requested), and a free-text search box that falls back to raw GitLab query-string for power users. - searchUserMRs / searchUserIssues API helpers + MR / Issue / *SearchPage types in lib/types/gitlab. - useGitLabAvailable hook (probes /status + refreshes on window focus) feeds the integrations menu so the GitLab link only shows when a token is configured or auth is green. Tests - task-top-bar.test mocks the new MRTopbarButton so renders no longer pick up useAppStore without a StateProvider. - integrations-menu.test wires the new useGitLabAvailable mock and gitlabReady prop into mockAvailability / getAvailableIntegrationLinks fixtures. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(gitlab): stable empty array in useTaskMRs to avoid infinite re-render useTaskMRs returned `state.taskMRs.byTaskId[taskId] ?? []` — that fresh literal made the zustand selector produce a new reference on every render when the task had no MRs, triggering an infinite re-render loop in MRTopbarButton that crashed the task page with a Next.js client-side exception. The page never mounted session-chat, so Docker E2E tests that drive `/t/:id` (slow-bootstrap progress, external-stop resume, environment reset) all timed out waiting for the chat panel. Mirror the GitHub side's `EMPTY_PRS` pattern: hoist a module-level `EMPTY_MRS = []` and return it for the empty case. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(gitlab): address PR review — cache header, in-flight cancel, tests - Top-level `cache: "no-store"` in 5 sites (use-task-mr.ts, gitlab-api.ts, gitlab-page-client.tsx). The earlier `init: { cache: "no-store" }` placement was silently overwritten by fetchJson with undefined, so probes hit the browser cache instead. - useWorkspaceMRs now invalidates in-flight responses and calls resetTaskMRs when the workspace becomes null, so the previous workspace's MRs don't linger after sign-out / workspace switch. - Drop unpopulated UnresolvedThreads/DiscussionCount from TaskMR (model, schema, TS type). SyncTaskMR's source MRStatus never populated them and no surface reads them; the dropped columns are skipped via an explicit projection in store.go so existing dev DBs keep binding. - Extract MRList/IssueList inline fetches in /gitlab into useGitLabUserMRs / useGitLabUserIssues — matches CLAUDE.md "never fetch in components". - Tests for store (UpsertTaskMR, composite key, workspace-JOIN isolation, ordering, Delete), service (SyncTaskMR mock round-trip + field mapping + store-unset error, ListTaskMRsByWorkspace JOIN isolation, ListTaskMRsByTask), pat_client (ListIssuesPaged X-Total), gitlab-api (5 new fns), gitlab-slice (setTaskMR composite key), and the use-task-mr / use-user-search hooks. - pr SKILL.md: skip note for steps 5–6 on GitLab remotes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(gitlab): only wrap 401/403 probe errors as ErrInvalidToken Network failures, 5xx, and DNS errors during `ConfigureToken` previously surfaced to the user as HTTP 400 "invalid token: …" — during a GitLab outage a user with a valid token might delete it assuming it was rejected. Now only `*APIError` with 401/403 is mapped to `ErrInvalidToken`; other errors propagate unwrapped so the controller routes them to "GitLab unreachable" instead. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Kandev Agent <agent@kandev.dev> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
670 lines
30 KiB
TypeScript
670 lines
30 KiB
TypeScript
import { createStore } from "zustand/vanilla";
|
|
import { immer } from "zustand/middleware/immer";
|
|
import { hydrateState, type HydrationOptions } from "./hydration/hydrator";
|
|
import type {
|
|
Repository,
|
|
Branch,
|
|
RepositoryScript,
|
|
Message,
|
|
Turn,
|
|
TaskSession,
|
|
} from "@/lib/types/http";
|
|
import type {
|
|
GitHubStatus,
|
|
GitHubRateLimitUpdate,
|
|
TaskPR,
|
|
PRWatch,
|
|
ReviewWatch as GitHubReviewWatch,
|
|
IssueWatch as GitHubIssueWatch,
|
|
GitHubActionPresets,
|
|
PRFeedback,
|
|
} from "@/lib/types/github";
|
|
import type { SystemHealthResponse } from "@/lib/types/health";
|
|
import type { UISliceActions as UIA } from "./slices/ui/types";
|
|
import type * as UISliceTypes from "./slices/ui/types";
|
|
import type { Automation, AutomationRun } from "@/lib/types/automation";
|
|
import { mergeInitialState } from "./default-state";
|
|
import {
|
|
createKanbanSlice,
|
|
createWorkspaceSlice,
|
|
createSettingsSlice,
|
|
createSessionSlice,
|
|
createSessionRuntimeSlice,
|
|
createUISlice,
|
|
createGitHubSlice,
|
|
createGitLabSlice,
|
|
createJiraSlice,
|
|
createLinearSlice,
|
|
createOfficeSlice,
|
|
createFeaturesSlice,
|
|
createAutomationsSlice,
|
|
defaultKanbanState,
|
|
defaultWorkspaceState,
|
|
defaultSettingsState,
|
|
defaultSessionState,
|
|
defaultSessionRuntimeState,
|
|
defaultUIState,
|
|
defaultGitHubState,
|
|
defaultGitLabState,
|
|
defaultJiraState,
|
|
defaultLinearState,
|
|
defaultOfficeState,
|
|
defaultFeaturesState,
|
|
defaultAutomationsState,
|
|
type WorkspaceState,
|
|
type WorkflowsState,
|
|
type ExecutorsState,
|
|
type SettingsAgentsState,
|
|
type AgentDiscoveryState,
|
|
type AvailableAgentsState,
|
|
type AgentProfilesState,
|
|
type EditorsState,
|
|
type PromptsState,
|
|
type SecretsState,
|
|
type NotificationProvidersState,
|
|
type SettingsDataState,
|
|
type UserSettingsState,
|
|
type ProcessStatusEntry,
|
|
type Worktree,
|
|
type GitStatusEntry,
|
|
type SessionCommit,
|
|
type ContextWindowEntry,
|
|
type SessionAgentctlStatus,
|
|
type PreviewStage,
|
|
type PreviewViewMode,
|
|
type PreviewDevicePreset,
|
|
type ConnectionState,
|
|
} from "./slices";
|
|
import type {
|
|
AvailableCommand,
|
|
SessionModeEntry,
|
|
AgentCapabilitiesEntry,
|
|
SessionModelEntry,
|
|
ConfigOptionEntry,
|
|
PromptUsageEntry,
|
|
SessionPollMode,
|
|
TodoEntry,
|
|
UserShellInfo,
|
|
} from "./slices/session-runtime/types";
|
|
|
|
// Re-export all types from slices for backwards compatibility (split out
|
|
// to keep this file under the max-lines limit).
|
|
export type * from "./store-reexports";
|
|
import type { TaskMR } from "@/lib/types/gitlab";
|
|
import type { JiraIssueWatch } from "@/lib/types/jira";
|
|
import type { LinearIssueWatch } from "@/lib/types/linear";
|
|
import type {
|
|
AgentProfile,
|
|
AgentRoutePreview,
|
|
AgentRouteData,
|
|
Skill,
|
|
Project,
|
|
Approval,
|
|
ActivityEntry,
|
|
CostSummary,
|
|
BudgetPolicy,
|
|
Routine,
|
|
InboxItem,
|
|
OfficeMeta,
|
|
ProviderHealth,
|
|
RouteAttempt,
|
|
Run,
|
|
DashboardData,
|
|
OfficeTask,
|
|
TaskFilterState,
|
|
TaskViewMode,
|
|
TaskSortField,
|
|
TaskSortDir,
|
|
TaskGroupBy,
|
|
WorkspaceRouting,
|
|
} from "./slices/office/types";
|
|
|
|
// Combined AppState type
|
|
export type AppState = {
|
|
// Kanban slice
|
|
kanban: (typeof defaultKanbanState)["kanban"];
|
|
kanbanMulti: (typeof defaultKanbanState)["kanbanMulti"];
|
|
workflows: (typeof defaultKanbanState)["workflows"];
|
|
tasks: (typeof defaultKanbanState)["tasks"];
|
|
|
|
// Workspace slice
|
|
workspaces: (typeof defaultWorkspaceState)["workspaces"];
|
|
repositories: (typeof defaultWorkspaceState)["repositories"];
|
|
repositoryBranches: (typeof defaultWorkspaceState)["repositoryBranches"];
|
|
repositoryScripts: (typeof defaultWorkspaceState)["repositoryScripts"];
|
|
|
|
// Settings slice
|
|
executors: (typeof defaultSettingsState)["executors"];
|
|
settingsAgents: (typeof defaultSettingsState)["settingsAgents"];
|
|
agentDiscovery: (typeof defaultSettingsState)["agentDiscovery"];
|
|
availableAgents: (typeof defaultSettingsState)["availableAgents"];
|
|
agentProfiles: (typeof defaultSettingsState)["agentProfiles"];
|
|
installJobs: (typeof defaultSettingsState)["installJobs"];
|
|
editors: (typeof defaultSettingsState)["editors"];
|
|
prompts: (typeof defaultSettingsState)["prompts"];
|
|
secrets: (typeof defaultSettingsState)["secrets"];
|
|
sprites: (typeof defaultSettingsState)["sprites"];
|
|
notificationProviders: (typeof defaultSettingsState)["notificationProviders"];
|
|
settingsData: (typeof defaultSettingsState)["settingsData"];
|
|
userSettings: (typeof defaultSettingsState)["userSettings"];
|
|
|
|
// Session slice
|
|
messages: (typeof defaultSessionState)["messages"];
|
|
turns: (typeof defaultSessionState)["turns"];
|
|
taskSessions: (typeof defaultSessionState)["taskSessions"];
|
|
taskSessionsByTask: (typeof defaultSessionState)["taskSessionsByTask"];
|
|
sessionAgentctl: (typeof defaultSessionState)["sessionAgentctl"];
|
|
worktrees: (typeof defaultSessionState)["worktrees"];
|
|
sessionWorktreesBySessionId: (typeof defaultSessionState)["sessionWorktreesBySessionId"];
|
|
pendingModel: (typeof defaultSessionState)["pendingModel"];
|
|
activeModel: (typeof defaultSessionState)["activeModel"];
|
|
taskPlans: (typeof defaultSessionState)["taskPlans"];
|
|
queue: (typeof defaultSessionState)["queue"];
|
|
|
|
// Session Runtime slice
|
|
terminal: (typeof defaultSessionRuntimeState)["terminal"];
|
|
shell: (typeof defaultSessionRuntimeState)["shell"];
|
|
processes: (typeof defaultSessionRuntimeState)["processes"];
|
|
gitStatus: (typeof defaultSessionRuntimeState)["gitStatus"];
|
|
environmentIdBySessionId: (typeof defaultSessionRuntimeState)["environmentIdBySessionId"];
|
|
sessionCommits: (typeof defaultSessionRuntimeState)["sessionCommits"];
|
|
contextWindow: (typeof defaultSessionRuntimeState)["contextWindow"];
|
|
agents: (typeof defaultSessionRuntimeState)["agents"];
|
|
availableCommands: (typeof defaultSessionRuntimeState)["availableCommands"];
|
|
sessionMode: (typeof defaultSessionRuntimeState)["sessionMode"];
|
|
userShells: (typeof defaultSessionRuntimeState)["userShells"];
|
|
prepareProgress: (typeof defaultSessionRuntimeState)["prepareProgress"];
|
|
sessionTodos: (typeof defaultSessionRuntimeState)["sessionTodos"];
|
|
agentCapabilities: (typeof defaultSessionRuntimeState)["agentCapabilities"];
|
|
sessionModels: (typeof defaultSessionRuntimeState)["sessionModels"];
|
|
promptUsage: (typeof defaultSessionRuntimeState)["promptUsage"];
|
|
sessionPollMode: (typeof defaultSessionRuntimeState)["sessionPollMode"];
|
|
|
|
// GitHub slice
|
|
githubStatus: (typeof defaultGitHubState)["githubStatus"];
|
|
taskPRs: (typeof defaultGitHubState)["taskPRs"];
|
|
prWatches: (typeof defaultGitHubState)["prWatches"];
|
|
reviewWatches: (typeof defaultGitHubState)["reviewWatches"];
|
|
issueWatches: (typeof defaultGitHubState)["issueWatches"];
|
|
actionPresets: (typeof defaultGitHubState)["actionPresets"];
|
|
prFeedbackCache: (typeof defaultGitHubState)["prFeedbackCache"];
|
|
|
|
// GitLab slice
|
|
taskMRs: (typeof defaultGitLabState)["taskMRs"];
|
|
|
|
// JIRA slice
|
|
jiraIssueWatches: (typeof defaultJiraState)["jiraIssueWatches"];
|
|
|
|
// Linear slice
|
|
linearIssueWatches: (typeof defaultLinearState)["linearIssueWatches"];
|
|
|
|
// Office slice
|
|
office: (typeof defaultOfficeState)["office"];
|
|
|
|
// Feature flags slice
|
|
features: (typeof defaultFeaturesState)["features"];
|
|
setFeatures: (features: (typeof defaultFeaturesState)["features"]) => void;
|
|
|
|
// Automations slice
|
|
automations: (typeof defaultAutomationsState)["automations"];
|
|
automationRuns: (typeof defaultAutomationsState)["automationRuns"];
|
|
|
|
// UI slice
|
|
previewPanel: (typeof defaultUIState)["previewPanel"];
|
|
rightPanel: (typeof defaultUIState)["rightPanel"];
|
|
diffs: (typeof defaultUIState)["diffs"];
|
|
connection: (typeof defaultUIState)["connection"];
|
|
mobileKanban: (typeof defaultUIState)["mobileKanban"];
|
|
mobileSession: (typeof defaultUIState)["mobileSession"];
|
|
chatInput: (typeof defaultUIState)["chatInput"];
|
|
documentPanel: (typeof defaultUIState)["documentPanel"];
|
|
systemHealth: (typeof defaultUIState)["systemHealth"];
|
|
quickChat: (typeof defaultUIState)["quickChat"];
|
|
configChat: (typeof defaultUIState)["configChat"];
|
|
sessionFailureNotification: (typeof defaultUIState)["sessionFailureNotification"];
|
|
bottomTerminal: (typeof defaultUIState)["bottomTerminal"];
|
|
sidebarViews: (typeof defaultUIState)["sidebarViews"];
|
|
collapsedSubtaskParents: (typeof defaultUIState)["collapsedSubtaskParents"];
|
|
kanbanPreviewedTaskId: (typeof defaultUIState)["kanbanPreviewedTaskId"];
|
|
sidebarTaskPrefs: (typeof defaultUIState)["sidebarTaskPrefs"];
|
|
|
|
// GitHub actions
|
|
setGitHubStatus: (status: GitHubStatus | null) => void;
|
|
setGitHubStatusLoading: (loading: boolean) => void;
|
|
setTaskPRs: (prs: Record<string, TaskPR[]>) => void;
|
|
setTaskPR: (taskId: string, pr: TaskPR) => void;
|
|
setPRWatches: (watches: PRWatch[]) => void;
|
|
setPRWatchesLoading: (loading: boolean) => void;
|
|
removePRWatch: (id: string) => void;
|
|
setReviewWatches: (watches: GitHubReviewWatch[]) => void;
|
|
setReviewWatchesLoading: (loading: boolean) => void;
|
|
addReviewWatch: (watch: GitHubReviewWatch) => void;
|
|
updateReviewWatch: (watch: GitHubReviewWatch) => void;
|
|
removeReviewWatch: (id: string) => void;
|
|
setIssueWatches: (watches: GitHubIssueWatch[]) => void;
|
|
setIssueWatchesLoading: (loading: boolean) => void;
|
|
addIssueWatch: (watch: GitHubIssueWatch) => void;
|
|
updateIssueWatch: (watch: GitHubIssueWatch) => void;
|
|
removeIssueWatch: (id: string) => void;
|
|
setActionPresets: (workspaceId: string, presets: GitHubActionPresets) => void;
|
|
setActionPresetsLoading: (workspaceId: string, loading: boolean) => void;
|
|
applyGitHubRateLimitUpdate: (update: GitHubRateLimitUpdate) => void;
|
|
setPRFeedbackCacheEntry: (key: string, feedback: PRFeedback) => void;
|
|
removePRFeedbackCacheEntry: (key: string) => void;
|
|
|
|
// GitLab actions
|
|
setTaskMRs: (mrs: Record<string, TaskMR[]>) => void;
|
|
setTaskMR: (taskId: string, mr: TaskMR) => void;
|
|
resetTaskMRs: () => void;
|
|
|
|
// JIRA actions
|
|
setJiraIssueWatches: (watches: JiraIssueWatch[]) => void;
|
|
setJiraIssueWatchesLoading: (loading: boolean) => void;
|
|
addJiraIssueWatch: (watch: JiraIssueWatch) => void;
|
|
updateJiraIssueWatch: (watch: JiraIssueWatch) => void;
|
|
removeJiraIssueWatch: (id: string) => void;
|
|
resetJiraIssueWatches: () => void;
|
|
|
|
// Linear actions
|
|
setLinearIssueWatches: (watches: LinearIssueWatch[]) => void;
|
|
setLinearIssueWatchesLoading: (loading: boolean) => void;
|
|
addLinearIssueWatch: (watch: LinearIssueWatch) => void;
|
|
updateLinearIssueWatch: (watch: LinearIssueWatch) => void;
|
|
removeLinearIssueWatch: (id: string) => void;
|
|
resetLinearIssueWatches: () => void;
|
|
|
|
// Automations actions
|
|
setAutomations: (items: Automation[]) => void;
|
|
setAutomationsLoading: (loading: boolean) => void;
|
|
addAutomation: (automation: Automation) => void;
|
|
updateAutomation: (automation: Automation) => void;
|
|
removeAutomation: (id: string) => void;
|
|
setAutomationRuns: (automationId: string, runs: AutomationRun[]) => void;
|
|
setAutomationRunsLoading: (automationId: string, loading: boolean) => void;
|
|
|
|
// Actions from all slices
|
|
hydrate: (state: Partial<AppState>, options?: HydrationOptions) => void;
|
|
setActiveWorkspace: (workspaceId: string | null) => void;
|
|
setWorkspaces: (workspaces: WorkspaceState["items"]) => void;
|
|
setActiveWorkflow: (workflowId: string | null) => void;
|
|
setWorkflows: (workflows: WorkflowsState["items"]) => void;
|
|
reorderWorkflowItems: (workflowIds: string[]) => void;
|
|
setWorkflowSnapshot: (
|
|
workflowId: string,
|
|
data: import("./slices/kanban/types").WorkflowSnapshotData,
|
|
) => void;
|
|
setKanbanMultiLoading: (loading: boolean) => void;
|
|
clearKanbanMulti: () => void;
|
|
updateMultiTask: (
|
|
workflowId: string,
|
|
task: import("./slices/kanban/types").KanbanState["tasks"][number],
|
|
) => void;
|
|
removeMultiTask: (workflowId: string, taskId: string) => void;
|
|
setExecutors: (executors: ExecutorsState["items"]) => void;
|
|
setSettingsAgents: (agents: SettingsAgentsState["items"]) => void;
|
|
setAgentDiscovery: (agents: AgentDiscoveryState["items"]) => void;
|
|
setAgentDiscoveryLoading: (loading: boolean) => void;
|
|
setAvailableAgents: (
|
|
agents: AvailableAgentsState["items"],
|
|
tools?: AvailableAgentsState["tools"],
|
|
) => void;
|
|
setAvailableAgentsLoading: (loading: boolean) => void;
|
|
setAgentProfiles: (profiles: AgentProfilesState["items"]) => void;
|
|
setInstallJobs: (jobs: import("@/lib/state/slices/settings/types").InstallJob[]) => void;
|
|
upsertInstallJob: (job: import("@/lib/state/slices/settings/types").InstallJob) => void;
|
|
appendInstallOutput: (agentName: string, chunk: string) => void;
|
|
clearInstallJob: (agentName: string) => void;
|
|
setRepositories: (workspaceId: string, repositories: Repository[]) => void;
|
|
setRepositoriesLoading: (workspaceId: string, loading: boolean) => void;
|
|
setRepositoryBranches: (
|
|
repositoryId: string,
|
|
branches: Branch[],
|
|
meta?: { fetchedAt?: string; fetchError?: string },
|
|
) => void;
|
|
setRepositoryBranchesLoading: (repositoryId: string, loading: boolean) => void;
|
|
setRepositoryBranchesFetchError: (repositoryId: string, error: string | undefined) => void;
|
|
setRepositoryScripts: (repositoryId: string, scripts: RepositoryScript[]) => void;
|
|
setRepositoryScriptsLoading: (repositoryId: string, loading: boolean) => void;
|
|
clearRepositoryScripts: (repositoryId: string) => void;
|
|
invalidateRepositories: (workspaceId: string) => void;
|
|
setSettingsData: (next: Partial<SettingsDataState>) => void;
|
|
setEditors: (editors: EditorsState["items"]) => void;
|
|
setEditorsLoading: (loading: boolean) => void;
|
|
setPrompts: (prompts: PromptsState["items"]) => void;
|
|
setPromptsLoading: (loading: boolean) => void;
|
|
setSecrets: (items: SecretsState["items"]) => void;
|
|
setSecretsLoading: (loading: boolean) => void;
|
|
addSecret: (item: import("@/lib/types/http-secrets").SecretListItem) => void;
|
|
updateSecret: (item: import("@/lib/types/http-secrets").SecretListItem) => void;
|
|
removeSecret: (id: string) => void;
|
|
setSpritesStatus: (status: import("@/lib/types/http-sprites").SpritesStatus) => void;
|
|
setSpritesInstances: (instances: import("@/lib/types/http-sprites").SpritesInstance[]) => void;
|
|
setSpritesLoading: (loading: boolean) => void;
|
|
removeSpritesInstance: (name: string) => void;
|
|
setNotificationProviders: (state: NotificationProvidersState) => void;
|
|
setNotificationProvidersLoading: (loading: boolean) => void;
|
|
setUserSettings: (settings: UserSettingsState) => void;
|
|
setTerminalOutput: (terminalId: string, data: string) => void;
|
|
appendShellOutput: (sessionId: string, data: string) => void;
|
|
setShellStatus: (
|
|
sessionId: string,
|
|
status: { available: boolean; running?: boolean; shell?: string; cwd?: string },
|
|
) => void;
|
|
clearShellOutput: (sessionId: string) => void;
|
|
appendProcessOutput: (processId: string, data: string) => void;
|
|
upsertProcessStatus: (status: ProcessStatusEntry) => void;
|
|
clearProcessOutput: (processId: string) => void;
|
|
setActiveProcess: (sessionId: string, processId: string) => void;
|
|
setPreviewOpen: (sessionId: string, open: boolean) => void;
|
|
togglePreviewOpen: (sessionId: string) => void;
|
|
setPreviewView: (sessionId: string, view: PreviewViewMode) => void;
|
|
setPreviewDevice: (sessionId: string, device: PreviewDevicePreset) => void;
|
|
setPreviewStage: (sessionId: string, stage: PreviewStage) => void;
|
|
setPreviewUrl: (sessionId: string, url: string) => void;
|
|
setPreviewUrlDraft: (sessionId: string, url: string) => void;
|
|
setRightPanelActiveTab: (sessionId: string, tab: string) => void;
|
|
setConnectionStatus: (status: ConnectionState["status"], error?: string | null) => void;
|
|
setMobileKanbanColumnIndex: (index: number) => void;
|
|
setMobileKanbanMenuOpen: (open: boolean) => void;
|
|
setMobileSessionPanel: (sessionId: string, panel: UISliceTypes.MobileSessionPanel) => void;
|
|
setMobileSessionTaskSwitcherOpen: (open: boolean) => void;
|
|
setPlanMode: (sessionId: string, enabled: boolean) => void;
|
|
setActiveDocument: (sessionId: string, doc: UISliceTypes.ActiveDocument | null) => void;
|
|
setSystemHealth: (response: SystemHealthResponse) => void;
|
|
setSystemHealthLoading: (loading: boolean) => void;
|
|
invalidateSystemHealth: () => void;
|
|
openQuickChat: (sessionId: string, workspaceId: string, agentProfileId?: string) => void;
|
|
closeQuickChat: () => void;
|
|
closeQuickChatSession: (sessionId: string) => void;
|
|
setActiveQuickChatSession: (sessionId: string) => void;
|
|
renameQuickChatSession: (sessionId: string, name: string) => void;
|
|
openConfigChat: (sessionId: string, workspaceId: string) => void;
|
|
startNewConfigChat: (workspaceId: string) => void;
|
|
closeConfigChat: () => void;
|
|
closeConfigChatSession: (sessionId: string) => void;
|
|
setActiveConfigChatSession: (sessionId: string) => void;
|
|
renameConfigChatSession: (sessionId: string, name: string) => void;
|
|
setSessionFailureNotification: (n: UISliceTypes.SessionFailureNotification | null) => void;
|
|
toggleBottomTerminal: () => void;
|
|
openBottomTerminalWithCommand: (command: string) => void;
|
|
clearBottomTerminalCommand: () => void;
|
|
setMessages: (
|
|
sessionId: string,
|
|
messages: Message[],
|
|
meta?: { hasMore?: boolean; oldestCursor?: string | null },
|
|
) => void;
|
|
addMessage: (message: Message) => void;
|
|
addTurn: (turn: Turn) => void;
|
|
completeTurn: (sessionId: string, turnId: string, completedAt: string) => void;
|
|
setActiveTurn: (sessionId: string, turnId: string | null) => void;
|
|
updateMessage: (message: Message) => void;
|
|
prependMessages: (
|
|
sessionId: string,
|
|
messages: Message[],
|
|
meta?: { hasMore?: boolean; oldestCursor?: string | null },
|
|
) => void;
|
|
setMessagesMetadata: (
|
|
sessionId: string,
|
|
meta: { hasMore?: boolean; isLoading?: boolean; oldestCursor?: string | null },
|
|
) => void;
|
|
setMessagesLoading: (sessionId: string, loading: boolean) => void;
|
|
setActiveSession: (taskId: string, sessionId: string) => void;
|
|
setActiveSessionAuto: (taskId: string, sessionId: string) => void;
|
|
setActiveTask: (taskId: string) => void;
|
|
clearActiveSession: () => void;
|
|
setTaskSession: (session: TaskSession) => void;
|
|
removeTaskSession: (taskId: string, sessionId: string) => void;
|
|
setTaskSessionsForTask: (taskId: string, sessions: TaskSession[]) => void;
|
|
upsertTaskSessionFromEvent: (taskId: string, session: TaskSession) => void;
|
|
setTaskSessionsLoading: (taskId: string, loading: boolean) => void;
|
|
setSessionAgentctlStatus: (sessionId: string, status: SessionAgentctlStatus) => void;
|
|
setWorktree: (worktree: Worktree) => void;
|
|
setSessionWorktrees: (sessionId: string, worktreeIds: string[]) => void;
|
|
setGitStatus: (sessionId: string, gitStatus: GitStatusEntry) => void;
|
|
clearGitStatus: (sessionId: string) => void;
|
|
registerSessionEnvironment: (sessionId: string, environmentId: string) => void;
|
|
setSessionCommits: (sessionId: string, commits: SessionCommit[]) => void;
|
|
setSessionCommitsLoading: (sessionId: string, loading: boolean) => void;
|
|
addSessionCommit: (sessionId: string, commit: SessionCommit) => void;
|
|
clearSessionCommits: (sessionId: string) => void;
|
|
setContextWindow: (sessionId: string, contextWindow: ContextWindowEntry) => void;
|
|
bumpAgentProfilesVersion: () => void;
|
|
setPendingModel: (sessionId: string, modelId: string) => void;
|
|
clearPendingModel: (sessionId: string) => void;
|
|
setActiveModel: (sessionId: string, modelId: string) => void;
|
|
// Task plan actions
|
|
setTaskPlan: (taskId: string, plan: import("@/lib/types/http").TaskPlan | null) => void;
|
|
setTaskPlanLoading: (taskId: string, loading: boolean) => void;
|
|
setTaskPlanSaving: (taskId: string, saving: boolean) => void;
|
|
clearTaskPlan: (taskId: string) => void;
|
|
markTaskPlanSeen: (taskId: string) => void;
|
|
// Plan revision actions
|
|
setPlanRevisions: (
|
|
taskId: string,
|
|
revisions: import("@/lib/types/http").TaskPlanRevision[],
|
|
) => void;
|
|
upsertPlanRevision: (
|
|
taskId: string,
|
|
revision: import("@/lib/types/http").TaskPlanRevision,
|
|
) => void;
|
|
setPlanRevisionsLoading: (taskId: string, loading: boolean) => void;
|
|
cachePlanRevisionContent: (revisionId: string, content: string) => void;
|
|
// Plan revision preview + compare actions
|
|
setPreviewRevision: (taskId: string, revisionId: string | null) => void;
|
|
toggleComparePair: (taskId: string, revisionId: string) => void;
|
|
clearComparePair: (taskId: string) => void;
|
|
// Queue actions
|
|
setQueueEntries: (
|
|
sessionId: string,
|
|
entries: import("./slices/session/types").QueuedMessage[],
|
|
meta: import("./slices/session/types").QueueMeta,
|
|
) => void;
|
|
removeQueueEntry: (sessionId: string, entryId: string) => void;
|
|
setQueueLoading: (sessionId: string, loading: boolean) => void;
|
|
clearQueueStatus: (sessionId: string) => void;
|
|
// Available commands actions
|
|
setAvailableCommands: (sessionId: string, commands: AvailableCommand[]) => void;
|
|
clearAvailableCommands: (sessionId: string) => void;
|
|
// Session mode actions
|
|
setSessionMode: (sessionId: string, modeId: string, availableModes?: SessionModeEntry[]) => void;
|
|
clearSessionMode: (sessionId: string) => void;
|
|
// Agent capabilities actions
|
|
setAgentCapabilities: (sessionId: string, caps: AgentCapabilitiesEntry) => void;
|
|
// Session models actions
|
|
setSessionModels: (
|
|
sessionId: string,
|
|
data: {
|
|
currentModelId: string;
|
|
models: SessionModelEntry[];
|
|
configOptions: ConfigOptionEntry[];
|
|
},
|
|
) => void;
|
|
// Prompt usage actions
|
|
setPromptUsage: (sessionId: string, usage: PromptUsageEntry) => void;
|
|
// Session todos actions
|
|
setSessionTodos: (sessionId: string, entries: TodoEntry[]) => void;
|
|
// User shells actions
|
|
setUserShells: (sessionId: string, shells: UserShellInfo[]) => void;
|
|
setUserShellsLoading: (sessionId: string, loading: boolean) => void;
|
|
addUserShell: (sessionId: string, shell: UserShellInfo) => void;
|
|
removeUserShell: (sessionId: string, terminalId: string) => void;
|
|
setSessionPollMode: (sessionId: string, mode: SessionPollMode) => void;
|
|
/* prettier-ignore */ setSidebarActiveView: UIA["setSidebarActiveView"];
|
|
updateSidebarDraft: UIA["updateSidebarDraft"];
|
|
saveSidebarDraftAs: UIA["saveSidebarDraftAs"];
|
|
saveSidebarDraftOverwrite: UIA["saveSidebarDraftOverwrite"];
|
|
discardSidebarDraft: UIA["discardSidebarDraft"];
|
|
deleteSidebarView: UIA["deleteSidebarView"];
|
|
renameSidebarView: UIA["renameSidebarView"];
|
|
duplicateSidebarView: UIA["duplicateSidebarView"];
|
|
reorderSidebarViews: UIA["reorderSidebarViews"];
|
|
toggleSidebarGroupCollapsed: UIA["toggleSidebarGroupCollapsed"];
|
|
toggleSubtaskCollapsed: UIA["toggleSubtaskCollapsed"];
|
|
clearSidebarSyncError: UIA["clearSidebarSyncError"];
|
|
migrateLocalViewsToBackend: UIA["migrateLocalViewsToBackend"];
|
|
setKanbanPreviewedTaskId: UIA["setKanbanPreviewedTaskId"];
|
|
togglePinnedTask: UIA["togglePinnedTask"];
|
|
setSidebarTaskOrder: UIA["setSidebarTaskOrder"];
|
|
setSubtaskOrder: UIA["setSubtaskOrder"];
|
|
removeTaskFromSidebarPrefs: UIA["removeTaskFromSidebarPrefs"];
|
|
// Office actions
|
|
setOfficeAgentProfiles: (agents: AgentProfile[]) => void;
|
|
addOfficeAgentProfile: (agent: AgentProfile) => void;
|
|
updateOfficeAgentProfile: (id: string, patch: Partial<AgentProfile>) => void;
|
|
removeOfficeAgentProfile: (id: string) => void;
|
|
setSkills: (skills: Skill[]) => void;
|
|
addSkill: (skill: Skill) => void;
|
|
updateSkill: (id: string, patch: Partial<Skill>) => void;
|
|
removeSkill: (id: string) => void;
|
|
setProjects: (projects: Project[]) => void;
|
|
addProject: (project: Project) => void;
|
|
updateProject: (id: string, patch: Partial<Project>) => void;
|
|
removeProject: (id: string) => void;
|
|
setApprovals: (approvals: Approval[]) => void;
|
|
setActivity: (entries: ActivityEntry[]) => void;
|
|
setCostSummary: (summary: CostSummary | null) => void;
|
|
setBudgetPolicies: (policies: BudgetPolicy[]) => void;
|
|
setRoutines: (routines: Routine[]) => void;
|
|
setInboxItems: (items: InboxItem[]) => void;
|
|
setInboxCount: (count: number) => void;
|
|
setRuns: (runs: Run[]) => void;
|
|
setDashboard: (data: DashboardData | null) => void;
|
|
setTasks: (tasks: OfficeTask[]) => void;
|
|
appendTasks: (tasks: OfficeTask[]) => void;
|
|
patchTaskInStore: (taskId: string, patch: Partial<OfficeTask>) => void;
|
|
setTaskFilters: (filters: Partial<TaskFilterState>) => void;
|
|
setTaskViewMode: (mode: TaskViewMode) => void;
|
|
setTaskSortField: (field: TaskSortField) => void;
|
|
setTaskSortDir: (dir: TaskSortDir) => void;
|
|
setTaskGroupBy: (groupBy: TaskGroupBy) => void;
|
|
toggleNesting: () => void;
|
|
setTasksLoading: (loading: boolean) => void;
|
|
setMeta: (meta: OfficeMeta | null) => void;
|
|
setOfficeLoading: (loading: boolean) => void;
|
|
setOfficeRefetchTrigger: (type: string) => void;
|
|
setWorkspaceRouting: (workspaceId: string, cfg: WorkspaceRouting | undefined) => void;
|
|
setKnownProviders: (providers: string[]) => void;
|
|
setRoutingPreview: (workspaceId: string, agents: AgentRoutePreview[]) => void;
|
|
setProviderHealth: (workspaceId: string, health: ProviderHealth[]) => void;
|
|
upsertProviderHealth: (workspaceId: string, row: ProviderHealth) => void;
|
|
setRunAttempts: (runId: string, attempts: RouteAttempt[]) => void;
|
|
appendRunAttempt: (runId: string, attempt: RouteAttempt) => void;
|
|
setAgentRouting: (agentId: string, data: AgentRouteData | undefined) => void;
|
|
};
|
|
|
|
export function createAppStore(initialState?: Partial<AppState>) {
|
|
const merged = mergeInitialState(initialState);
|
|
|
|
return createStore<AppState>()(
|
|
immer((set, get, api) => ({
|
|
...merged,
|
|
// Compose all slices
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
...createKanbanSlice(set as any, get as any, api as any),
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
...createWorkspaceSlice(set as any, get as any, api as any),
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
...createSettingsSlice(set as any, get as any, api as any),
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
...createSessionSlice(set as any, get as any, api as any),
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
...createSessionRuntimeSlice(set as any, get as any, api as any),
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
...createGitHubSlice(set as any, get as any, api as any),
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
...createGitLabSlice(set as any, get as any, api as any),
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
...createJiraSlice(set as any, get as any, api as any),
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
...createLinearSlice(set as any, get as any, api as any),
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
...createOfficeSlice(set as any, get as any, api as any),
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
...createFeaturesSlice(set as any, get as any, api as any),
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
...createUISlice(set as any, get as any, api as any),
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
...createAutomationsSlice(set as any, get as any, api as any),
|
|
// Override state with merged initial state
|
|
kanban: merged.kanban,
|
|
kanbanMulti: merged.kanbanMulti,
|
|
workflows: merged.workflows,
|
|
tasks: merged.tasks,
|
|
workspaces: merged.workspaces,
|
|
repositories: merged.repositories,
|
|
repositoryBranches: merged.repositoryBranches,
|
|
repositoryScripts: merged.repositoryScripts,
|
|
executors: merged.executors,
|
|
settingsAgents: merged.settingsAgents,
|
|
agentDiscovery: merged.agentDiscovery,
|
|
availableAgents: merged.availableAgents,
|
|
agentProfiles: merged.agentProfiles,
|
|
editors: merged.editors,
|
|
prompts: merged.prompts,
|
|
secrets: merged.secrets,
|
|
notificationProviders: merged.notificationProviders,
|
|
settingsData: merged.settingsData,
|
|
userSettings: merged.userSettings,
|
|
messages: merged.messages,
|
|
turns: merged.turns,
|
|
taskSessions: merged.taskSessions,
|
|
taskSessionsByTask: merged.taskSessionsByTask,
|
|
sessionAgentctl: merged.sessionAgentctl,
|
|
worktrees: merged.worktrees,
|
|
sessionWorktreesBySessionId: merged.sessionWorktreesBySessionId,
|
|
pendingModel: merged.pendingModel,
|
|
activeModel: merged.activeModel,
|
|
queue: merged.queue,
|
|
terminal: merged.terminal,
|
|
shell: merged.shell,
|
|
processes: merged.processes,
|
|
gitStatus: merged.gitStatus,
|
|
contextWindow: merged.contextWindow,
|
|
agents: merged.agents,
|
|
sessionMode: merged.sessionMode,
|
|
userShells: merged.userShells,
|
|
prepareProgress: merged.prepareProgress,
|
|
sessionTodos: merged.sessionTodos,
|
|
agentCapabilities: merged.agentCapabilities,
|
|
sessionModels: merged.sessionModels,
|
|
promptUsage: merged.promptUsage,
|
|
sessionPollMode: merged.sessionPollMode,
|
|
githubStatus: merged.githubStatus,
|
|
taskPRs: merged.taskPRs,
|
|
prWatches: merged.prWatches,
|
|
reviewWatches: merged.reviewWatches,
|
|
issueWatches: merged.issueWatches,
|
|
actionPresets: merged.actionPresets,
|
|
taskMRs: merged.taskMRs,
|
|
jiraIssueWatches: merged.jiraIssueWatches,
|
|
linearIssueWatches: merged.linearIssueWatches,
|
|
office: merged.office,
|
|
features: merged.features,
|
|
automations: merged.automations,
|
|
automationRuns: merged.automationRuns,
|
|
previewPanel: merged.previewPanel,
|
|
rightPanel: merged.rightPanel,
|
|
diffs: merged.diffs,
|
|
connection: merged.connection,
|
|
mobileKanban: merged.mobileKanban,
|
|
mobileSession: merged.mobileSession,
|
|
chatInput: merged.chatInput,
|
|
documentPanel: merged.documentPanel,
|
|
systemHealth: merged.systemHealth,
|
|
quickChat: merged.quickChat,
|
|
sessionFailureNotification: merged.sessionFailureNotification,
|
|
bottomTerminal: merged.bottomTerminal,
|
|
// Note: collapsedSubtaskParents is intentionally not overridden here —
|
|
// createUISlice hydrates it from sessionStorage and we want that to win.
|
|
// Add hydrate method
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
hydrate: (state, options) => set((draft) => hydrateState(draft as any, state, options)),
|
|
})),
|
|
);
|
|
}
|
|
|
|
export type StoreProviderProps = {
|
|
children: React.ReactNode;
|
|
initialState?: Partial<AppState>;
|
|
};
|