@nikcli-ai/plugin 1.218.0 → 1.219.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/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";
@@ -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,9 @@ export type TuiSlotMap = {
313
339
  "app.bottom": {};
314
340
  "home.bottom": {};
315
341
  "home.footer": {};
342
+ "session.prompt.top": {
343
+ sessionID: string;
344
+ };
316
345
  "sidebar.content": {
317
346
  sessionID: string;
318
347
  };
@@ -414,6 +443,7 @@ export type TuiPluginApi = {
414
443
  };
415
444
  readonly tuiConfig: Frozen<TuiConfigView>;
416
445
  kv: TuiKV;
446
+ storage: TuiStorage;
417
447
  state: TuiState;
418
448
  /** Full reactive data contract used by v2 TUI plugins. */
419
449
  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.219.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",
68
+ "@nikcli-ai/sdk": "1.219.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": {