pi-note 0.31.1 → 0.32.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.
Files changed (3) hide show
  1. package/README.md +8 -3
  2. package/package.json +1 -1
  3. package/remote.ts +10 -0
package/README.md CHANGED
@@ -76,9 +76,14 @@ Changing endpoints starts a separate selection namespace. Unsaved Pi sessions
76
76
  cannot guarantee selection persistence.
77
77
 
78
78
  The GTK app's **Start in Kitty…** action (note 0.13.0+) chooses a working directory
79
- and opens a named tab with this task selected, without submitting a prompt. Client
80
- and service both need pi-note 0.31.0+. The one-shot `PINOTE_LAUNCH_TASK` environment
81
- handoff carries only the task ID and displayed revision, never task text or tokens.
79
+ and opens a named tab with this task selected, without submitting a prompt.
80
+ With note 0.15.0+ and pi-note 0.32.0+, successful selection prefills an empty Pi editor
81
+ with `is task clear?`. Configure `gui.kitty_start_prompt` in the
82
+ [GUI config](../docs/gui.md#gui-configuration), or set it to `""` to disable; existing
83
+ drafts are never replaced. The service needs pi-note 0.31.0+.
84
+ The one-shot `PINOTE_LAUNCH_TASK` environment handoff carries the task ID, displayed
85
+ revision and optional editor draft, never task text or tokens. The draft stays
86
+ client-local and is never sent to the service or persisted as launch state.
82
87
  Only a fresh session can consume it. The service must share the GUI's database;
83
88
  missing/stale revisions fail closed. Resume, reload and `/new` never replay the
84
89
  handoff or replace another selection. Pi keeps its normal endpoint/token settings.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-note",
3
- "version": "0.31.1",
3
+ "version": "0.32.0",
4
4
  "description": "Persistent pinote tasks, Markdown handoffs, and task status for Pi",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/remote.ts CHANGED
@@ -5,6 +5,7 @@ import { ENTRY_TYPE, RemoteSession, type SavedState } from './remote/session.ts'
5
5
  import { registerTools } from './remote/tools.ts';
6
6
  import { registerPreview, RemoteUI } from './remote/ui.ts';
7
7
  import { registerRemoteExit } from './remote/exit.ts';
8
+ import { editorText } from './remote/protocol.ts';
8
9
 
9
10
  // Only an accepted /new (previousSessionFile) may carry this process-local selection.
10
11
  // Reload/resume/fork restore branch entries, never this map or a folder-global store.
@@ -48,12 +49,17 @@ export default function pinoteRemote(pi: ExtensionAPI): void {
48
49
  const branch = ctx.sessionManager.getBranch();
49
50
  let carried = reason === 'new' && previous ? transfers.get(previous) : undefined;
50
51
  let launch: { task_id: number; updated_at: string } | undefined;
52
+ let prompt: string | undefined;
51
53
  if (request) {
52
54
  try {
53
55
  if (reason !== 'startup' || branch.some((entry) => entry.type === 'message' || entry.type === 'custom' && entry.customType === ENTRY_TYPE)) throw new Error('Launch requires a fresh Pi session');
54
56
  const parsed = JSON.parse(request);
55
57
  if (!parsed || !Number.isSafeInteger(parsed.task_id) || parsed.task_id < 1 ||
56
58
  typeof parsed.updated_at !== 'string' || !parsed.updated_at.length || parsed.updated_at.length > 128) throw new Error('Invalid launch request');
59
+ if (parsed.prompt !== undefined) {
60
+ if (typeof parsed.prompt !== 'string' || [...parsed.prompt].length > 4000) throw new Error('Invalid launch prompt');
61
+ prompt = editorText(parsed.prompt);
62
+ }
57
63
  launch = { task_id: parsed.task_id, updated_at: parsed.updated_at };
58
64
  carried = { scope: config.scope, contextId: randomUUID(), state: { launch } };
59
65
  } catch {
@@ -68,6 +74,10 @@ export default function pinoteRemote(pi: ExtensionAPI): void {
68
74
  const control = view.controls.find((item) => item.id === `select:${launch.task_id}`);
69
75
  if (!control) throw new Error('Launch task changed or belongs to another service');
70
76
  await session.action(view, control); // The directory chooser's Start click granted consent.
77
+ if (prompt?.trim() && ctx.mode === 'tui' && ctx.isIdle()) {
78
+ if (ctx.ui.getEditorText().length) ctx.ui.notify('Launch draft not inserted: the editor already contains a draft.', 'warning');
79
+ else ctx.ui.setEditorText(prompt);
80
+ }
71
81
  }
72
82
  if (reason === 'new' && previous) transfers.delete(previous);
73
83
  } catch (error) {