@nikcli-ai/plugin 1.218.0 → 1.232.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
@@ -179,6 +179,27 @@ export interface Hooks {
179
179
  topK: number;
180
180
  options: Record<string, any>;
181
181
  }) => Promise<void>;
182
+ "chat.headers"?: (input: {
183
+ sessionID: string;
184
+ agent: string;
185
+ model: Model;
186
+ provider: ProviderContext;
187
+ message: UserMessage;
188
+ }, output: {
189
+ headers: Record<string, string>;
190
+ }) => Promise<void>;
191
+ /**
192
+ * Modify the final serialized HTTP request immediately before dispatch.
193
+ */
194
+ "chat.request"?: (input: {
195
+ sessionID: string;
196
+ agent: string;
197
+ model: Model;
198
+ }, output: {
199
+ url: string;
200
+ headers: Record<string, string>;
201
+ body: string | undefined;
202
+ }) => Promise<void>;
182
203
  "permission.ask"?: (input: PermissionRequest, output: {
183
204
  status: "ask" | "deny" | "allow";
184
205
  }) => Promise<void>;
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,7 +86,7 @@ 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
  };
@@ -122,8 +123,8 @@ export type TuiTabsApi = {
122
123
  export type TuiDialogStack = {
123
124
  replace: (render: () => JSX.Element, onClose?: () => void) => void;
124
125
  clear: () => void;
125
- setSize: (size: "medium" | "large" | "xlarge") => void;
126
- readonly size: "medium" | "large" | "xlarge";
126
+ setSize: (size: "medium" | "large" | "xlarge" | "full") => void;
127
+ readonly size: "medium" | "large" | "xlarge" | "full";
127
128
  readonly depth: number;
128
129
  readonly open: boolean;
129
130
  };
@@ -243,6 +244,31 @@ export type TuiKV = {
243
244
  set: (key: string, value: unknown) => void;
244
245
  readonly ready: boolean;
245
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
+ };
246
272
  export type TuiState = {
247
273
  readonly ready: boolean;
248
274
  readonly config: SdkConfig;
@@ -313,6 +339,20 @@ export type TuiSlotMap = {
313
339
  "app.bottom": {};
314
340
  "home.bottom": {};
315
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
+ };
316
356
  "sidebar.content": {
317
357
  sessionID: string;
318
358
  };
@@ -414,6 +454,7 @@ export type TuiPluginApi = {
414
454
  };
415
455
  readonly tuiConfig: Frozen<TuiConfigView>;
416
456
  kv: TuiKV;
457
+ storage: TuiStorage;
417
458
  state: TuiState;
418
459
  /** Full reactive data contract used by v2 TUI plugins. */
419
460
  data: TuiV2Data;
@@ -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,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@nikcli-ai/plugin",
4
- "version": "1.218.0",
4
+ "version": "1.232.0",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -65,10 +65,11 @@
65
65
  }
66
66
  },
67
67
  "dependencies": {
68
- "@nikcli-ai/sdk": "1.218.0",
69
- "@opentui/core": "0.1.91",
70
- "@opentui/solid": "0.1.91",
68
+ "@nikcli-ai/sdk": "1.232.0",
69
+ "@opentui/core": "0.4.5",
70
+ "@opentui/solid": "0.4.5",
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": {