kimi-code/packages/node-sdk/src/events.ts
qer 5cb80ce879
feat: support plugin slash commands (#1204)
* feat(agent-core): support plugin slash commands

* feat(node-sdk): expose listPluginCommands

* feat(kimi-code): register and dispatch plugin slash commands

* chore: add changeset for plugin commands

* feat(agent-core): activate plugin commands server-side

* feat(node-sdk): add activatePluginCommand

* feat(kimi-code): render plugin command activations compactly

* feat(agent-core): recurse plugin command directories and preserve namespace

* fix(kimi-code): parse nested plugin command names

* fix(agent-core): update prompt metadata for plugin command turns

* fix(kimi-code): replay plugin command turns as command cards

* fix: treat plugin-command origins as real user prompts in undo

* fix(kimi-code): guard model-empty and clear plugin command render ids

* fix: propagate plugin_command to web and vis turn projectors

* fix(kimi-code): refresh plugin commands through auth flow

* fix(kimi-web): render plugin command cards in chat pane

* fix(kimi-web): render plugin command card in desktop chat view

* fix(kimi-code): treat slash-activation cards as transcript turn boundaries

* fix(kimi-code): count slash-activation entries when trimming transcript turns

* fix(kimi-code): preserve plugin command args in undo selector
2026-06-30 19:38:01 +08:00

114 lines
2.9 KiB
TypeScript

import type {
ApprovalRequest,
ApprovalResponse,
QuestionRequest,
QuestionResult,
} from '@moonshot-ai/agent-core';
// Event union plus shared fields/payloads used across event families.
export type { KimiErrorPayload, Event } from '@moonshot-ai/agent-core';
export { MCP_OAUTH_AUTHORIZATION_URL_TOOL_UPDATE } from '@moonshot-ai/agent-core';
// Session lifecycle/status events and their status payload.
export type {
AgentStatusUpdatedEvent,
SessionMetaUpdatedEvent,
GoalUpdatedEvent,
SkillActivatedEvent,
PluginCommandActivatedEvent,
ErrorEvent,
WarningEvent,
UsageStatus,
} from '@moonshot-ai/agent-core';
// Turn and step lifecycle events plus the turn-ending reason enum.
export type {
TurnStartedEvent,
TurnEndedEvent,
TurnStepStartedEvent,
TurnStepCompletedEvent,
TurnStepRetryingEvent,
TurnStepInterruptedEvent,
TurnEndReason,
} from '@moonshot-ai/agent-core';
// Streaming content and hook-result events.
export type {
AssistantDeltaEvent,
HookResultEvent,
ThinkingDeltaEvent,
} from '@moonshot-ai/agent-core';
// Tool-call events and incremental progress payloads.
export type {
ToolCallStartedEvent,
ToolCallDeltaEvent,
ToolProgressEvent,
ToolResultEvent,
ToolCallRequest,
ToolCallResponse,
ToolUpdate,
McpOAuthAuthorizationUrlUpdateData,
} from '@moonshot-ai/agent-core';
// MCP tool-list and server status events.
export type {
ToolListUpdatedEvent,
ToolListUpdatedReason,
McpServerStatusEvent,
McpServerStatusPayload,
} from '@moonshot-ai/agent-core';
// Approval reverse-RPC request and response/display payloads.
export type {
ApprovalRequest,
ApprovalDecision,
ApprovalScope,
ApprovalResponse,
ToolInputDisplay,
} from '@moonshot-ai/agent-core';
// Question reverse-RPC request and answer payloads.
export type {
QuestionRequest,
QuestionItem,
QuestionOption,
QuestionAnswerMethod,
QuestionAnswers,
QuestionResponse,
QuestionResult,
} from '@moonshot-ai/agent-core';
// Subagent lifecycle events.
export type {
SubagentSpawnedEvent,
SubagentStartedEvent,
SubagentSuspendedEvent,
SubagentCompletedEvent,
SubagentFailedEvent,
} from '@moonshot-ai/agent-core';
// Compaction lifecycle events and compaction result payload.
export type {
CompactionStartedEvent,
CompactionBlockedEvent,
CompactionCancelledEvent,
CompactionCompletedEvent,
CompactionResult,
} from '@moonshot-ai/agent-core';
// Background task lifecycle events emitted by the BPM. Covers both
// bash (`bash-*`) and agent (`agent-*`) tasks under one wire format.
export type {
BackgroundTaskStartedEvent,
BackgroundTaskTerminatedEvent,
} from '@moonshot-ai/agent-core';
export type { CronFiredEvent } from '@moonshot-ai/agent-core';
export type MaybePromise<T> = T | Promise<T>;
export type ApprovalHandler = (request: ApprovalRequest) => MaybePromise<ApprovalResponse>;
export type QuestionHandler = (request: QuestionRequest) => MaybePromise<QuestionResult>;