Help us shape the future of Go! Take the 2026 Go Developer Survey

handler

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 81 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentPrincipal

func CurrentPrincipal(c *app.RequestContext) (*model.AuthPrincipal, bool)

func IconCacheURL

func IconCacheURL(originalURL string) string

func PublicAgentIconURL

func PublicAgentIconURL(jobID, agentID string) string

func SetWorkspaceRootsProvider

func SetWorkspaceRootsProvider(provider func() []string)

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(ctx context.Context) (*Handler, error)

func NewHandlerForStartupCheck

func NewHandlerForStartupCheck(ctx context.Context) (*Handler, error)

NewHandlerForStartupCheck constructs the startup-critical service graph but skips asynchronous discovery and reconciliation. The caller runs it against isolated storage, so checking a candidate cannot mutate live state.

func (*Handler) AddRecentDir

func (h *Handler) AddRecentDir(ctx context.Context, c *app.RequestContext)

AddRecentDir adds a directory to the recent list.

func (*Handler) AgentAuthenticationAttempt

func (h *Handler) AgentAuthenticationAttempt(_ context.Context, c *app.RequestContext)

func (*Handler) AgentAuthenticationInfo

func (h *Handler) AgentAuthenticationInfo(ctx context.Context, c *app.RequestContext)

func (*Handler) AgentCatalog

func (h *Handler) AgentCatalog(ctx context.Context, c *app.RequestContext)

AgentCatalog returns the complete management directory: ordered built-ins followed by persisted custom entries.

func (*Handler) AgentCatalogDetail

func (h *Handler) AgentCatalogDetail(ctx context.Context, c *app.RequestContext)

func (*Handler) AgentDisplayInfoResolve

func (h *Handler) AgentDisplayInfoResolve(ctx context.Context, c *app.RequestContext)

AgentDisplayInfoResolve batch-resolves historical Agent references (session serve commands, graph node snapshot agent types) to their minimal display projection. Identifiers that match no retained record are simply absent from the result — the client renders those as an unknown Agent.

func (*Handler) AgentInstall

func (h *Handler) AgentInstall(ctx context.Context, c *app.RequestContext)

AgentInstall runs the preset install flow for one built-in agent. The request only carries an AgentID; the executed commands always come from the catalog. The executed steps' full output, the install recheck, and the ACP validation result are returned verbatim in the result payload.

func (*Handler) AgentInstallCandidates

func (h *Handler) AgentInstallCandidates(ctx context.Context, c *app.RequestContext)

AgentInstallCandidates lists built-in agents that are not installed and not deprecated, with their preset install method and instructions. Manual-only entries are included (the UI shows their guide instead of an install button).

func (*Handler) AgentList

func (h *Handler) AgentList(ctx context.Context, c *app.RequestContext)

func (*Handler) AgentUninstall

func (h *Handler) AgentUninstall(ctx context.Context, c *app.RequestContext)

AgentUninstall runs the platform-specific automatic uninstall flow for one built-in agent. The request only carries the AgentID in the route; every executed command is declared by the catalog. The executed steps' full output and the post-uninstall recheck are returned verbatim in the result payload.

func (*Handler) AgentUpgrade

func (h *Handler) AgentUpgrade(ctx context.Context, c *app.RequestContext)

AgentUpgrade re-runs one installed built-in Agent's catalog-controlled install flow. No command or package name is accepted from the client.

func (*Handler) AgentUsage

func (h *Handler) AgentUsage(ctx context.Context, c *app.RequestContext)

AgentUsage returns live subscription / quota information for a supported ACP agent. Clients refresh when the selected agent changes, so this endpoint does not use an HTTP cache. Errors are returned in full per the project convention.

func (*Handler) AgentVersion

func (h *Handler) AgentVersion(ctx context.Context, c *app.RequestContext)

AgentVersion returns the installed CLI version of a known built-in or custom ACP agent, keyed by AgentInfo.Type. It backs the composer usage strip for agents that have no quota view of their own.

func (*Handler) AgentVersionCheck

func (h *Handler) AgentVersionCheck(ctx context.Context, c *app.RequestContext)

AgentVersionCheck returns the installed component versions for the Agent management directory. `force=1` bypasses the short process-local cache for the explicit "check again" action in the UI.

func (*Handler) AuthChangePassword

func (h *Handler) AuthChangePassword(_ context.Context, c *app.RequestContext)

func (*Handler) AuthInit

func (h *Handler) AuthInit(_ context.Context, c *app.RequestContext)

func (*Handler) AuthLogin

func (h *Handler) AuthLogin(_ context.Context, c *app.RequestContext)

func (*Handler) AuthLogout

func (h *Handler) AuthLogout(_ context.Context, c *app.RequestContext)

func (*Handler) AuthMe

func (h *Handler) AuthMe(_ context.Context, c *app.RequestContext)

func (*Handler) AuthStatus

func (h *Handler) AuthStatus() (auth.State, string)

func (*Handler) AuthUpdateProfile

func (h *Handler) AuthUpdateProfile(_ context.Context, c *app.RequestContext)

func (*Handler) CancelAgentAuthentication

func (h *Handler) CancelAgentAuthentication(_ context.Context, c *app.RequestContext)

func (*Handler) CancelStopJobGraphRun

func (h *Handler) CancelStopJobGraphRun(ctx context.Context, c *app.RequestContext)

CancelStopJobGraphRun cancels a pending step/session stop, returning the run to running.

func (*Handler) CodexAccountList

func (h *Handler) CodexAccountList(ctx context.Context, c *app.RequestContext)

func (*Handler) CodexAccountLogin

func (h *Handler) CodexAccountLogin(_ context.Context, c *app.RequestContext)

func (*Handler) CodexAccountLoginCancel

func (h *Handler) CodexAccountLoginCancel(_ context.Context, c *app.RequestContext)

func (*Handler) CodexAccountLoginState

func (h *Handler) CodexAccountLoginState(_ context.Context, c *app.RequestContext)

func (*Handler) CodexAccountMutate

func (h *Handler) CodexAccountMutate(ctx context.Context, c *app.RequestContext)

func (*Handler) ContinueJobGraphRun

func (h *Handler) ContinueJobGraphRun(ctx context.Context, c *app.RequestContext)

ContinueJobGraphRun continues a GraphRun parked at「等待人工」on its bound Job (§5 讨论完成/续跑): the user finished discussing in the clarify node session and clicked「讨论完成」. The clarify instances are finalized (capturing each session's discussion 结论 into their output variables) and the DAG resumes.

func (*Handler) CreateCustomAgent

func (h *Handler) CreateCustomAgent(ctx context.Context, c *app.RequestContext)

func (*Handler) CreateEinoModel

func (h *Handler) CreateEinoModel(ctx context.Context, c *app.RequestContext)

func (*Handler) CreateGraphWorkflow

func (h *Handler) CreateGraphWorkflow(ctx context.Context, c *app.RequestContext)

CreateGraphWorkflow persists a new GraphWorkflow after full static validation. On validation failure it returns 400 with the complete list of located errors (not just a summary), so the frontend can pin every offending node/edge/variable/config key.

func (*Handler) CustomAgentDeleteImpact

func (h *Handler) CustomAgentDeleteImpact(ctx context.Context, c *app.RequestContext)

func (*Handler) DeleteCustomAgent

func (h *Handler) DeleteCustomAgent(ctx context.Context, c *app.RequestContext)

func (*Handler) DeleteEinoModel

func (h *Handler) DeleteEinoModel(ctx context.Context, c *app.RequestContext)

func (*Handler) DeleteGraphWorkflow

func (h *Handler) DeleteGraphWorkflow(ctx context.Context, c *app.RequestContext)

func (*Handler) DeleteJobGraphRun

func (h *Handler) DeleteJobGraphRun(ctx context.Context, c *app.RequestContext)

DeleteJobGraphRun deletes a non-in-flight GraphRun, cascading its artifacts.

func (*Handler) DeleteOrphanMessagePresets

func (h *Handler) DeleteOrphanMessagePresets(_ context.Context, c *app.RequestContext)

func (*Handler) DeletedAgentCatalog

func (h *Handler) DeletedAgentCatalog(ctx context.Context, c *app.RequestContext)

func (*Handler) EffectiveMessagePresets

func (h *Handler) EffectiveMessagePresets(_ context.Context, c *app.RequestContext)

func (*Handler) FileExists

func (h *Handler) FileExists(ctx context.Context, c *app.RequestContext)

func (*Handler) FileShareCreate

func (h *Handler) FileShareCreate(_ context.Context, c *app.RequestContext)

func (*Handler) FileShareDelete

func (h *Handler) FileShareDelete(_ context.Context, c *app.RequestContext)

func (*Handler) FileShareGet

func (h *Handler) FileShareGet(_ context.Context, c *app.RequestContext)

func (*Handler) GetAuthService

func (h *Handler) GetAuthService() *auth.Service

GetAuthService exposes authentication state to route middleware and health.

func (*Handler) GetEinoModelList

func (h *Handler) GetEinoModelList(ctx context.Context, c *app.RequestContext)

func (*Handler) GetEinoSystemPrompt

func (h *Handler) GetEinoSystemPrompt(ctx context.Context, c *app.RequestContext)

func (*Handler) GetGlobalMessagePresets

func (h *Handler) GetGlobalMessagePresets(_ context.Context, c *app.RequestContext)

func (*Handler) GetGraphWorkflow

func (h *Handler) GetGraphWorkflow(ctx context.Context, c *app.RequestContext)

func (*Handler) GetGroupReplyAgent

func (h *Handler) GetGroupReplyAgent(ctx context.Context, c *app.RequestContext)

func (*Handler) GetIMGateway

func (h *Handler) GetIMGateway() *imGateway

GetIMGateway exposes the shared gateway for HTTP handlers that need to read pending-contact state (see wechat_login_api.go).

func (*Handler) GetIMSessionAgent

func (h *Handler) GetIMSessionAgent(ctx context.Context, c *app.RequestContext)

func (*Handler) GetJobGraphRunStatus

func (h *Handler) GetJobGraphRunStatus(ctx context.Context, c *app.RequestContext)

func (*Handler) GetJobService

func (h *Handler) GetJobService() job.Service

GetJobService returns the handler's job service for use during shutdown.

func (*Handler) GetPrompt

func (h *Handler) GetPrompt(ctx context.Context, c *app.RequestContext)

func (*Handler) GetRecentDirs

func (h *Handler) GetRecentDirs(ctx context.Context, c *app.RequestContext)

GetRecentDirs returns the list of recently used directories.

func (*Handler) GetScheduleService

func (h *Handler) GetScheduleService() schedule.Service

GetScheduleService returns the handler's schedule service for reuse by the scheduler.

func (*Handler) GetSessionMessages

func (h *Handler) GetSessionMessages(ctx context.Context, c *app.RequestContext)

func (*Handler) GetSessionTokenUsage

func (h *Handler) GetSessionTokenUsage(ctx context.Context, c *app.RequestContext)

GetSessionTokenUsage keeps the full-history token scan off the paged message critical path. Clients request it after the latest page is already visible.

func (*Handler) GetSettings

func (h *Handler) GetSettings(ctx context.Context, c *app.RequestContext)

func (*Handler) GetSettingsService

func (h *Handler) GetSettingsService() config.SettingsService

GetSettingsService exposes the settings service for handlers outside this file (e.g. wechat_login_api.go).

func (*Handler) GetTitleGenerationAgent

func (h *Handler) GetTitleGenerationAgent(ctx context.Context, c *app.RequestContext)

func (*Handler) GetUsageStats

func (h *Handler) GetUsageStats() usagestats.Service

GetUsageStats exposes the usage-stats service so the main shutdown path can flush pending writes before exit and any future feature can read without going through the Handler.

func (*Handler) GetWeChatManager

func (h *Handler) GetWeChatManager() *wechatlisten.Manager

GetWeChatManager exposes the WeChat listener manager for Restart() calls from wechat_login_api.go after credentials are saved / deleted.

func (*Handler) GetWorkspaceMessagePresets

func (h *Handler) GetWorkspaceMessagePresets(_ context.Context, c *app.RequestContext)

func (*Handler) GitBranch

func (h *Handler) GitBranch(ctx context.Context, c *app.RequestContext)

GitBranch reports the current git branch for a directory so the composer's workspace tag can show it next to the path. Returns an empty branch string when the directory is not inside a git repository (or HEAD is detached).

func (*Handler) IconProxy

func (h *Handler) IconProxy(ctx context.Context, c *app.RequestContext)

func (*Handler) JobCreate

func (h *Handler) JobCreate(ctx context.Context, c *app.RequestContext)

func (*Handler) JobDelete

func (h *Handler) JobDelete(ctx context.Context, c *app.RequestContext)

func (*Handler) JobEvents

func (h *Handler) JobEvents(ctx context.Context, c *app.RequestContext)

func (*Handler) JobGet

func (h *Handler) JobGet(ctx context.Context, c *app.RequestContext)

func (*Handler) JobGraphRunEvents

func (h *Handler) JobGraphRunEvents(ctx context.Context, c *app.RequestContext)

func (*Handler) JobGraphRunHooks

func (h *Handler) JobGraphRunHooks(ctx context.Context, c *app.RequestContext)

JobGraphRunHooks returns the per-node hook (§ 节点 Hook) execution results for a job's current graph run, so the run-view node-detail panel can show what each node's side-effect script did (exit code, stdout, stderr). Mirrors GetJobGraphRunStatus's job→run resolution and not-found mapping.

func (*Handler) JobList

func (h *Handler) JobList(ctx context.Context, c *app.RequestContext)

func (*Handler) JobMessage

func (h *Handler) JobMessage(ctx context.Context, c *app.RequestContext)

func (*Handler) JobMessageQueue

func (h *Handler) JobMessageQueue(_ context.Context, c *app.RequestContext)

func (*Handler) JobMessageQueueContinue

func (h *Handler) JobMessageQueueContinue(ctx context.Context, c *app.RequestContext)

func (*Handler) JobMessageQueueDelete

func (h *Handler) JobMessageQueueDelete(ctx context.Context, c *app.RequestContext)

func (*Handler) JobObservations

func (h *Handler) JobObservations(ctx context.Context, c *app.RequestContext)

func (*Handler) JobShare

func (h *Handler) JobShare(ctx context.Context, c *app.RequestContext)

func (*Handler) JobStop

func (h *Handler) JobStop(ctx context.Context, c *app.RequestContext)

func (*Handler) JobUnshare

func (h *Handler) JobUnshare(ctx context.Context, c *app.RequestContext)

func (*Handler) JobUpdatePin

func (h *Handler) JobUpdatePin(ctx context.Context, c *app.RequestContext)

func (*Handler) JobUpdateTitle

func (h *Handler) JobUpdateTitle(ctx context.Context, c *app.RequestContext)

func (*Handler) JobViewerState

func (h *Handler) JobViewerState(ctx context.Context, c *app.RequestContext)

JobViewerState updates a live viewer's on-screen state. It is a presence report, not a state mutation: an unknown or already-detached viewerId is a no-op (applied=false) rather than an error, because the client may report a visibility change just after its stream was torn down.

func (*Handler) ListDir

func (h *Handler) ListDir(ctx context.Context, c *app.RequestContext)

ListDir returns subdirectories under the given path for browser-based directory picking.

func (*Handler) ListGraphWorkflows

func (h *Handler) ListGraphWorkflows(ctx context.Context, c *app.RequestContext)

func (*Handler) ListOrphanMessagePresets

func (h *Handler) ListOrphanMessagePresets(_ context.Context, c *app.RequestContext)

func (*Handler) LogsClear

func (h *Handler) LogsClear(ctx context.Context, c *app.RequestContext)

LogsClear wipes the in-memory ring buffer. The UI calls this when the user hits the "Clear" button.

func (*Handler) LogsFrontendReport

func (h *Handler) LogsFrontendReport(ctx context.Context, c *app.RequestContext)

LogsFrontendReport accepts one or more browser log entries in a batch.

func (*Handler) LogsList

func (h *Handler) LogsList(ctx context.Context, c *app.RequestContext)

LogsList returns recent backend + frontend log entries matching the supplied filters. The UI polls this endpoint a few times per second when the logs tab is open.

func (*Handler) LogsSetLevel

func (h *Handler) LogsSetLevel(ctx context.Context, c *app.RequestContext)

LogsSetLevel changes the runtime log level. Unknown values return 400 so the UI can surface a validation error instead of silently succeeding.

func (*Handler) MkDir

func (h *Handler) MkDir(ctx context.Context, c *app.RequestContext)

MkDir creates a new directory under the given parent path.

func (*Handler) PermissionList

func (h *Handler) PermissionList(_ context.Context, c *app.RequestContext)

func (*Handler) PublicGetSessionMessages

func (h *Handler) PublicGetSessionMessages(ctx context.Context, c *app.RequestContext)

PublicGetSessionMessages serves session messages for a shared job. It validates that the requested sessionId belongs to the shared job.

func (*Handler) PublicJobAgentIcon

func (h *Handler) PublicJobAgentIcon(ctx context.Context, c *app.RequestContext)

PublicJobAgentIcon serves one catalog icon only after the share middleware has validated the Job token and this handler has verified that the requested Agent is actually referenced by that Job. The caller never supplies an upstream URL, so the public endpoint cannot be used as a general SSRF proxy.

func (*Handler) PublicReadFile

func (h *Handler) PublicReadFile(_ context.Context, c *app.RequestContext)

func (*Handler) PublicServeFile

func (h *Handler) PublicServeFile(ctx context.Context, c *app.RequestContext)

PublicServeFile serves files for a shared job, restricted to the job's session directory and the global uploads directory (for user-uploaded attachments).

func (*Handler) PublicServeSharedFile

func (h *Handler) PublicServeSharedFile(_ context.Context, c *app.RequestContext)

func (*Handler) ReadFile

func (h *Handler) ReadFile(ctx context.Context, c *app.RequestContext)

func (*Handler) RebindOrphanMessagePresets

func (h *Handler) RebindOrphanMessagePresets(_ context.Context, c *app.RequestContext)

func (*Handler) RestoreCustomAgent

func (h *Handler) RestoreCustomAgent(ctx context.Context, c *app.RequestContext)

func (*Handler) ResumeJobGraphRun

func (h *Handler) ResumeJobGraphRun(ctx context.Context, c *app.RequestContext)

ResumeJobGraphRun relaunches a resumable GraphRun on its bound Job.

func (*Handler) RevalidateAgent

func (h *Handler) RevalidateAgent(ctx context.Context, c *app.RequestContext)

func (*Handler) RoleCreate

func (h *Handler) RoleCreate(_ context.Context, c *app.RequestContext)

func (*Handler) RoleDelete

func (h *Handler) RoleDelete(_ context.Context, c *app.RequestContext)

func (*Handler) RoleGet

func (h *Handler) RoleGet(_ context.Context, c *app.RequestContext)

func (*Handler) RoleList

func (h *Handler) RoleList(_ context.Context, c *app.RequestContext)

func (*Handler) RoleUpdate

func (h *Handler) RoleUpdate(_ context.Context, c *app.RequestContext)

func (*Handler) SaveAgentEnvVars

func (h *Handler) SaveAgentEnvVars(ctx context.Context, c *app.RequestContext)

func (*Handler) SaveAgentPrefs

func (h *Handler) SaveAgentPrefs(ctx context.Context, c *app.RequestContext)

func (*Handler) SaveEinoSystemPrompt

func (h *Handler) SaveEinoSystemPrompt(ctx context.Context, c *app.RequestContext)

func (*Handler) SaveGlobalMessagePresets

func (h *Handler) SaveGlobalMessagePresets(_ context.Context, c *app.RequestContext)

func (*Handler) SaveGroupReplyAgent

func (h *Handler) SaveGroupReplyAgent(ctx context.Context, c *app.RequestContext)

func (*Handler) SaveIMSessionAgent

func (h *Handler) SaveIMSessionAgent(ctx context.Context, c *app.RequestContext)

func (*Handler) SaveLanguage

func (h *Handler) SaveLanguage(ctx context.Context, c *app.RequestContext)

func (*Handler) SavePrompt

func (h *Handler) SavePrompt(ctx context.Context, c *app.RequestContext)

func (*Handler) SaveSettings

func (h *Handler) SaveSettings(ctx context.Context, c *app.RequestContext)

func (*Handler) SaveTitleGenerationAgent

func (h *Handler) SaveTitleGenerationAgent(ctx context.Context, c *app.RequestContext)

func (*Handler) SaveWorkspaceMessagePresets

func (h *Handler) SaveWorkspaceMessagePresets(_ context.Context, c *app.RequestContext)

func (*Handler) ScheduleCreate

func (h *Handler) ScheduleCreate(ctx context.Context, c *app.RequestContext)

func (*Handler) ScheduleDelete

func (h *Handler) ScheduleDelete(ctx context.Context, c *app.RequestContext)

func (*Handler) ScheduleGet

func (h *Handler) ScheduleGet(ctx context.Context, c *app.RequestContext)

func (*Handler) ScheduleList

func (h *Handler) ScheduleList(ctx context.Context, c *app.RequestContext)

func (*Handler) ScheduleRun

func (h *Handler) ScheduleRun(ctx context.Context, c *app.RequestContext)

func (*Handler) ScheduleToggle

func (h *Handler) ScheduleToggle(ctx context.Context, c *app.RequestContext)

func (*Handler) ScheduleTrigger

func (h *Handler) ScheduleTrigger(ctx context.Context, task *model.ScheduledTask) (string, error)

ScheduleTrigger creates and starts a job for the given scheduled task. It launches a GraphRun from the referenced workflow template.

func (*Handler) ScheduleUpdate

func (h *Handler) ScheduleUpdate(ctx context.Context, c *app.RequestContext)

func (*Handler) SearchFiles

func (h *Handler) SearchFiles(ctx context.Context, c *app.RequestContext)

SearchFiles searches for files matching a keyword under the given directory.

func (*Handler) ServeFile

func (h *Handler) ServeFile(ctx context.Context, c *app.RequestContext)

ServeFile returns raw file content with proper Content-Type for image preview etc.

func (*Handler) SessionStopJobGraphRun

func (h *Handler) SessionStopJobGraphRun(ctx context.Context, c *app.RequestContext)

SessionStopJobGraphRun stops before the next new Agent session.

func (*Handler) SetACPConfig

func (h *Handler) SetACPConfig(ctx context.Context, c *app.RequestContext)

SetACPConfig applies an ACP live-config switch (model / mode / thought_level) and returns the refreshed selector lists. With a sessionId it switches on that session's live ACP agent and persists the new selection to the session; without one it updates and refreshes the Home selector cache for agentType.

func (*Handler) SetScheduler

func (h *Handler) SetScheduler(scheduler *schedule.Scheduler)

SetScheduler sets the scheduler on the handler. Called after NewHandler to wire up the scheduler with the handler's job creation logic.

func (*Handler) SkillAdd

func (h *Handler) SkillAdd(ctx context.Context, c *app.RequestContext)

SkillAdd installs a skill package.

func (*Handler) SkillFind

func (h *Handler) SkillFind(ctx context.Context, c *app.RequestContext)

SkillFind searches the public skills registry.

func (*Handler) SkillInstallProjectTools

func (h *Handler) SkillInstallProjectTools(ctx context.Context, c *app.RequestContext)

SkillInstallProjectTools installs the quartet-cli binary and every skill shipped by the current Quartet checkout through the skills service.

func (*Handler) SkillList

func (h *Handler) SkillList(ctx context.Context, c *app.RequestContext)

SkillList returns installed skills for one scope from cache.

func (*Handler) SkillRemove

func (h *Handler) SkillRemove(ctx context.Context, c *app.RequestContext)

SkillRemove uninstalls a skill.

func (*Handler) SkillUpdate

func (h *Handler) SkillUpdate(ctx context.Context, c *app.RequestContext)

SkillUpdate upgrades every installed skill in one scope to its latest version.

There is deliberately no "check for updates" endpoint: the skills CLI's `check` verb is an alias of `update`, so a check-shaped endpoint would write while pretending to only read.

func (*Handler) StartAgentAuthentication

func (h *Handler) StartAgentAuthentication(ctx context.Context, c *app.RequestContext)

func (*Handler) StartGraphRun

func (h *Handler) StartGraphRun(ctx context.Context, c *app.RequestContext)

func (*Handler) StartIMListeners

func (h *Handler) StartIMListeners(ctx context.Context)

StartIMListeners starts all IM platform listeners in sequence. Used from cmd/web/main.go; per-platform Start* helpers remain public so settings/ restart flows can target them individually.

func (*Handler) StatsSystem

func (h *Handler) StatsSystem(ctx context.Context, c *app.RequestContext)

StatsSystem returns current resource usage for the backend machine.

func (*Handler) StatsUsage

func (h *Handler) StatsUsage(ctx context.Context, c *app.RequestContext)

StatsUsage returns the aggregated usage report for a date range.

Query parameters (all optional):

  • from: YYYY-MM-DD. Defaults to today minus defaultStatsLookbackDays.
  • to: YYYY-MM-DD. Defaults to today.

Both bounds are inclusive. Pass `from=` (empty value) plus `all=1` to request the on-disk earliest month (All Time) — the picker uses this to short-circuit the 30-day default when the user picks "All".

func (*Handler) StepStopJobGraphRun

func (h *Handler) StepStopJobGraphRun(ctx context.Context, c *app.RequestContext)

StepStopJobGraphRun freezes the current ready batch and stops after it.

func (*Handler) StopIMListeners

func (h *Handler) StopIMListeners()

StopIMListeners stops every IM platform listener that StartIMListeners brought up. Called from cmd/web/main.go's shutdown path BEFORE HTTP shutdown so the listeners' WebSocket / long-poll goroutines unwind under our control instead of being torn down implicitly when the root context cancels — the implicit teardown path produces a misleading "lark/sdk receive message failed: ... use of closed network connection" WARN on every restart even though the close is fully expected.

func (*Handler) StopJobGraphRun

func (h *Handler) StopJobGraphRun(ctx context.Context, c *app.RequestContext)

StopJobGraphRun hard-stops a running GraphRun bound to a Job.

func (*Handler) SystemRestartWeb

func (h *Handler) SystemRestartWeb(ctx context.Context, c *app.RequestContext)

SystemRestartWeb synchronously builds and boots a candidate release on an isolated ephemeral listener. Only that validated candidate is handed to the detached process switch, which rolls back if the live launch is not ready.

func (*Handler) UpdateCustomAgent

func (h *Handler) UpdateCustomAgent(ctx context.Context, c *app.RequestContext)

func (*Handler) UpdateGraphWorkflow

func (h *Handler) UpdateGraphWorkflow(ctx context.Context, c *app.RequestContext)

func (*Handler) UpdateJobGraphRunVersion

func (h *Handler) UpdateJobGraphRunVersion(ctx context.Context, c *app.RequestContext)

UpdateGraphRunVersion appends a new graph version after validating the edit against persisted run state. For live runs the scheduler applies the new version to not-yet-started instances while in-flight/completed instances keep their execution-time version.

func (*Handler) UploadFile

func (h *Handler) UploadFile(ctx context.Context, c *app.RequestContext)

func (*Handler) UserCreate

func (h *Handler) UserCreate(_ context.Context, c *app.RequestContext)

func (*Handler) UserDelete

func (h *Handler) UserDelete(_ context.Context, c *app.RequestContext)

func (*Handler) UserGet

func (h *Handler) UserGet(_ context.Context, c *app.RequestContext)

func (*Handler) UserList

func (h *Handler) UserList(_ context.Context, c *app.RequestContext)

func (*Handler) UserResetPassword

func (h *Handler) UserResetPassword(_ context.Context, c *app.RequestContext)

func (*Handler) UserUpdate

func (h *Handler) UserUpdate(_ context.Context, c *app.RequestContext)

func (*Handler) ValidateGraphWorkflow

func (h *Handler) ValidateGraphWorkflow(ctx context.Context, c *app.RequestContext)

ValidateGraphWorkflow runs the static legality check without persisting and always returns 200 with {valid, errors}.

func (*Handler) WeChatAccounts

func (h *Handler) WeChatAccounts(ctx context.Context, c *app.RequestContext)

WeChatAccounts lists the currently-logged-in account. Only non-sensitive fields (bot / user IDs) leak to the frontend — BotToken and BaseURL stay server-side. The account carries a "status" that reflects whether the backing iLink session is still usable: "online" when the monitor is running cleanly, "expired" when iLink has latched errcode=-14 with empty sync buf (bot_token dead). The frontend renders the expired state as "已掉线 · 请重新扫码".

v1 is single-account: the runtime listener/replier only drive creds[0] (see pkg/messaging/wechat/types.go and pkg/messaging/wechat/listener.go). We truncate the response to match that reality so the UI can't show phantom "online" accounts for stale files left on disk.

func (*Handler) WeChatAdminAdd

func (h *Handler) WeChatAdminAdd(ctx context.Context, c *app.RequestContext)

WeChatAdminAdd adds a sender ID to the admin whitelist. Typically called from the pending-contact UI's "加为 admin" button. After adding, the corresponding pending entry is cleared so it doesn't keep showing.

func (*Handler) WeChatAdminRemove

func (h *Handler) WeChatAdminRemove(ctx context.Context, c *app.RequestContext)

WeChatAdminRemove drops a sender ID from the admin whitelist. Rejects removing the currently logged-in account's ILinkUserID — the login account should stay a valid admin as long as it's logged in (matches the "自己 · 不可删" UI affordance). Remove the credentials first (/logout) if the user truly wants to drop it.

func (*Handler) WeChatLoginStart

func (h *Handler) WeChatLoginStart(ctx context.Context, c *app.RequestContext)

WeChatLoginStart triggers an iLink get_bot_qrcode call and returns a PNG QR code the frontend can display. The returned `qrcode` handle is passed back to /wechat/login/status to poll for confirmation.

func (*Handler) WeChatLoginStatus

func (h *Handler) WeChatLoginStatus(ctx context.Context, c *app.RequestContext)

WeChatLoginStatus long-polls iLink for the scan-to-login confirmation and returns as soon as a meaningful state change occurs:

  • "wait" — no scan yet (or 90s budget elapsed); frontend re-polls.
  • "scaned" — user scanned the QR on their phone but hasn't tapped confirm; frontend shows "已扫描,请在手机上确认" and re-polls.
  • "confirmed" — credentials saved, listener restarted, admin seeded.
  • "expired" — the QR handle itself died; frontend must restart login.

Returning early on "scaned" is what gives the user the mid-scan UI update that doc §4.2 calls out; otherwise the server would sit on this handler for the full 90s and the browser would be stuck at "请扫码".

func (*Handler) WeChatLogout

func (h *Handler) WeChatLogout(ctx context.Context, c *app.RequestContext)

WeChatLogout deletes the credentials file for a bot ID and restarts the listener so it drops the now-stale client. Also removes the account's ILinkUserID from the admin whitelist (best-effort).

func (*Handler) WeChatOutboxGet

func (h *Handler) WeChatOutboxGet(ctx context.Context, c *app.RequestContext)

func (*Handler) WeChatOutboxStatus

func (h *Handler) WeChatOutboxStatus(_ context.Context, c *app.RequestContext)

func (*Handler) WeChatPending

func (h *Handler) WeChatPending(ctx context.Context, c *app.RequestContext)

WeChatPending returns the pending-contact ring buffer (most-recent first). Frontend renders this as the "waiting for approval" list.

func (*Handler) WeChatPendingDismiss

func (h *Handler) WeChatPendingDismiss(ctx context.Context, c *app.RequestContext)

WeChatPendingDismiss drops a pending-contact entry without adding to the whitelist — used for the "ignore" button in the pending list UI.

func (*Handler) WeChatSend

func (h *Handler) WeChatSend(ctx context.Context, c *app.RequestContext)

WeChatSend persists proactive messages into the durable outbox. A single background worker owns chunking, rate limiting and retries; this request never calls WeChat directly.

Recipients default to the WeChat admin whitelist (settings.wechat_admin_ids) when the request does not name explicit toUserIds.

func (*Handler) WorkspaceCreate

func (h *Handler) WorkspaceCreate(ctx context.Context, c *app.RequestContext)

func (*Handler) WorkspaceDefaultWorkdir

func (h *Handler) WorkspaceDefaultWorkdir(ctx context.Context, c *app.RequestContext)

WorkspaceDefaultWorkdir returns the path the new-workspace dialog should prefill into its workdir picker. Mirrors the same fallback chain EnsureDefault uses (FileManager UserHomeDir → $HOME → FileManager TempDir) so the suggested path is always valid for immediate creation.

func (*Handler) WorkspaceDelete

func (h *Handler) WorkspaceDelete(ctx context.Context, c *app.RequestContext)

func (*Handler) WorkspaceGet

func (h *Handler) WorkspaceGet(ctx context.Context, c *app.RequestContext)

func (*Handler) WorkspaceList

func (h *Handler) WorkspaceList(ctx context.Context, c *app.RequestContext)

func (*Handler) WorkspaceRegenerateColors

func (h *Handler) WorkspaceRegenerateColors(ctx context.Context, c *app.RequestContext)

WorkspaceRegenerateColors assigns a new random color to every workspace and returns the refreshed list, letting the settings UI re-roll the whole palette when the initial colors happen to clash.

func (*Handler) WorkspaceReorder

func (h *Handler) WorkspaceReorder(ctx context.Context, c *app.RequestContext)

func (*Handler) WorkspaceUpdate

func (h *Handler) WorkspaceUpdate(ctx context.Context, c *app.RequestContext)

func (*Handler) WorkspaceUpdateFavorite

func (h *Handler) WorkspaceUpdateFavorite(ctx context.Context, c *app.RequestContext)

func (*Handler) WriteFile

func (h *Handler) WriteFile(ctx context.Context, c *app.RequestContext)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL