api

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApiRoutes

func ApiRoutes(router *http.ServeMux)

func HandleAuthorization

func HandleAuthorization(w http.ResponseWriter, r *http.Request)

func HandleCallMethod added in v0.28.0

func HandleCallMethod(w http.ResponseWriter, r *http.Request)

HandleCallMethod accepts JSON-RPC 2.0 requests in three forms:

  • Single request: {"jsonrpc":"2.0","method":"...","params":{},"id":1}
  • Batch: [{"jsonrpc":"2.0","method":"...","id":1},{...}]
  • Notification: {"jsonrpc":"2.0","method":"...","params":{}} (no id)

Single requests return a single JSON-RPC response object. Batch requests return a JSON array of responses. Notifications produce no response entry. If all items in a batch are notifications the HTTP response is 204.

func HandleClearAuthBlocks added in v0.33.0

func HandleClearAuthBlocks(w http.ResponseWriter, r *http.Request)

HandleClearAuthBlocks flushes all auth rate-limit state (failed-login counters and active blocks) so blocked IPs can log in again immediately. Clearing is gossiped so the whole cluster flushes together.

func HandleCreateCommand added in v0.29.0

func HandleCreateCommand(w http.ResponseWriter, r *http.Request)

func HandleCreateEventSink added in v0.28.0

func HandleCreateEventSink(w http.ResponseWriter, r *http.Request)

func HandleCreateGroup

func HandleCreateGroup(w http.ResponseWriter, r *http.Request)

func HandleCreateMCPServer added in v0.29.0

func HandleCreateMCPServer(w http.ResponseWriter, r *http.Request)

func HandleCreatePool added in v0.28.0

func HandleCreatePool(w http.ResponseWriter, r *http.Request)

func HandleCreateRole

func HandleCreateRole(w http.ResponseWriter, r *http.Request)

func HandleCreateScript added in v0.23.0

func HandleCreateScript(w http.ResponseWriter, r *http.Request)

func HandleCreateSkill added in v0.23.0

func HandleCreateSkill(w http.ResponseWriter, r *http.Request)

func HandleCreateSpace

func HandleCreateSpace(w http.ResponseWriter, r *http.Request)

func HandleCreateStackDefinition added in v0.24.0

func HandleCreateStackDefinition(w http.ResponseWriter, r *http.Request)

func HandleCreateTemplate

func HandleCreateTemplate(w http.ResponseWriter, r *http.Request)

func HandleCreateTemplateVar

func HandleCreateTemplateVar(w http.ResponseWriter, r *http.Request)

func HandleCreateToken

func HandleCreateToken(w http.ResponseWriter, r *http.Request)

func HandleCreateUser

func HandleCreateUser(w http.ResponseWriter, r *http.Request)

func HandleCreateVolume

func HandleCreateVolume(w http.ResponseWriter, r *http.Request)

func HandleDeleteCommand added in v0.29.0

func HandleDeleteCommand(w http.ResponseWriter, r *http.Request)

func HandleDeleteEventSink added in v0.28.0

func HandleDeleteEventSink(w http.ResponseWriter, r *http.Request)

func HandleDeleteGroup

func HandleDeleteGroup(w http.ResponseWriter, r *http.Request)

func HandleDeleteMCPServer added in v0.29.0

func HandleDeleteMCPServer(w http.ResponseWriter, r *http.Request)

func HandleDeletePool added in v0.28.0

func HandleDeletePool(w http.ResponseWriter, r *http.Request)

func HandleDeleteRole

func HandleDeleteRole(w http.ResponseWriter, r *http.Request)

func HandleDeleteScript added in v0.23.0

func HandleDeleteScript(w http.ResponseWriter, r *http.Request)

func HandleDeleteSessions

func HandleDeleteSessions(w http.ResponseWriter, r *http.Request)

func HandleDeleteSkill added in v0.23.0

func HandleDeleteSkill(w http.ResponseWriter, r *http.Request)

func HandleDeleteSpace

func HandleDeleteSpace(w http.ResponseWriter, r *http.Request)

func HandleDeleteSpaceFile added in v0.31.0

func HandleDeleteSpaceFile(w http.ResponseWriter, r *http.Request)

HandleDeleteSpaceFile removes a file or directory from a space. A recursive delete uses os.RemoveAll semantics; a non-recursive delete on a non-empty directory fails. Missing paths are treated as success so the call is idempotent — important for sync tools whose "delete list" was computed against a slightly stale remote snapshot.

func HandleDeleteStackDefinition added in v0.24.0

func HandleDeleteStackDefinition(w http.ResponseWriter, r *http.Request)

func HandleDeleteTemplate

func HandleDeleteTemplate(w http.ResponseWriter, r *http.Request)

func HandleDeleteTemplateVar

func HandleDeleteTemplateVar(w http.ResponseWriter, r *http.Request)

func HandleDeleteToken

func HandleDeleteToken(w http.ResponseWriter, r *http.Request)

func HandleDeleteTunnel

func HandleDeleteTunnel(w http.ResponseWriter, r *http.Request)

func HandleDeleteUser

func HandleDeleteUser(w http.ResponseWriter, r *http.Request)

func HandleDeleteVolume

func HandleDeleteVolume(w http.ResponseWriter, r *http.Request)

func HandleEditFile added in v0.30.0

func HandleEditFile(w http.ResponseWriter, r *http.Request)

HandleEditFile performs a targeted search-and-replace edit in a space.

func HandleEmitEvent added in v0.28.0

func HandleEmitEvent(w http.ResponseWriter, r *http.Request)

HandleEmitEvent raises a custom event from within a space. It is used by the space-side scriptling knot.event.emit() via the apiclient MuxClient.

func HandleEmitUserEvent added in v0.28.1

func HandleEmitUserEvent(w http.ResponseWriter, r *http.Request)

HandleEmitUserEvent raises a user-scoped custom event from a server-side script context (e.g. MCP tool execution) where there is no associated space. It is the target of the loopback knot.event.emit() library registered in the MCP scriptling environment.

func HandleExecuteScript added in v0.23.0

func HandleExecuteScript(w http.ResponseWriter, r *http.Request)

func HandleExecuteScriptStream added in v0.23.0

func HandleExecuteScriptStream(w http.ResponseWriter, r *http.Request)

func HandleExportAuditLogs added in v0.24.0

func HandleExportAuditLogs(w http.ResponseWriter, r *http.Request)

func HandleExportTemplate added in v0.32.0

func HandleExportTemplate(w http.ResponseWriter, r *http.Request)

HandleExportTemplate returns a portable YAML representation of a template suitable for version control and cross-instance import.

func HandleFind added in v0.30.0

func HandleFind(w http.ResponseWriter, r *http.Request)

HandleFind finds files/directories in a space.

func HandleGetAuditLogs

func HandleGetAuditLogs(w http.ResponseWriter, r *http.Request)

func HandleGetBaseImages added in v0.32.0

func HandleGetBaseImages(w http.ResponseWriter, r *http.Request)

HandleGetBaseImages returns the active base image manifest (embedded or external per server config). The Image field's ${{ .server.base_image_registry }} is left as-is; resolution happens at deploy time in the spec itself.

func HandleGetCapabilities added in v0.32.0

func HandleGetCapabilities(w http.ResponseWriter, r *http.Request)

HandleGetCapabilities returns the Linux capability catalog the wizard's capability picker renders (name + description, searchable client-side). The list is a static common subset; unknown-but-well-formed CAP_* names already present in a spec still round-trip through the wizard.

func HandleGetClusterInfo

func HandleGetClusterInfo(w http.ResponseWriter, r *http.Request)

func HandleGetClusterNode added in v0.22.0

func HandleGetClusterNode(w http.ResponseWriter, r *http.Request)

func HandleGetCommand added in v0.29.0

func HandleGetCommand(w http.ResponseWriter, r *http.Request)

func HandleGetCommands added in v0.29.0

func HandleGetCommands(w http.ResponseWriter, r *http.Request)

func HandleGetEventSink added in v0.28.0

func HandleGetEventSink(w http.ResponseWriter, r *http.Request)

func HandleGetEventSinks added in v0.28.0

func HandleGetEventSinks(w http.ResponseWriter, r *http.Request)

func HandleGetGlobalScripts added in v0.23.0

func HandleGetGlobalScripts(w http.ResponseWriter, r *http.Request)

HandleGetGlobalScripts returns global scripts for template editing. Users with PermissionManageTemplates can see global scripts even without PermissionManageScripts.

func HandleGetGroup

func HandleGetGroup(w http.ResponseWriter, r *http.Request)

func HandleGetGroups

func HandleGetGroups(w http.ResponseWriter, r *http.Request)

func HandleGetIcons added in v0.23.0

func HandleGetIcons(w http.ResponseWriter, r *http.Request)

func HandleGetMCPServer added in v0.29.0

func HandleGetMCPServer(w http.ResponseWriter, r *http.Request)

func HandleGetMCPServers added in v0.29.0

func HandleGetMCPServers(w http.ResponseWriter, r *http.Request)

func HandleGetMethods added in v0.28.0

func HandleGetMethods(w http.ResponseWriter, r *http.Request)

func HandleGetOwnNavPreferences added in v0.32.0

func HandleGetOwnNavPreferences(w http.ResponseWriter, r *http.Request)

HandleGetOwnNavPreferences returns the current user's pinned (starred) sidebar URLs in their stored display order.

func HandleGetPermissions

func HandleGetPermissions(w http.ResponseWriter, r *http.Request)

func HandleGetPool added in v0.28.0

func HandleGetPool(w http.ResponseWriter, r *http.Request)

func HandleGetPools added in v0.28.0

func HandleGetPools(w http.ResponseWriter, r *http.Request)

func HandleGetRole

func HandleGetRole(w http.ResponseWriter, r *http.Request)

func HandleGetRoles

func HandleGetRoles(w http.ResponseWriter, r *http.Request)

func HandleGetScript added in v0.23.0

func HandleGetScript(w http.ResponseWriter, r *http.Request)

func HandleGetScriptByName added in v0.23.0

func HandleGetScriptByName(w http.ResponseWriter, r *http.Request)

func HandleGetScriptDetailsByName added in v0.23.0

func HandleGetScriptDetailsByName(w http.ResponseWriter, r *http.Request)

func HandleGetScriptLibsZip added in v0.33.0

func HandleGetScriptLibsZip(w http.ResponseWriter, r *http.Request)

HandleGetScriptLibsZip serves the requesting user's `lib` scripts (their own plus global libraries, user overriding global on name collisions) packaged as a scriptling library zip: manifest.toml + lib/<name>.py. Agents fetch and cache this and re-serve it to in-space scriptling as /packages/libs.zip.

func HandleGetScripts added in v0.23.0

func HandleGetScripts(w http.ResponseWriter, r *http.Request)

func HandleGetServerInfo added in v0.26.0

func HandleGetServerInfo(w http.ResponseWriter, r *http.Request)

HandleGetServerInfo returns server-wide configuration that clients need but that is not user-specific (e.g. the wildcard domain used to build space web-port URLs).

func HandleGetSessions

func HandleGetSessions(w http.ResponseWriter, r *http.Request)

func HandleGetSkill added in v0.23.0

func HandleGetSkill(w http.ResponseWriter, r *http.Request)

func HandleGetSkills added in v0.23.0

func HandleGetSkills(w http.ResponseWriter, r *http.Request)

func HandleGetSpace

func HandleGetSpace(w http.ResponseWriter, r *http.Request)

func HandleGetSpaceCustomField added in v0.21.5

func HandleGetSpaceCustomField(w http.ResponseWriter, r *http.Request)

func HandleGetSpaceJobs added in v0.33.0

func HandleGetSpaceJobs(w http.ResponseWriter, r *http.Request)

HandleGetSpaceJobs returns the space's persisted job definitions and runner state. Works for stopped spaces too — the space record is the source of truth, only live run status needs the agent.

func HandleGetSpaceUsageCurrent added in v0.24.0

func HandleGetSpaceUsageCurrent(w http.ResponseWriter, r *http.Request)

func HandleGetSpaceUsageHistory added in v0.24.0

func HandleGetSpaceUsageHistory(w http.ResponseWriter, r *http.Request)

func HandleGetSpaces

func HandleGetSpaces(w http.ResponseWriter, r *http.Request)

func HandleGetStackDefinition added in v0.24.0

func HandleGetStackDefinition(w http.ResponseWriter, r *http.Request)

func HandleGetStackDefinitions added in v0.24.0

func HandleGetStackDefinitions(w http.ResponseWriter, r *http.Request)

func HandleGetTemplate

func HandleGetTemplate(w http.ResponseWriter, r *http.Request)

func HandleGetTemplateNodes added in v0.22.0

func HandleGetTemplateNodes(w http.ResponseWriter, r *http.Request)

func HandleGetTemplateVar

func HandleGetTemplateVar(w http.ResponseWriter, r *http.Request)

func HandleGetTemplateVars

func HandleGetTemplateVars(w http.ResponseWriter, r *http.Request)

func HandleGetTemplates

func HandleGetTemplates(w http.ResponseWriter, r *http.Request)

func HandleGetTokens

func HandleGetTokens(w http.ResponseWriter, r *http.Request)

func HandleGetTunnelServerInfo

func HandleGetTunnelServerInfo(w http.ResponseWriter, r *http.Request)

func HandleGetTunnels

func HandleGetTunnels(w http.ResponseWriter, r *http.Request)

func HandleGetUser

func HandleGetUser(w http.ResponseWriter, r *http.Request)

func HandleGetUserHasPermission added in v0.23.0

func HandleGetUserHasPermission(w http.ResponseWriter, r *http.Request)

func HandleGetUserPermissions added in v0.23.0

func HandleGetUserPermissions(w http.ResponseWriter, r *http.Request)

func HandleGetUserQuota

func HandleGetUserQuota(w http.ResponseWriter, r *http.Request)

func HandleGetUsers

func HandleGetUsers(w http.ResponseWriter, r *http.Request)

func HandleGetVolume

func HandleGetVolume(w http.ResponseWriter, r *http.Request)

func HandleGetVolumeNodes added in v0.23.6

func HandleGetVolumeNodes(w http.ResponseWriter, r *http.Request)

func HandleGetVolumes

func HandleGetVolumes(w http.ResponseWriter, r *http.Request)

func HandleGrep added in v0.30.0

func HandleGrep(w http.ResponseWriter, r *http.Request)

HandleGrep searches file contents in a space.

func HandleImportTemplate added in v0.32.0

func HandleImportTemplate(w http.ResponseWriter, r *http.Request)

HandleImportTemplate accepts a portable YAML template export, resolves script names to IDs, and creates the template via the existing create path.

func HandleListMCPServerTools added in v0.29.0

func HandleListMCPServerTools(w http.ResponseWriter, r *http.Request)

func HandleLogout

func HandleLogout(w http.ResponseWriter, r *http.Request)

func HandlePing

func HandlePing(w http.ResponseWriter, r *http.Request)

func HandlePoolStart added in v0.28.0

func HandlePoolStart(w http.ResponseWriter, r *http.Request)

func HandlePoolStop added in v0.28.0

func HandlePoolStop(w http.ResponseWriter, r *http.Request)

func HandleReadSpaceFile added in v0.23.0

func HandleReadSpaceFile(w http.ResponseWriter, r *http.Request)

func HandleRefreshBaseImages added in v0.32.0

func HandleRefreshBaseImages(w http.ResponseWriter, r *http.Request)

HandleRefreshBaseImages forces an immediate fetch of the base image manifest. It uses the same FetchDecision as the startup path: it fetches iff --base-images-update-enabled is on and (no manifest file is set, or a manifest file is set AND an explicit --base-images-update-url is given). The fetched copy overlays the baseline only when its manifest_version is newer. Exposed via the `knot admin refresh-base-images` CLI command.

func HandleRunCommand added in v0.23.0

func HandleRunCommand(w http.ResponseWriter, r *http.Request)

func HandleSSE added in v0.21.8

func HandleSSE(w http.ResponseWriter, r *http.Request)

HandleSSE handles Server-Sent Events connections for real-time updates

func HandleSearch added in v0.32.0

func HandleSearch(w http.ResponseWriter, r *http.Request)

HandleSearch performs a permission-, ownership- and zone-scoped keyword search across the entity types the current user may see. Matching is a case-insensitive substring match on each entity's primary name. Each result group is capped at searchLimitPerType entries; empty groups are omitted.

Scoping mirrors the sidebar visibility gates:

  • spaces are the current user's own plus any shared with them;
  • admin entities (templates, variables, volumes, users, groups, roles, stacks, event sinks) appear only when the user holds the manage permission for that type;
  • personal entities (scripts, skills, slash commands, MCP servers, tokens) are scoped to the user's own (plus global ones where the list endpoint exposes them);
  • leaf nodes get the same reduced set as the sidebar (no users/groups/roles).

func HandleSearchSkills added in v0.23.0

func HandleSearchSkills(w http.ResponseWriter, r *http.Request)

func HandleSed added in v0.30.0

func HandleSed(w http.ResponseWriter, r *http.Request)

HandleSed performs in-place edits or capture extraction in a space.

func HandleSetPoolSize added in v0.28.0

func HandleSetPoolSize(w http.ResponseWriter, r *http.Request)

func HandleSetSpaceCustomField added in v0.21.5

func HandleSetSpaceCustomField(w http.ResponseWriter, r *http.Request)

func HandleSpaceAddShare

func HandleSpaceAddShare(w http.ResponseWriter, r *http.Request)

func HandleSpaceRemoveShare

func HandleSpaceRemoveShare(w http.ResponseWriter, r *http.Request)

func HandleSpaceRestart

func HandleSpaceRestart(w http.ResponseWriter, r *http.Request)

func HandleSpaceStart

func HandleSpaceStart(w http.ResponseWriter, r *http.Request)

func HandleSpaceStop

func HandleSpaceStop(w http.ResponseWriter, r *http.Request)

func HandleSpaceStopUsersSpaces

func HandleSpaceStopUsersSpaces(w http.ResponseWriter, r *http.Request)

func HandleSpaceTransfer

func HandleSpaceTransfer(w http.ResponseWriter, r *http.Request)

func HandleSpecBuild added in v0.32.0

func HandleSpecBuild(w http.ResponseWriter, r *http.Request)

HandleSpecBuild converts a unified spec back into native text. On the Nomad side this patches the wizard's fields into the original HCL; on the container side it regenerates from the spec. See BuildNomadHCL / BuildContainerYAML for the per-platform behaviour.

func HandleSpecParse added in v0.32.0

func HandleSpecParse(w http.ResponseWriter, r *http.Request)

HandleSpecParse converts a native template spec into the unified JSON the wizard edits. Returns wizardable=false if the spec is too complex for the wizard (multi-task Nomad job, unparseable HCL, unsupported driver, etc.); the UI uses that flag to disable the wizard button.

func HandleStackDelete added in v0.26.2

func HandleStackDelete(w http.ResponseWriter, r *http.Request)

func HandleStackExists added in v0.30.1

func HandleStackExists(w http.ResponseWriter, r *http.Request)

HandleStackExists reports whether a stack name is already in use for the requesting user (i.e. there is at least one non-deleted space with that Stack). Used by the create-stack flows to refuse reusing an existing stack name, which would otherwise mix spaces from different stack instances.

func HandleStackRestart added in v0.24.0

func HandleStackRestart(w http.ResponseWriter, r *http.Request)

func HandleStackStart added in v0.24.0

func HandleStackStart(w http.ResponseWriter, r *http.Request)

func HandleStackStop added in v0.24.0

func HandleStackStop(w http.ResponseWriter, r *http.Request)

func HandleToggleMCPServerTool added in v0.29.0

func HandleToggleMCPServerTool(w http.ResponseWriter, r *http.Request)

func HandleUpdateCommand added in v0.29.0

func HandleUpdateCommand(w http.ResponseWriter, r *http.Request)

func HandleUpdateEventSink added in v0.28.0

func HandleUpdateEventSink(w http.ResponseWriter, r *http.Request)

func HandleUpdateGroup

func HandleUpdateGroup(w http.ResponseWriter, r *http.Request)

func HandleUpdateMCPServer added in v0.29.0

func HandleUpdateMCPServer(w http.ResponseWriter, r *http.Request)

func HandleUpdateOwnNavPreferences added in v0.32.0

func HandleUpdateOwnNavPreferences(w http.ResponseWriter, r *http.Request)

HandleUpdateOwnNavPreferences replaces the current user's pinned sidebar ordering. URLs are validated against apiclient.ValidNavURLs and de-duplicated (preserving order); an empty slice clears the preference, returning the sidebar to its default layout. The canonical stored order is returned.

func HandleUpdateOwnSSHPrivateKey added in v0.25.0

func HandleUpdateOwnSSHPrivateKey(w http.ResponseWriter, r *http.Request)

func HandleUpdateOwnSSHPublicKey added in v0.25.0

func HandleUpdateOwnSSHPublicKey(w http.ResponseWriter, r *http.Request)

func HandleUpdatePool added in v0.28.0

func HandleUpdatePool(w http.ResponseWriter, r *http.Request)

func HandleUpdateRole

func HandleUpdateRole(w http.ResponseWriter, r *http.Request)

func HandleUpdateScript added in v0.23.0

func HandleUpdateScript(w http.ResponseWriter, r *http.Request)

func HandleUpdateSkill added in v0.23.0

func HandleUpdateSkill(w http.ResponseWriter, r *http.Request)

func HandleUpdateSpace

func HandleUpdateSpace(w http.ResponseWriter, r *http.Request)

func HandleUpdateSpaceJobs added in v0.33.0

func HandleUpdateSpaceJobs(w http.ResponseWriter, r *http.Request)

HandleUpdateSpaceJobs replaces the space's job definitions and runner state, then pushes the change to the agent when the space is running.

func HandleUpdateStackDefinition added in v0.24.0

func HandleUpdateStackDefinition(w http.ResponseWriter, r *http.Request)

func HandleUpdateTemplate

func HandleUpdateTemplate(w http.ResponseWriter, r *http.Request)

func HandleUpdateTemplateVar

func HandleUpdateTemplateVar(w http.ResponseWriter, r *http.Request)

func HandleUpdateToken added in v0.28.0

func HandleUpdateToken(w http.ResponseWriter, r *http.Request)

HandleUpdateToken allows changing a token's name and/or scopes without recreating it (the token ID stays the same, so callers don't need to re-credential).

func HandleUpdateUser

func HandleUpdateUser(w http.ResponseWriter, r *http.Request)

func HandleUpdateVolume

func HandleUpdateVolume(w http.ResponseWriter, r *http.Request)

func HandleUsingTotp

func HandleUsingTotp(w http.ResponseWriter, r *http.Request)

Returns if the server is using TOTP or not, the CLI client uses this to work out the authentication flow it should use.

func HandleValidateStackDefinition added in v0.24.0

func HandleValidateStackDefinition(w http.ResponseWriter, r *http.Request)

func HandleValidateTemplate added in v0.24.0

func HandleValidateTemplate(w http.ResponseWriter, r *http.Request)

func HandleValidateVolume added in v0.24.0

func HandleValidateVolume(w http.ResponseWriter, r *http.Request)

func HandleVolumeStart

func HandleVolumeStart(w http.ResponseWriter, r *http.Request)

func HandleVolumeStop

func HandleVolumeStop(w http.ResponseWriter, r *http.Request)

func HandleWhoAmI

func HandleWhoAmI(w http.ResponseWriter, r *http.Request)

func HandleWriteSpaceFile added in v0.23.0

func HandleWriteSpaceFile(w http.ResponseWriter, r *http.Request)

Types

type AvailableNode added in v0.22.0

type AvailableNode struct {
	NodeId        string `json:"node_id"`
	Hostname      string `json:"hostname"`
	RunningSpaces int    `json:"running_spaces"`
	TotalSpaces   int    `json:"total_spaces"`
}

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error" msgpack:"error"`
}

type JobsErrorResponse added in v0.33.0

type JobsErrorResponse struct {
	Error     string            `json:"error"`
	JobErrors map[string]string `json:"job_errors,omitempty"`
}

JobsErrorResponse is the 400 body from the jobs update endpoint: JobErrors maps each invalid job name to its validation error.

type MethodListResponse added in v0.28.0

type MethodListResponse struct {
	Count   int                  `json:"count" msgpack:"count"`
	Methods []methods.MethodInfo `json:"methods" msgpack:"methods"`
}

type ReadFileRequest added in v0.23.0

type ReadFileRequest struct {
	Path   string `json:"path" msgpack:"path"`
	Offset int    `json:"offset,omitempty" msgpack:"offset,omitempty"` // 1-based line number to start at (0/absent = from beginning)
	Limit  int    `json:"limit,omitempty" msgpack:"limit,omitempty"`   // max lines to return (0/absent = no limit)
}

type ReadFileResponse added in v0.23.0

type ReadFileResponse struct {
	Success    bool   `json:"success" msgpack:"success"`
	Content    string `json:"content,omitempty" msgpack:"content,omitempty"`
	Size       int    `json:"size,omitempty" msgpack:"size,omitempty"`
	TotalLines int    `json:"total_lines,omitempty" msgpack:"total_lines,omitempty"` // total lines in the file (only when offset/limit used)
	Offset     int    `json:"offset,omitempty" msgpack:"offset,omitempty"`           // applied offset (1-based, only when offset/limit used)
	Limit      int    `json:"limit,omitempty" msgpack:"limit,omitempty"`             // applied limit (only when offset/limit used)
	Error      string `json:"error,omitempty" msgpack:"error,omitempty"`
}

type RunCommandRequest added in v0.23.0

type RunCommandRequest struct {
	Command string   `json:"command" msgpack:"command"`
	Args    []string `json:"args,omitempty" msgpack:"args,omitempty"`
	Timeout int      `json:"timeout" msgpack:"timeout"`
	Workdir string   `json:"workdir,omitempty" msgpack:"workdir,omitempty"`
}

type RunCommandResponse added in v0.23.0

type RunCommandResponse struct {
	Success bool   `json:"success" msgpack:"success"`
	Output  string `json:"output,omitempty" msgpack:"output,omitempty"`
	Error   string `json:"error,omitempty" msgpack:"error,omitempty"`
}

type UnifiedScriptExecuteRequest added in v0.23.0

type UnifiedScriptExecuteRequest struct {
	ScriptId   string   `json:"script_id,omitempty" msgpack:"script_id,omitempty"`
	ScriptName string   `json:"script_name,omitempty" msgpack:"script_name,omitempty"`
	Content    string   `json:"content,omitempty" msgpack:"content,omitempty"`
	Arguments  []string `json:"arguments" msgpack:"arguments"`
}

type WriteFileRequest added in v0.23.0

type WriteFileRequest struct {
	Path    string `json:"path" msgpack:"path"`
	Content string `json:"content" msgpack:"content"`
	Mode    string `json:"mode,omitempty" msgpack:"mode,omitempty"`

	// SymlinkTarget, when set, creates a symlink at Path pointing to this
	// target instead of writing content. Used by knot mirror for symlinks.
	SymlinkTarget string `json:"symlink_target,omitempty" msgpack:"symlink_target,omitempty"`

	// Sync metadata (optional). When set, the agent applies them after the
	// write so the destination file matches the source's mtime and permission
	// bits — used by knot sync tools (copy --recursive, watch).
	MtimeNs  int64  `json:"mtime_ns,omitempty" msgpack:"mtime_ns,omitempty"`
	FilePerm uint32 `json:"file_perm,omitempty" msgpack:"file_perm,omitempty"`
}

type WriteFileResponse added in v0.23.0

type WriteFileResponse struct {
	Success      bool   `json:"success" msgpack:"success"`
	BytesWritten int    `json:"bytes_written,omitempty" msgpack:"bytes_written,omitempty"`
	Error        string `json:"error,omitempty" msgpack:"error,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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