@nikcli-ai/plugin 1.196.0 → 1.225.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
@@ -195,6 +195,26 @@ export interface Hooks {
195
195
  }, output: {
196
196
  env: Record<string, string>;
197
197
  }) => Promise<void>;
198
+ /**
199
+ * Modify a shell invocation before it is created.
200
+ *
201
+ * Runs before the permission check, and the permission check is performed against the *final*
202
+ * values written here — so a hook that rewrites the command cannot smuggle past an approval
203
+ * granted for the original one.
204
+ *
205
+ * `output.shell` is the shell binary to run the command with; leaving it `undefined` keeps
206
+ * nikcli's own shell selection. `output.env` is merged over the inherited process environment.
207
+ */
208
+ "shell.create.before"?: (input: {
209
+ sessionID: string;
210
+ command: string;
211
+ }, output: {
212
+ command: string;
213
+ cwd: string;
214
+ timeout: number;
215
+ shell?: string;
216
+ env: Record<string, string>;
217
+ }) => Promise<void>;
198
218
  "command.execute.before"?: (input: {
199
219
  command: string;
200
220
  sessionID: string;
package/dist/tool.d.ts CHANGED
@@ -57,7 +57,7 @@ export declare function tool<Args extends z.ZodRawShape>(input: {
57
57
  execute(args: z.infer<z.ZodObject<Args>>, context: ToolContext): Promise<ToolResult>;
58
58
  };
59
59
  export declare namespace tool {
60
- var schema: typeof z;
60
+ export { z as schema };
61
61
  }
62
62
  export type ToolDefinition = ReturnType<typeof tool>;
63
63
  export {};
package/dist/tui.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { NikcliClient, Event, LspStatus, McpStatus, Todo, Message, Part, Provider, PermissionRequest, QuestionRequest, SessionStatus, Workspace, Config as SdkConfig } from "@nikcli-ai/sdk/v2";
2
2
  import type { CliRenderer, ParsedKey, RGBA } from "@opentui/core";
3
3
  import type { JSX, SolidPlugin } from "@opentui/solid";
4
+ import type { Store } from "solid-js/store";
4
5
  import type { Config as PluginConfig, PluginOptions } from "./index.js";
5
6
  import type { Data as TuiV2Data } from "./v2/tui/context.js";
6
7
  export type { CliRenderer, SlotMode } from "@opentui/core";
@@ -85,15 +86,45 @@ export type TuiKeybindSet = {
85
86
  print: (name: string) => string;
86
87
  };
87
88
  export type TuiDialogProps = {
88
- size?: "medium" | "large" | "xlarge";
89
+ size?: "medium" | "large" | "xlarge" | "full";
89
90
  onClose: () => void;
90
91
  children?: JSX.Element;
91
92
  };
93
+ /** One open session tab, as reported to plugins. */
94
+ export type TuiTab = {
95
+ sessionID: string;
96
+ title: string;
97
+ /** The tab currently shown. */
98
+ active: boolean;
99
+ /** A turn is running in this tab. */
100
+ busy: boolean;
101
+ /** Blocked on the user: a permission request or a question is waiting. */
102
+ attention: boolean;
103
+ /** Finished work this tab has not been looked at since. */
104
+ unread: boolean;
105
+ };
106
+ /**
107
+ * Observe and control the session tab strip.
108
+ *
109
+ * Tabs are otherwise internal to the TUI: a plugin could render into slots and navigate routes but
110
+ * had no way to know which sessions are open, which one is focused, or to open and close them.
111
+ */
112
+ export type TuiTabsApi = {
113
+ /** Whether the tab strip is available in this TUI. */
114
+ enabled: () => boolean;
115
+ list: () => ReadonlyArray<TuiTab>;
116
+ /** Open a tab for any session, or focus it when already open. */
117
+ open: (sessionID: string) => void;
118
+ /** Focus an already-open tab. Returns false when that session has no tab. */
119
+ focus: (sessionID: string) => boolean;
120
+ /** Close a tab. Returns false when that session has no tab. */
121
+ close: (sessionID: string) => boolean;
122
+ };
92
123
  export type TuiDialogStack = {
93
124
  replace: (render: () => JSX.Element, onClose?: () => void) => void;
94
125
  clear: () => void;
95
- setSize: (size: "medium" | "large" | "xlarge") => void;
96
- readonly size: "medium" | "large" | "xlarge";
126
+ setSize: (size: "medium" | "large" | "xlarge" | "full") => void;
127
+ readonly size: "medium" | "large" | "xlarge" | "full";
97
128
  readonly depth: number;
98
129
  readonly open: boolean;
99
130
  };
@@ -213,6 +244,31 @@ export type TuiKV = {
213
244
  set: (key: string, value: unknown) => void;
214
245
  readonly ready: boolean;
215
246
  };
247
+ export type TuiMemoryEntry<Value extends object> = readonly [Store<Value>, (mutation: (draft: Value) => void) => void];
248
+ export type TuiStoreEntry<Value extends object> = readonly [
249
+ Store<Value>,
250
+ (mutation: (draft: Value) => void) => Promise<void>
251
+ ];
252
+ export type TuiStorage = {
253
+ /**
254
+ * Durable JSON state, namespaced per plugin: persisted to disk, survives hot
255
+ * reloads and TUI restarts, and stays in sync across running TUI instances.
256
+ * Values must be JSON-serializable; updates resolve once written.
257
+ */
258
+ store: <Value extends object>(key: string, options: {
259
+ readonly initial: Value;
260
+ }) => TuiStoreEntry<Value>;
261
+ /**
262
+ * Ephemeral in-process state, keyed per plugin. Entries live above the plugin
263
+ * lifecycle, so a hot reload hands the same live store to the new generation
264
+ * and in-memory state survives editing the plugin source. Updates are
265
+ * synchronous, values need not be JSON-serializable, and everything is gone
266
+ * when the TUI exits. Use `api.kv` for state that must outlive the process.
267
+ */
268
+ memory: <Value extends object>(key: string, options: {
269
+ readonly initial: Value;
270
+ }) => TuiMemoryEntry<Value>;
271
+ };
216
272
  export type TuiState = {
217
273
  readonly ready: boolean;
218
274
  readonly config: SdkConfig;
@@ -283,6 +339,20 @@ export type TuiSlotMap = {
283
339
  "app.bottom": {};
284
340
  "home.bottom": {};
285
341
  "home.footer": {};
342
+ "session.prompt.top": {
343
+ sessionID: string;
344
+ };
345
+ /**
346
+ * The prompt's footer row (voice/web chips, shortcut hints, editor context).
347
+ * Rendered in `replace` mode: a plugin that registers it owns the whole row,
348
+ * and the built-in footer is what renders when none does.
349
+ */
350
+ "prompt.footer": {
351
+ sessionID?: string;
352
+ /** Named `promptMode` because `mode` is the slot's own render mode. */
353
+ promptMode: "normal" | "shell";
354
+ busy: boolean;
355
+ };
286
356
  "sidebar.content": {
287
357
  sessionID: string;
288
358
  };
@@ -375,6 +445,7 @@ export type TuiPluginApi = {
375
445
  DialogSelect: <Value = unknown>(props: TuiDialogSelectProps<Value>) => JSX.Element;
376
446
  toast: (input: TuiToast) => void;
377
447
  dialog: TuiDialogStack;
448
+ tabs: TuiTabsApi;
378
449
  };
379
450
  keybind: {
380
451
  match: (key: string, evt: ParsedKey) => boolean;
@@ -383,6 +454,7 @@ export type TuiPluginApi = {
383
454
  };
384
455
  readonly tuiConfig: Frozen<TuiConfigView>;
385
456
  kv: TuiKV;
457
+ storage: TuiStorage;
386
458
  state: TuiState;
387
459
  /** Full reactive data contract used by v2 TUI plugins. */
388
460
  data: TuiV2Data;
@@ -35,7 +35,7 @@ export declare function tool<Args extends z.ZodRawShape>(input: {
35
35
  execute(args: z.core.$InferObjectOutput<Args, {}>, context: ToolContext): Promise<ToolResult>;
36
36
  };
37
37
  export declare namespace tool {
38
- var schema: typeof z;
38
+ export { z as schema };
39
39
  }
40
40
  export declare const make: typeof tool;
41
41
  export type ToolDefinition = ReturnType<typeof tool>;
@@ -1,5 +1,6 @@
1
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
+ import type { Store } from "solid-js/store";
3
4
  export type LocationRef = {
4
5
  readonly directory: string;
5
6
  readonly workspaceID?: string;
@@ -133,10 +134,28 @@ export interface UI {
133
134
  };
134
135
  readonly slot: (name: string, render: Slot) => () => void;
135
136
  }
137
+ export interface Storage {
138
+ /**
139
+ * Durable JSON state: persisted to disk, survives hot reloads and TUI
140
+ * restarts, and stays in sync across running TUI instances.
141
+ */
142
+ store<Value extends object>(key: string, options: {
143
+ readonly initial: Value;
144
+ }): readonly [Store<Value>, (mutation: (draft: Value) => void) => Promise<void>];
145
+ /**
146
+ * Ephemeral in-memory state: survives plugin hot reloads (the old and the new
147
+ * generation share the same live store) and is gone when the TUI exits.
148
+ * Updates are synchronous and values need not be JSON-serializable.
149
+ */
150
+ memory<Value extends object>(key: string, options: {
151
+ readonly initial: Value;
152
+ }): readonly [Store<Value>, (mutation: (draft: Value) => void) => void];
153
+ }
136
154
  export interface Context {
137
155
  readonly options: Readonly<Record<string, unknown>>;
138
156
  readonly client: NikcliClient;
139
157
  readonly data: Data;
158
+ readonly storage: Storage;
140
159
  readonly ui: UI;
141
160
  }
142
161
  export {};
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@nikcli-ai/plugin",
4
- "version": "1.196.0",
4
+ "version": "1.225.0",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {
8
- "typecheck": "tsgo --noEmit",
8
+ "typecheck": "tsc --noEmit",
9
9
  "build": "tsc",
10
10
  "build:plugins": "bun run script/build-plugins.ts",
11
11
  "publish:plugins": "bun run script/publish-plugins.ts"
@@ -65,16 +65,17 @@
65
65
  }
66
66
  },
67
67
  "dependencies": {
68
- "@nikcli-ai/sdk": "1.196.0",
68
+ "@nikcli-ai/sdk": "1.225.0",
69
69
  "@opentui/core": "0.1.91",
70
70
  "@opentui/solid": "0.1.91",
71
71
  "effect": "4.0.0-beta.83",
72
+ "solid-js": "1.9.10",
72
73
  "zod": "4.1.8"
73
74
  },
74
75
  "devDependencies": {
75
76
  "@tsconfig/node22": "22.0.2",
76
77
  "@types/node": "22.13.9",
77
78
  "typescript": "5.8.2",
78
- "@typescript/native-preview": "7.0.0-dev.20260707.2"
79
+ "@typescript/native": "npm:typescript@7.0.2"
79
80
  }
80
81
  }