@nikcli-ai/plugin 1.166.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 +4 -0
- package/dist/tool.d.ts +15 -0
- package/dist/tui.d.ts +3 -0
- package/dist/v2/effect/index.d.ts +1 -0
- package/dist/v2/effect/index.js +1 -0
- package/dist/v2/effect/tool.d.ts +41 -0
- package/dist/v2/effect/tool.js +15 -0
- package/dist/v2/promise/index.d.ts +1 -0
- package/dist/v2/promise/index.js +1 -0
- package/dist/v2/promise/tool.d.ts +18 -0
- package/dist/v2/promise/tool.js +1 -0
- package/dist/v2/tui/context.d.ts +104 -3
- package/package.json +24 -3
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";
|
|
@@ -383,6 +384,8 @@ export type TuiPluginApi = {
|
|
|
383
384
|
readonly tuiConfig: Frozen<TuiConfigView>;
|
|
384
385
|
kv: TuiKV;
|
|
385
386
|
state: TuiState;
|
|
387
|
+
/** Full reactive data contract used by v2 TUI plugins. */
|
|
388
|
+
data: TuiV2Data;
|
|
386
389
|
theme: TuiTheme;
|
|
387
390
|
client: NikcliClient;
|
|
388
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";
|
package/dist/v2/tui/context.d.ts
CHANGED
|
@@ -1,8 +1,108 @@
|
|
|
1
|
-
import type { NikcliClient } from "@nikcli-ai/sdk/v2";
|
|
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
2
|
import type { JSX } from "@opentui/solid";
|
|
3
|
-
|
|
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
|
+
}
|
|
4
44
|
/** Reactive nikcli data exposed to a v2 TUI plugin. */
|
|
5
|
-
export interface Data
|
|
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
|
+
};
|
|
6
106
|
}
|
|
7
107
|
export type Route = {
|
|
8
108
|
readonly type: "home";
|
|
@@ -39,3 +139,4 @@ export interface Context {
|
|
|
39
139
|
readonly data: Data;
|
|
40
140
|
readonly ui: UI;
|
|
41
141
|
}
|
|
142
|
+
export {};
|
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.
|
|
4
|
+
"version": "1.167.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -30,6 +30,22 @@
|
|
|
30
30
|
"./v2/tui/*": {
|
|
31
31
|
"import": "./src/v2/tui/*.ts",
|
|
32
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"
|
|
33
49
|
}
|
|
34
50
|
},
|
|
35
51
|
"files": [
|
|
@@ -41,13 +57,18 @@
|
|
|
41
57
|
"./tool": "./dist/tool.js",
|
|
42
58
|
"./tui": "./dist/tui.js",
|
|
43
59
|
"./v2/tui": "./dist/v2/tui/index.js",
|
|
44
|
-
"./v2/tui/*": "./dist/v2/tui/*.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"
|
|
45
65
|
}
|
|
46
66
|
},
|
|
47
67
|
"dependencies": {
|
|
48
|
-
"@nikcli-ai/sdk": "1.
|
|
68
|
+
"@nikcli-ai/sdk": "1.167.0",
|
|
49
69
|
"@opentui/core": "0.1.91",
|
|
50
70
|
"@opentui/solid": "0.1.91",
|
|
71
|
+
"effect": "4.0.0-beta.83",
|
|
51
72
|
"zod": "4.1.8"
|
|
52
73
|
},
|
|
53
74
|
"devDependencies": {
|