@nikcli-ai/plugin 1.161.0 → 1.167.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -205,6 +205,8 @@ export interface Hooks {
205
205
  "tool.execute.before"?: (input: {
206
206
  tool: string;
207
207
  sessionID: string;
208
+ agent: string;
209
+ messageID: string;
208
210
  callID: string;
209
211
  }, output: {
210
212
  args: any;
@@ -212,6 +214,8 @@ export interface Hooks {
212
214
  "tool.execute.after"?: (input: {
213
215
  tool: string;
214
216
  sessionID: string;
217
+ agent: string;
218
+ messageID: string;
215
219
  callID: string;
216
220
  }, output: {
217
221
  title: string;
package/dist/tool.d.ts CHANGED
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  export type ToolContext = {
3
3
  sessionID: string;
4
4
  messageID: string;
5
+ callID: string;
5
6
  agent: string;
6
7
  abort: AbortSignal;
7
8
  metadata(input: {
@@ -10,8 +11,22 @@ export type ToolContext = {
10
11
  [key: string]: any;
11
12
  };
12
13
  }): void;
14
+ progress(input: ToolProgress): Promise<void>;
13
15
  ask(input: AskInput): Promise<void>;
14
16
  };
17
+ export type ToolProgressContent = {
18
+ readonly type: "text";
19
+ readonly text: string;
20
+ } | {
21
+ readonly type: "file";
22
+ readonly data: string;
23
+ readonly mime: string;
24
+ readonly name?: string;
25
+ };
26
+ export type ToolProgress = {
27
+ readonly structured: Readonly<Record<string, unknown>>;
28
+ readonly content?: ReadonlyArray<ToolProgressContent>;
29
+ };
15
30
  type AskInput = {
16
31
  permission: string;
17
32
  patterns: string[];
package/dist/tui.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { NikcliClient, Event, LspStatus, McpStatus, Todo, Message, Part, Pr
2
2
  import type { CliRenderer, ParsedKey, RGBA } from "@opentui/core";
3
3
  import type { JSX, SolidPlugin } from "@opentui/solid";
4
4
  import type { Config as PluginConfig, PluginOptions } from "./index.js";
5
+ import type { Data as TuiV2Data } from "./v2/tui/context.js";
5
6
  export type { CliRenderer, SlotMode } from "@opentui/core";
6
7
  export type TuiRouteCurrent = {
7
8
  name: "home";
@@ -278,6 +279,16 @@ export type TuiSlotMap = {
278
279
  sidebar_footer: {
279
280
  session_id: string;
280
281
  };
282
+ /** V2 plugin slots. Dotted names intentionally do not collide with v1 slots. */
283
+ "app.bottom": {};
284
+ "home.bottom": {};
285
+ "home.footer": {};
286
+ "sidebar.content": {
287
+ sessionID: string;
288
+ };
289
+ "sidebar.footer": {
290
+ sessionID: string;
291
+ };
281
292
  };
282
293
  export type TuiSlotContext = {
283
294
  theme: TuiTheme;
@@ -288,11 +299,16 @@ export type TuiSlotPlugin = Omit<SlotCore, "id"> & {
288
299
  };
289
300
  export type TuiSlots = {
290
301
  register: (plugin: TuiSlotPlugin) => string;
302
+ /** Host-backed disposable registration used by the v2 compatibility runtime. */
303
+ registerDisposable: (plugin: TuiSlotPlugin) => () => void;
291
304
  };
292
305
  export type TuiEventBus = {
293
306
  on: <Type extends Event["type"]>(type: Type, handler: (event: Extract<Event, {
294
307
  type: Type;
295
308
  }>) => void) => () => void;
309
+ listen: (handler: (event: {
310
+ details: Event;
311
+ }) => void) => () => void;
296
312
  };
297
313
  export type TuiDispose = () => void | Promise<void>;
298
314
  export type TuiLifecycle = {
@@ -368,6 +384,8 @@ export type TuiPluginApi = {
368
384
  readonly tuiConfig: Frozen<TuiConfigView>;
369
385
  kv: TuiKV;
370
386
  state: TuiState;
387
+ /** Full reactive data contract used by v2 TUI plugins. */
388
+ data: TuiV2Data;
371
389
  theme: TuiTheme;
372
390
  client: NikcliClient;
373
391
  event: TuiEventBus;
@@ -0,0 +1 @@
1
+ export * as Tool from "./tool.js";
@@ -0,0 +1 @@
1
+ export * as Tool from "./tool.js";
@@ -0,0 +1,41 @@
1
+ import { Effect } from "effect";
2
+ import z from "zod";
3
+ import { type ToolAttachment, type ToolContext, type ToolProgress, type ToolProgressContent, type ToolResult } from "../../tool.js";
4
+ export type Context = Omit<ToolContext, "progress"> & {
5
+ readonly progress: (update: ToolProgress) => Effect.Effect<void>;
6
+ };
7
+ export type Progress = ToolProgress;
8
+ export type Content = ToolProgressContent;
9
+ export type Attachment = ToolAttachment;
10
+ export type Result = ToolResult;
11
+ export interface ToolExecuteBeforeEvent {
12
+ readonly tool: string;
13
+ readonly sessionID: string;
14
+ readonly agent: string;
15
+ readonly messageID: string;
16
+ readonly callID: string;
17
+ input: unknown;
18
+ }
19
+ export interface ToolExecuteAfterEvent {
20
+ readonly tool: string;
21
+ readonly sessionID: string;
22
+ readonly agent: string;
23
+ readonly messageID: string;
24
+ readonly callID: string;
25
+ readonly input: unknown;
26
+ result: ToolResult;
27
+ }
28
+ export declare function tool<Args extends z.ZodRawShape>(input: {
29
+ description: string;
30
+ args: Args;
31
+ execute(args: z.infer<z.ZodObject<Args>>, context: Context): Effect.Effect<ToolResult, Error>;
32
+ }): {
33
+ description: string;
34
+ args: Args;
35
+ execute(args: z.core.$InferObjectOutput<Args, {}>, context: ToolContext): Promise<ToolResult>;
36
+ };
37
+ export declare namespace tool {
38
+ var schema: typeof z;
39
+ }
40
+ export declare const make: typeof tool;
41
+ export type ToolDefinition = ReturnType<typeof tool>;
@@ -0,0 +1,15 @@
1
+ import { Effect } from "effect";
2
+ import z from "zod";
3
+ import { tool as promiseTool, } from "../../tool.js";
4
+ export function tool(input) {
5
+ return promiseTool({
6
+ description: input.description,
7
+ args: input.args,
8
+ execute: (args, context) => Effect.runPromise(input.execute(args, {
9
+ ...context,
10
+ progress: (update) => Effect.promise(() => context.progress(update)),
11
+ })),
12
+ });
13
+ }
14
+ tool.schema = z;
15
+ export const make = tool;
@@ -0,0 +1 @@
1
+ export * as Tool from "./tool.js";
@@ -0,0 +1 @@
1
+ export * as Tool from "./tool.js";
@@ -0,0 +1,18 @@
1
+ export { tool, tool as make, type ToolAttachment as Attachment, type ToolContext as Context, type ToolDefinition, type ToolProgress as Progress, type ToolProgressContent as Content, type ToolResult as Result, } from "../../tool.js";
2
+ export interface ToolExecuteBeforeEvent {
3
+ readonly tool: string;
4
+ readonly sessionID: string;
5
+ readonly agent: string;
6
+ readonly messageID: string;
7
+ readonly callID: string;
8
+ input: unknown;
9
+ }
10
+ export interface ToolExecuteAfterEvent {
11
+ readonly tool: string;
12
+ readonly sessionID: string;
13
+ readonly agent: string;
14
+ readonly messageID: string;
15
+ readonly callID: string;
16
+ readonly input: unknown;
17
+ result: import("../../tool.js").ToolResult;
18
+ }
@@ -0,0 +1 @@
1
+ export { tool, tool as make, } from "../../tool.js";
@@ -0,0 +1,142 @@
1
+ import type { Agent, Command, ConnectorStatus, Event, McpResource, McpStatus, Message, Model, NikcliClient, Part, PermissionRequest, PermissionRule, Provider, Pty, QuestionRequest, ReferenceConfig, Session, SessionEntryAssistantReasoning, SessionEntryAssistantRetry, SessionEntryAssistantText, SessionEntryAssistantTool, SessionEntrySynthetic, SessionEntryUser } from "@nikcli-ai/sdk/v2";
2
+ import type { JSX } from "@opentui/solid";
3
+ export type LocationRef = {
4
+ readonly directory: string;
5
+ readonly workspaceID?: string;
6
+ };
7
+ export type SessionInfo = Session;
8
+ export type SessionPendingInfo = SessionEntryUser | SessionEntrySynthetic | SessionEntryAssistantText | SessionEntryAssistantReasoning | SessionEntryAssistantTool | SessionEntryAssistantRetry;
9
+ export type SessionMessageInfo = {
10
+ readonly info: Message;
11
+ readonly parts: Part[];
12
+ };
13
+ export type PermissionV2Request = PermissionRequest;
14
+ export type FormInfo = QuestionRequest;
15
+ export type PermissionSavedInfo = PermissionRule;
16
+ export type ShellInfo = Pty;
17
+ export type AgentInfo = Agent;
18
+ export type CommandInfo = Command;
19
+ export type IntegrationInfo = {
20
+ readonly name: string;
21
+ readonly status: ConnectorStatus;
22
+ };
23
+ export type McpServer = {
24
+ readonly name: string;
25
+ readonly status: McpStatus;
26
+ };
27
+ export type ModelInfo = Model;
28
+ export type ProviderV2Info = Provider;
29
+ export type ReferenceInfo = ReferenceConfig & {
30
+ readonly name: string;
31
+ };
32
+ export type SkillInfo = {
33
+ readonly name: string;
34
+ readonly description: string;
35
+ readonly location: string;
36
+ readonly category?: string;
37
+ readonly tags?: string[];
38
+ readonly version?: string;
39
+ };
40
+ interface LocationCollection<Value> {
41
+ list(location?: LocationRef): Value[] | undefined;
42
+ refresh(location?: LocationRef): Promise<void>;
43
+ }
44
+ /** Reactive nikcli data exposed to a v2 TUI plugin. */
45
+ export interface Data {
46
+ readonly on: <Type extends Event["type"]>(type: Type, handler: (event: Extract<Event, {
47
+ type: Type;
48
+ }>) => void) => () => void;
49
+ readonly listen: (handler: (event: {
50
+ details: Event;
51
+ }) => void) => () => void;
52
+ readonly session: {
53
+ list(): SessionInfo[];
54
+ get(sessionID: string): SessionInfo | undefined;
55
+ root(sessionID: string): string;
56
+ family(sessionID: string): string[];
57
+ cost(sessionID: string): number;
58
+ status(sessionID: string): "idle" | "running";
59
+ readonly pending: {
60
+ list(sessionID: string): SessionPendingInfo[];
61
+ refresh(sessionID: string): Promise<void>;
62
+ };
63
+ refresh(sessionID: string): Promise<void>;
64
+ readonly message: {
65
+ list(sessionID: string): SessionMessageInfo[];
66
+ get(sessionID: string, messageID: string): SessionMessageInfo | undefined;
67
+ refresh(sessionID: string): Promise<void>;
68
+ };
69
+ readonly permission: {
70
+ list(sessionID: string): PermissionV2Request[] | undefined;
71
+ refresh(sessionID: string): Promise<void>;
72
+ };
73
+ readonly form: {
74
+ list(sessionID: string, location?: LocationRef): Array<FormInfo & {
75
+ readonly location?: LocationRef;
76
+ }> | undefined;
77
+ refresh(sessionID: string, location?: LocationRef): Promise<void>;
78
+ };
79
+ };
80
+ readonly project: {
81
+ readonly permission: {
82
+ list(projectID: string): PermissionSavedInfo[] | undefined;
83
+ refresh(projectID: string): Promise<void>;
84
+ };
85
+ };
86
+ readonly shell: {
87
+ list(location?: LocationRef): ShellInfo[];
88
+ get(id: string): ShellInfo | undefined;
89
+ refresh(location?: LocationRef): Promise<void>;
90
+ };
91
+ readonly location: {
92
+ default(): LocationRef;
93
+ refresh(location?: LocationRef): Promise<void>;
94
+ readonly agent: LocationCollection<AgentInfo>;
95
+ readonly command: LocationCollection<CommandInfo>;
96
+ readonly integration: LocationCollection<IntegrationInfo>;
97
+ readonly mcp: {
98
+ readonly server: LocationCollection<McpServer>;
99
+ readonly resource: LocationCollection<McpResource>;
100
+ };
101
+ readonly model: LocationCollection<ModelInfo>;
102
+ readonly provider: LocationCollection<ProviderV2Info>;
103
+ readonly reference: LocationCollection<ReferenceInfo>;
104
+ readonly skill: LocationCollection<SkillInfo>;
105
+ };
106
+ }
107
+ export type Route = {
108
+ readonly type: "home";
109
+ } | {
110
+ readonly type: "session";
111
+ readonly sessionID: string;
112
+ } | {
113
+ readonly type: "plugin";
114
+ readonly id: string;
115
+ readonly name: string;
116
+ readonly data?: Record<string, unknown>;
117
+ };
118
+ export type Destination = Route | Omit<Extract<Route, {
119
+ readonly type: "plugin";
120
+ }>, "id">;
121
+ export interface Page {
122
+ readonly name: string;
123
+ readonly render: (input: {
124
+ readonly data?: Record<string, unknown>;
125
+ }) => JSX.Element;
126
+ }
127
+ export type Slot = (props: Record<string, unknown>) => JSX.Element;
128
+ export interface UI {
129
+ readonly router: {
130
+ register(page: Page): () => void;
131
+ navigate(destination: Destination): void;
132
+ current(): Route;
133
+ };
134
+ readonly slot: (name: string, render: Slot) => () => void;
135
+ }
136
+ export interface Context {
137
+ readonly options: Readonly<Record<string, unknown>>;
138
+ readonly client: NikcliClient;
139
+ readonly data: Data;
140
+ readonly ui: UI;
141
+ }
142
+ export {};
File without changes
@@ -0,0 +1 @@
1
+ export * as Plugin from "./plugin.js";
@@ -0,0 +1 @@
1
+ export * as Plugin from "./plugin.js";
@@ -0,0 +1,8 @@
1
+ import type { Context } from "./context.js";
2
+ export type { Context };
3
+ export type Cleanup = () => Promise<void> | void;
4
+ export interface Definition {
5
+ readonly id: string;
6
+ readonly setup: (context: Context) => Promise<Cleanup | void> | Cleanup | void;
7
+ }
8
+ export declare function define(plugin: Definition): Definition;
@@ -0,0 +1,3 @@
1
+ export function define(plugin) {
2
+ return plugin;
3
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@nikcli-ai/plugin",
4
- "version": "1.161.0",
4
+ "version": "1.167.0",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -22,6 +22,30 @@
22
22
  "./tui": {
23
23
  "import": "./src/tui.ts",
24
24
  "types": "./src/tui.ts"
25
+ },
26
+ "./v2/tui": {
27
+ "import": "./src/v2/tui/index.ts",
28
+ "types": "./src/v2/tui/index.ts"
29
+ },
30
+ "./v2/tui/*": {
31
+ "import": "./src/v2/tui/*.ts",
32
+ "types": "./src/v2/tui/*.ts"
33
+ },
34
+ "./v2/effect": {
35
+ "import": "./src/v2/effect/index.ts",
36
+ "types": "./src/v2/effect/index.ts"
37
+ },
38
+ "./v2/effect/tool": {
39
+ "import": "./src/v2/effect/tool.ts",
40
+ "types": "./src/v2/effect/tool.ts"
41
+ },
42
+ "./v2/promise": {
43
+ "import": "./src/v2/promise/index.ts",
44
+ "types": "./src/v2/promise/index.ts"
45
+ },
46
+ "./v2/promise/tool": {
47
+ "import": "./src/v2/promise/tool.ts",
48
+ "types": "./src/v2/promise/tool.ts"
25
49
  }
26
50
  },
27
51
  "files": [
@@ -31,13 +55,20 @@
31
55
  "exports": {
32
56
  ".": "./dist/index.js",
33
57
  "./tool": "./dist/tool.js",
34
- "./tui": "./dist/tui.js"
58
+ "./tui": "./dist/tui.js",
59
+ "./v2/tui": "./dist/v2/tui/index.js",
60
+ "./v2/tui/*": "./dist/v2/tui/*.js",
61
+ "./v2/effect": "./dist/v2/effect/index.js",
62
+ "./v2/effect/tool": "./dist/v2/effect/tool.js",
63
+ "./v2/promise": "./dist/v2/promise/index.js",
64
+ "./v2/promise/tool": "./dist/v2/promise/tool.js"
35
65
  }
36
66
  },
37
67
  "dependencies": {
38
- "@nikcli-ai/sdk": "1.161.0",
68
+ "@nikcli-ai/sdk": "1.167.0",
39
69
  "@opentui/core": "0.1.91",
40
70
  "@opentui/solid": "0.1.91",
71
+ "effect": "4.0.0-beta.83",
41
72
  "zod": "4.1.8"
42
73
  },
43
74
  "devDependencies": {