Download packages/agent-core-v2/src/agent/plugin/agentPluginOps.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/src/agent/plugin/agentPluginOps.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/packages/agent-core-v2/src/agent/plugin/agentPluginOps.ts
-
curl -L -o agentPluginOps.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/src/agent/plugin/agentPluginOps.ts
1.26 kB
| /* oxlint-disable typescript-eslint/no-unsafe-declaration-merging, eslint-plugin-import/namespace -- Event2 class+payload-interface declaration merging is the sanctioned event-declaration idiom. */ | |
| import { z } from 'zod'; | |
| import { AgentEvent2 } from '#/app/event/event2'; | |
| import { defineState } from '#/state/state'; | |
| export interface PluginSessionStartSnapshotState { | |
| readonly initialized: boolean; | |
| readonly content?: string; | |
| } | |
| const pluginSessionStartSchema = z.object({ | |
| agentId: z.string(), | |
| content: z.string().nullable(), | |
| }); | |
| export class PluginSessionStartEvent extends AgentEvent2< | |
| z.infer<typeof pluginSessionStartSchema> | |
| > { | |
| static override readonly type = 'plugin.session_start'; | |
| static override readonly durable = true; | |
| static override readonly schema = pluginSessionStartSchema; | |
| } | |
| export interface PluginSessionStartEvent { | |
| readonly agentId: string; | |
| readonly content: string | null; | |
| } | |
| export const pluginSessionStartSnapshotKey = defineState( | |
| 'pluginSessionStartSnapshot', | |
| (): PluginSessionStartSnapshotState => ({ initialized: false }), | |
| ) | |
| .replayable({ schema: z.custom<PluginSessionStartSnapshotState>() }) | |
| .on(PluginSessionStartEvent, (_s, e) => ({ | |
| initialized: true, | |
| content: e.content ?? undefined, | |
| })); | |