bot

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NodeSourceExplicit 显式配置指定(bot 级可选 node 路径字段,V1 无 UI 只留结构)。
	NodeSourceExplicit = "explicit-config"
	// NodeSourceManagedScan 节点本地扫描发现。
	NodeSourceManagedScan = "managed-scan"
	// NodeSourcePathFallback 回退 PATH 里的 "node"。
	NodeSourcePathFallback = "path-fallback"
)

Node 可执行解析来源(进 bot 启动日志,供真机核对选用了哪条链路)。

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionEvent added in v0.19.0

type ActionEvent struct {
	BotID            string          `json:"botId"`
	SessionID        string          `json:"sessionId"`
	Generation       int64           `json:"generation"`
	ActionRunID      string          `json:"actionRunId"`
	StepID           string          `json:"stepId"`
	Attempt          int             `json:"attempt"`
	Status           string          `json:"status"`
	ErrorCode        string          `json:"errorCode,omitempty"`
	Message          string          `json:"message,omitempty"`
	CorrelationToken string          `json:"correlationToken,omitempty"`
	Result           json.RawMessage `json:"result,omitempty"`
	DurationMS       int64           `json:"durationMs,omitempty"`
	ObservedAt       int64           `json:"observedAt,omitempty"`
}

ActionEvent 是 Bot Worker 上报的类型化动作事件。

type ActionSignal added in v0.19.0

type ActionSignal struct {
	SignalID         string          `json:"signalId"`
	BotID            string          `json:"botId"`
	SessionID        string          `json:"sessionId"`
	Generation       int64           `json:"generation"`
	ActionRunID      string          `json:"actionRunId"`
	StepID           string          `json:"stepId"`
	Type             string          `json:"type"`
	CorrelationToken string          `json:"correlationToken,omitempty"`
	Payload          json.RawMessage `json:"payload,omitempty"`
	ObservedAt       int64           `json:"observedAt,omitempty"`
}

ActionSignal 外部 probe/barrier/cancel 动作信号。

type BotCapacitySnapshot added in v0.19.0

type BotCapacitySnapshot struct {
	Ready                 bool
	Legacy                bool
	MaxBots               int
	ActiveBots            int
	ConnectingBots        int
	CapacityGeneration    int64
	WorkerEpoch           string
	WorkerEpochGeneration int64
	BotWorkerVersion      string
	RSSBytes              int64
	EventLoopP95Ms        float64
	DroppedEvents         int64
	Features              []string
	ObservedAt            time.Time
	UnavailableReason     string
}

BotCapacitySnapshot 描述当前 bot-worker 的 fleet 准入与利用率。

type BotConfig

type BotConfig struct {
	ID               string          `json:"id"`
	Name             string          `json:"name"`
	Host             string          `json:"host"`
	Port             int             `json:"port"`
	Username         string          `json:"username,omitempty"`
	Version          string          `json:"version,omitempty"`
	Auth             string          `json:"auth,omitempty"`
	Behavior         string          `json:"behavior,omitempty"`
	BehaviorConfig   interface{}     `json:"behaviorConfig,omitempty"`
	Server           string          `json:"server,omitempty"`
	SessionID        string          `json:"sessionId,omitempty"`
	Generation       int64           `json:"generation,omitempty"`
	ConfigHash       string          `json:"configHash,omitempty"`
	CohortKey        string          `json:"cohortKey,omitempty"`
	Scenario         json.RawMessage `json:"scenario,omitempty"`
	ResumeStepID     string          `json:"resumeStepId,omitempty"`
	ConnectNotBefore int64           `json:"connectNotBefore,omitempty"`
	CorrelationSeed  string          `json:"correlationSeed,omitempty"`
}

BotConfig Bot 配置(下发给 Bot Worker)。

type BotEvent

type BotEvent struct {
	BotID string                 `json:"botId"`
	Type  string                 `json:"type"`
	Data  map[string]interface{} `json:"data,omitempty"`
}

BotEvent Bot 事件。

type BotItemResult added in v0.19.0

type BotItemResult struct {
	BotID     string `json:"botId"`
	Accepted  bool   `json:"accepted"`
	Skipped   bool   `json:"skipped"`
	Status    string `json:"status,omitempty"`
	ErrorCode string `json:"errorCode,omitempty"`
	Error     string `json:"error,omitempty"`
}

BotItemResult create-bots/stop-bots 的逐 Bot 回执。

type BotState

type BotState struct {
	ID                    string  `json:"id"`
	Status                string  `json:"status"`
	Name                  string  `json:"name,omitempty"`
	Health                float64 `json:"health,omitempty"`
	Food                  int     `json:"food,omitempty"`
	Position              *Vec3   `json:"position,omitempty"`
	Behavior              string  `json:"behavior,omitempty"`
	SessionID             string  `json:"sessionId,omitempty"`
	Generation            int64   `json:"generation,omitempty"`
	ConfigHash            string  `json:"configHash,omitempty"`
	WorkerEpoch           string  `json:"workerEpoch,omitempty"`
	WorkerEpochGeneration int64   `json:"workerEpochGeneration,omitempty"`
	EventSeq              int64   `json:"eventSeq,omitempty"`
	CurrentStepID         string  `json:"currentStepId,omitempty"`
	ReconnectCount        int     `json:"reconnectCount,omitempty"`
	ErrorCode             string  `json:"errorCode,omitempty"`
	LastError             string  `json:"lastError,omitempty"`
	ObservedAt            int64   `json:"observedAt,omitempty"`
}

BotState Bot 状态。

type BotWorkerEvent

type BotWorkerEvent struct {
	Evt              string                      `json:"evt"`
	RequestID        string                      `json:"requestId,omitempty"`
	BatchID          string                      `json:"batchId,omitempty"`
	IdempotencyKey   string                      `json:"idempotencyKey,omitempty"`
	Bots             []BotState                  `json:"bots,omitempty"`
	Results          []BotItemResult             `json:"results,omitempty"`
	SignalResults    []SignalItemResult          `json:"signalResults,omitempty"`
	CommandResults   []CommandScheduleItemResult `json:"commandResults,omitempty"`
	ScheduleRunID    string                      `json:"scheduleRunId,omitempty"`
	Accepted         bool                        `json:"accepted,omitempty"`
	AlreadyReleased  bool                        `json:"alreadyReleased,omitempty"`
	AlreadyCancelled bool                        `json:"alreadyCancelled,omitempty"`
	ErrorCode        string                      `json:"errorCode,omitempty"`
	Action           *ActionEvent                `json:"action,omitempty"`
	BotID            string                      `json:"botId,omitempty"`
	Type             string                      `json:"type,omitempty"`
	Data             json.RawMessage             `json:"data,omitempty"`
	Error            string                      `json:"error,omitempty"`
	ScriptID         string                      `json:"scriptId,omitempty"`
	Progress         int                         `json:"progress,omitempty"`
	Total            int                         `json:"total,omitempty"`
	Status           string                      `json:"status,omitempty"`
	Step             string                      `json:"step,omitempty"`
	// FR-369 command-schedule-result 异步 occurrence 终态。
	CommandResult         *CommandScheduleResultPayload `json:"commandScheduleResult,omitempty"`
	WorkerEpoch           string                        `json:"workerEpoch,omitempty"`
	WorkerEpochGeneration int64                         `json:"workerEpochGeneration,omitempty"`
	BotWorkerVersion      string                        `json:"botWorkerVersion,omitempty"`
	MaxBots               int                           `json:"maxBots,omitempty"`
	Features              []string                      `json:"features,omitempty"`
	ActiveBots            int                           `json:"activeBots,omitempty"`
	ConnectingBots        int                           `json:"connectingBots,omitempty"`
	RSSBytes              int64                         `json:"rssBytes,omitempty"`
	EventLoopP95Ms        float64                       `json:"eventLoopP95Ms,omitempty"`
	DroppedEvents         int64                         `json:"droppedEvents,omitempty"`
	CapacityGeneration    int64                         `json:"capacityGeneration,omitempty"`
}

BotWorkerEvent Bot Worker 发出的事件(JSON 解码目标)。

type CommandAttemptError added in v0.20.0

type CommandAttemptError struct {
	Attempt          int    `json:"attempt"`
	ErrorCode        string `json:"errorCode"`
	Message          string `json:"message"`
	ObservedAtUnixMs int64  `json:"observedAtUnixMs"`
}

CommandAttemptError 是单次失败尝试的摘要,最多保留 2 条。

type CommandOccurrenceKey added in v0.20.0

type CommandOccurrenceKey struct {
	CommandID  string `json:"commandId"`
	Occurrence int    `json:"occurrence"`
}

CommandOccurrenceKey skip/cancel 引用键。

type CommandScheduleCancelCommand added in v0.20.0

type CommandScheduleCancelCommand struct {
	Cmd              string `json:"cmd"`
	RequestID        string `json:"requestId"`
	RunUUID          string `json:"runUuid"`
	BotUUID          string `json:"botUuid"`
	Generation       int64  `json:"generation"`
	StepID           string `json:"stepId"`
	ScheduleRunID    string `json:"scheduleRunId"`
	Reason           string `json:"reason"`
	CorrelationToken string `json:"correlationToken"`
}

CommandScheduleCancelCommand FR-369 cancel 命令计划。

type CommandScheduleCommand added in v0.20.0

type CommandScheduleCommand struct {
	Cmd                   string                 `json:"cmd"`
	RequestID             string                 `json:"requestId"`
	RunID                 string                 `json:"runId"`
	RunUUID               string                 `json:"runUuid"`
	BotUUID               string                 `json:"botUuid"`
	Generation            int64                  `json:"generation"`
	StepID                string                 `json:"stepId"`
	ScheduleRunID         string                 `json:"scheduleRunId"`
	CorrelationToken      string                 `json:"correlationToken"`
	StartMode             string                 `json:"startMode"`
	ScheduleStartAtUnixMs int64                  `json:"scheduleStartAtUnixMs"`
	BarrierKey            string                 `json:"barrierKey"`
	RunDeadlineUnixMs     int64                  `json:"runDeadlineUnixMs"`
	JitterSeed            string                 `json:"jitterSeed"`
	Plan                  CommandSchedulePlan    `json:"plan"`
	SkipOccurrences       []CommandOccurrenceKey `json:"skipOccurrences"`
}

CommandScheduleCommand FR-369 命令计划准备(Worker → Bot Worker)。

type CommandScheduleItemResult added in v0.20.0

type CommandScheduleItemResult struct {
	ScheduleRunID    string `json:"scheduleRunId"`
	Accepted         bool   `json:"accepted"`
	AlreadyReleased  bool   `json:"alreadyReleased,omitempty"`
	AlreadyCancelled bool   `json:"alreadyCancelled,omitempty"`
	ErrorCode        string `json:"errorCode,omitempty"`
	Error            string `json:"error,omitempty"`
}

CommandScheduleItemResult command-schedule-* result 共用字段。

type CommandScheduleOccurrence added in v0.20.0

type CommandScheduleOccurrence struct {
	CommandID             string `json:"commandId"`
	Occurrence            int    `json:"occurrence"`
	CommandDeclarationIdx int    `json:"commandDeclarationIndex"`
	BaseAtMS              int64  `json:"baseAtMs"`
	JitterOffsetMS        int64  `json:"jitterOffsetMs"`
	ActionRunID           string `json:"actionRunId"`
	Command               string `json:"command"`
}

CommandScheduleOccurrence 是 plan 中冻结后的 occurrence(与 CP 端一致)。

type CommandSchedulePlan added in v0.20.0

type CommandSchedulePlan struct {
	DurationMS  int64                       `json:"durationMs"`
	JitterMS    int64                       `json:"jitterMs"`
	Occurrences []CommandScheduleOccurrence `json:"occurrences"`
}

CommandSchedulePlan 命令计划冻结 plan。

type CommandScheduleReleaseCommand added in v0.20.0

type CommandScheduleReleaseCommand struct {
	Cmd             string `json:"cmd"`
	RequestID       string `json:"requestId"`
	RunUUID         string `json:"runUuid"`
	BotUUID         string `json:"botUuid"`
	Generation      int64  `json:"generation"`
	StepID          string `json:"stepId"`
	ScheduleRunID   string `json:"scheduleRunId"`
	BarrierKey      string `json:"barrierKey"`
	ReleaseAtUnixMs int64  `json:"releaseAtUnixMs"`
}

CommandScheduleReleaseCommand FR-369 release barrier 命令计划。

type CommandScheduleResultPayload added in v0.20.0

type CommandScheduleResultPayload struct {
	RunID            string                `json:"runId"`
	RunUUID          string                `json:"runUuid"`
	BotUUID          string                `json:"botUuid"`
	Generation       int64                 `json:"generation"`
	StepID           string                `json:"stepId"`
	ScheduleRunID    string                `json:"scheduleRunId"`
	ActionRunID      string                `json:"actionRunId"`
	CorrelationToken string                `json:"correlationToken"`
	CommandID        string                `json:"commandId"`
	Occurrence       int                   `json:"occurrence"`
	Attempt          int                   `json:"attempt"`
	DurationMs       int64                 `json:"durationMs"`
	ObservedAtUnixMs int64                 `json:"observedAtUnixMs"`
	Status           string                `json:"status"`
	PlannedAtUnixMs  int64                 `json:"plannedAtUnixMs"`
	SentAtUnixMs     *int64                `json:"sentAtUnixMs,omitempty"`
	ErrorCode        string                `json:"errorCode,omitempty"`
	Message          string                `json:"message,omitempty"`
	AttemptErrors    []CommandAttemptError `json:"attemptErrors,omitempty"`
}

CommandScheduleResultPayload 是 Bot Worker 异步 command-schedule-result 事件载荷。

type CreateBotsCommand

type CreateBotsCommand struct {
	Cmd            string      `json:"cmd"`
	RequestID      string      `json:"requestId,omitempty"`
	BatchID        string      `json:"batchId,omitempty"`
	IdempotencyKey string      `json:"idempotencyKey,omitempty"`
	Bots           []BotConfig `json:"bots"`
}

CreateBotsCommand 批量创建 Bot 命令。

type EventCallback

type EventCallback func(event *BotWorkerEvent)

EventCallback 事件回调函数。

type GetFleetSnapshotCommand added in v0.19.0

type GetFleetSnapshotCommand struct {
	Cmd       string `json:"cmd"`
	RequestID string `json:"requestId"`
}

GetFleetSnapshotCommand 请求当前 Bot fleet 快照。

type IpcCommand

type IpcCommand struct {
	Cmd       string `json:"cmd"`
	RequestID string `json:"requestId,omitempty"`
}

IpcCommand Worker Node → Bot Worker 的命令。

type Manager

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

Manager Bot 管理器。 spawn 一个 Bot Worker 子进程,通过 stdin/stdout JSON 行协议通信。

func NewManager

func NewManager(config ManagerConfig) *Manager

NewManager 创建 Bot 管理器。

func (*Manager) ApplyBotBatch added in v0.19.0

func (m *Manager) ApplyBotBatch(ctx context.Context, requestID, batchID, idempotencyKey string, configs []BotConfig) (*BotWorkerEvent, error)

ApplyBotBatch 先按 generation 更新 desired,再发送 create-bots 并等待 batch-result(FR-365)。

func (*Manager) ApplyCommandSchedule added in v0.20.0

func (m *Manager) ApplyCommandSchedule(ctx context.Context, requestID string, cmd CommandScheduleCommand, deadline time.Duration) (*BotWorkerEvent, error)

ApplyCommandSchedule 下发 command-schedule 并等待 command-schedule-accepted。

func (*Manager) CancelCommandSchedule added in v0.20.0

func (m *Manager) CancelCommandSchedule(ctx context.Context, requestID string, cmd CommandScheduleCancelCommand, deadline time.Duration) (*BotWorkerEvent, error)

CancelCommandSchedule 下发 command-schedule-cancel 并等待 command-schedule-cancel-result。

func (*Manager) CapacitySnapshot added in v0.19.0

func (m *Manager) CapacitySnapshot() BotCapacitySnapshot

CapacitySnapshot 返回当前 fleet 容量快照。

func (*Manager) CircuitOpen added in v0.20.0

func (m *Manager) CircuitOpen() bool

CircuitOpen 报告崩溃熔断是否开启。

func (*Manager) CreateBots

func (m *Manager) CreateBots(configs []BotConfig) error

CreateBots 批量创建 Bot。

func (*Manager) DesiredSnapshot added in v0.20.0

func (m *Manager) DesiredSnapshot() map[string]desiredAssignment

DesiredSnapshot 返回当前内存 desired 的副本(测试/诊断)。

func (*Manager) FleetSnapshot added in v0.19.0

func (m *Manager) FleetSnapshot(sessionID string) []BotState

FleetSnapshot 返回指定会话或全部 Bot 的内存快照。

func (*Manager) GetBot

func (m *Manager) GetBot(botID string) (*BotState, bool)

GetBot 获取单个 Bot 状态。

func (*Manager) GetBots

func (m *Manager) GetBots() map[string]*BotState

GetBots 获取所有 Bot 状态。

func (*Manager) IsRunning

func (m *Manager) IsRunning() bool

IsRunning 是否在运行。

func (*Manager) PendingRequestCount added in v0.19.0

func (m *Manager) PendingRequestCount() int

PendingRequestCount 返回当前同步 IPC 等待者数量。

func (*Manager) ReleaseCommandSchedule added in v0.20.0

func (m *Manager) ReleaseCommandSchedule(ctx context.Context, requestID string, cmd CommandScheduleReleaseCommand, deadline time.Duration) (*BotWorkerEvent, error)

ReleaseCommandSchedule 下发 command-schedule-release 并等待 command-schedule-release-result。

func (*Manager) RequestFleetSnapshot added in v0.19.0

func (m *Manager) RequestFleetSnapshot(ctx context.Context, requestID string) (*BotWorkerEvent, error)

RequestFleetSnapshot 请求 bot-worker 返回当前全部 Bot 快照。

func (*Manager) RunScript

func (m *Manager) RunScript(scriptID string, steps []ScriptStep, botIds []string) error

RunScript 执行脚本。

func (*Manager) RuntimeSnapshot added in v0.21.0

func (m *Manager) RuntimeSnapshot() RuntimeSnapshot

RuntimeSnapshot 返回当前 Bot Worker 进程与容量快照,不产生任何生命周期副作用。

func (*Manager) SendBotCommand

func (m *Manager) SendBotCommand(botID, command string) error

SendBotCommand 向 Bot 发送命令。

func (*Manager) SetBehavior

func (m *Manager) SetBehavior(botID, behavior, target string) error

SetBehavior 切换 Bot 行为模式。

func (*Manager) SetBotWorkerPath

func (m *Manager) SetBotWorkerPath(p string)

SetBotWorkerPath 运行时更新 bot-worker 入口脚本路径(FR-308:自愈下发完成后切到数据根物化副本)。 只影响下一次 spawn;已运行的子进程不打扰。

func (*Manager) SetEventCallback

func (m *Manager) SetEventCallback(cb EventCallback)

SetEventCallback 设置事件回调。

func (*Manager) SignalActions added in v0.19.0

func (m *Manager) SignalActions(ctx context.Context, requestID string, signals []ActionSignal) (*BotWorkerEvent, error)

SignalActions 投递通用外部动作信号并等待 signal-result。

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start 启动 Bot Worker 子进程。

func (*Manager) Stop

func (m *Manager) Stop()

Stop 停止 Bot 管理器和 Bot Worker 子进程。

func (*Manager) StopBotBatch added in v0.19.0

func (m *Manager) StopBotBatch(ctx context.Context, requestID string, botIDs []string, generation int64, reason string) (*BotWorkerEvent, error)

StopBotBatch 先把 desired 标 stopped,再发送 stop-bots(FR-365)。

func (*Manager) StopBots

func (m *Manager) StopBots(botIds []string) error

StopBots 批量停止 Bot。

func (*Manager) StopScript

func (m *Manager) StopScript(scriptID string) error

StopScript 停止脚本。

func (*Manager) SubscribeEvents

func (m *Manager) SubscribeEvents(buffer int) (<-chan *BotWorkerEvent, func())

SubscribeEvents 订阅 Bot Worker 事件。 每个订阅者使用单一有界泵:runtime 可合并/丢旧,action/退出事件优先保留,不反压 stdout。

func (*Manager) WaitReady added in v0.19.0

func (m *Manager) WaitReady(ctx context.Context) error

WaitReady 等待 bot-worker 发出 worker-ready;老版本也会就绪但标记 Legacy。

type ManagerConfig

type ManagerConfig struct {
	BotWorkerPath string // bot-worker 入口脚本路径(dist/index.js)
	PrewarmCount  int    // 预热 Bot 数量
	// NodePath 显式指定 spawn 用的 node 可执行(FR-300;V1 无 UI/配置面,仅留结构)。
	NodePath string
	// NodeResolver 可注入的 node 解析器(测试/后续 CP 下发接入点);
	// nil 时按 NodePath + 本地扫描构造默认解析器。
	NodeResolver *NodeResolver
	// ExtraEnv spawn 时在继承环境上追加的变量(FR-308:NODE_PATH 仅作 CJS 兜底)。
	ExtraEnv []string
	// PrepareSpawn 在依赖预检前准备当前入口目录;受控 dist 用它刷新 node_modules 链接。
	PrepareSpawn func(distDir string) error
	// DepsPrecheck spawn 前按 ESM 可见路径预检依赖;nil 时不预检(测试/旧行为)。
	DepsPrecheck func(distDir string) error
	// RequestTimeout 同步 IPC 请求等待逐项回执的超时;零值使用 10 秒。
	RequestTimeout time.Duration
}

ManagerConfig 管理器配置。

type NodeResolution

type NodeResolution struct {
	Path    string // node 可执行绝对路径;PATH 回退时为 "node"
	Source  string // NodeSource* 之一
	Version string // 真实探测得到的完整版本
}

NodeResolution 一次 node 可执行解析结果。

type NodeResolver

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

NodeResolver 解析 spawn bot-worker 用的 node 可执行。

func NewNodeResolver

func NewNodeResolver(explicit string, scan func() []runtimescan.Candidate) *NodeResolver

NewNodeResolver 创建解析器。explicit 非空时保持操作员意图,探测失败直接返回错误; scan 为 nil 时使用 runtimescan 的真实扫描器,所有候选仍会再次探测以避免陈旧版本信息。

func (*NodeResolver) Refresh

func (r *NodeResolver) Refresh() (NodeResolution, error)

Refresh 清除缓存并立即重解析;失败结果不缓存,后续 Resolve 会再次真实探测。

func (*NodeResolver) Resolve

func (r *NodeResolver) Resolve() (NodeResolution, error)

Resolve 返回满足最低版本的解析结果;只缓存成功结果。

type RunScriptCommand

type RunScriptCommand struct {
	Cmd      string       `json:"cmd"`
	ScriptID string       `json:"scriptId"`
	Steps    []ScriptStep `json:"steps"`
	BotIds   []string     `json:"botIds"`
}

RunScriptCommand 执行脚本命令。

type RuntimeSnapshot added in v0.21.0

type RuntimeSnapshot struct {
	PID      int
	Running  bool
	Capacity BotCapacitySnapshot
}

RuntimeSnapshot 是已存在 Bot Worker 的只读运行时视图。 它绝不启动、重启或探测子进程,供 Heartbeat 上报当前受管资源。

type ScriptProgress

type ScriptProgress struct {
	ScriptID string `json:"scriptId"`
	BotID    string `json:"botId,omitempty"`
	Progress int    `json:"progress"`
	Total    int    `json:"total"`
	Status   string `json:"status"`
	Step     string `json:"step,omitempty"`
	Error    string `json:"error,omitempty"`
}

ScriptProgress 脚本进度。

type ScriptStep

type ScriptStep struct {
	Action   string `json:"action"`
	Message  string `json:"message,omitempty"`
	Pos      *Vec3  `json:"pos,omitempty"`
	Duration int    `json:"duration,omitempty"`
	Command  string `json:"command,omitempty"`
	Text     string `json:"text,omitempty"`
}

ScriptStep 脚本步骤。

type SendBotCommand

type SendBotCommand struct {
	Cmd     string `json:"cmd"`
	BotID   string `json:"botId"`
	Command string `json:"command"`
}

SendBotCommand 向 Bot 发送命令。

type SetBehaviorCommand

type SetBehaviorCommand struct {
	Cmd      string      `json:"cmd"`
	BotID    string      `json:"botId"`
	Behavior string      `json:"behavior"`
	Target   string      `json:"target,omitempty"`
	Config   interface{} `json:"config,omitempty"`
}

SetBehaviorCommand 切换行为模式命令。

type SignalActionsCommand added in v0.19.0

type SignalActionsCommand struct {
	Cmd       string         `json:"cmd"`
	RequestID string         `json:"requestId"`
	Signals   []ActionSignal `json:"signals"`
}

SignalActionsCommand 批量投递外部动作信号。

type SignalItemResult added in v0.19.0

type SignalItemResult struct {
	SignalID  string `json:"signalId"`
	Accepted  bool   `json:"accepted"`
	Skipped   bool   `json:"skipped"`
	Status    string `json:"status,omitempty"`
	ErrorCode string `json:"errorCode,omitempty"`
	Error     string `json:"error,omitempty"`
}

SignalItemResult signal-actions 的逐信号回执。

type StopBotsCommand

type StopBotsCommand struct {
	Cmd        string   `json:"cmd"`
	RequestID  string   `json:"requestId,omitempty"`
	BotIds     []string `json:"botIds"`
	Generation int64    `json:"generation,omitempty"`
	Reason     string   `json:"reason,omitempty"`
}

StopBotsCommand 批量停止 Bot 命令。

type StopScriptCommand

type StopScriptCommand struct {
	Cmd      string `json:"cmd"`
	ScriptID string `json:"scriptId"`
}

StopScriptCommand 停止脚本命令。

type Vec3

type Vec3 struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
	Z float64 `json:"z"`
}

Vec3 坐标。

Jump to

Keyboard shortcuts

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