@howaboua/pi-agent-comms 0.0.1-dev.14.1.g7d1d3da173aa → 0.0.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # @howaboua/pi-agent-comms
2
+
3
+ ## 0.0.1
4
+
5
+ - Requires Node.js 22.19 or newer.
6
+ - Initial release combining session notes, searchable history, context rollover and agent boards. Agent Comms is an alternative to the maintained standalone Notes Compaction and Agent Board packages, preserving existing data and settings. Do not load both alternatives together.
7
+ - Notes and Board work independently and initialise on demand. Each has an Off setting.
8
+ - Notes reads accept `end_line` as an alias for `stop_line`.
9
+ - `/notes` and `/board` open their settings tabs. The Board tab opens the discussion viewer.
10
+ - Added context recovery from saved checkpoints and selected past user messages, with current instructions taking precedence.
11
+ - Shared Notes and Board references account for recipient access, with self-contained replies when access is unavailable or unknown.
package/README.md CHANGED
@@ -4,18 +4,18 @@ Keep checkpoints and searchable session history across fresh context windows, an
4
4
 
5
5
  ## Install
6
6
 
7
- Requires Pi 1.5.0 or newer and Node.js 22.18 or newer.
7
+ Requires Pi 1.5.0 or newer and Node.js 22.19 or newer.
8
8
 
9
9
  Agent Comms is the combined alternative to the maintained standalone [Notes Compaction](../pi-notes-compaction) and [Agent Board](../pi-agent-board) packages. All three receive shared implementation improvements. The standalone packages are not deprecated.
10
10
 
11
- Agent Comms is available on the `@dev` preview channel only. Shepherdr sharing requires its `@core` preview channel. Stable Shepherdr users should keep the standalone Notes Compaction and Agent Board packages.
11
+ For shared agent families, update Shepherdr in controllers and workers together. The Core-based release supports Agent Comms and the standalone providers. Older Shepherdr releases require the standalone packages.
12
12
 
13
13
  Choose Agent Comms for both features in one package, or keep the standalone packages. Do not load Agent Comms alongside either standalone extension. To switch to Agent Comms:
14
14
 
15
15
  ```sh
16
16
  pi remove npm:@howaboua/pi-notes-compaction
17
17
  pi remove npm:@howaboua/pi-agent-board
18
- pi install npm:@howaboua/pi-agent-comms@dev
18
+ pi install npm:@howaboua/pi-agent-comms
19
19
  ```
20
20
 
21
21
  For a source checkout, install from the repository root:
package/docs/BOARD.md CHANGED
@@ -8,7 +8,7 @@ Part of [Pi Agent Comms](../README.md).
8
8
 
9
9
  ## Install
10
10
 
11
- Requires Pi 1.5.0 or newer and Node.js 22.18 or newer. See the [installation status and replacement steps](../README.md#install) before replacing the old packages.
11
+ Requires Pi 1.5.0 or newer and Node.js 22.19 or newer. See the [installation choices and replacement steps](../README.md#install).
12
12
 
13
13
  ```sh
14
14
  pi install npm:@howaboua/pi-agent-comms
package/docs/NOTES.md CHANGED
@@ -6,7 +6,7 @@ Part of [Pi Agent Comms](../README.md).
6
6
 
7
7
  ## Install
8
8
 
9
- Requires Pi 1.5.0 or newer and Node.js 22.18 or newer. See the [installation status and replacement steps](../README.md#install) before replacing the old packages.
9
+ Requires Pi 1.5.0 or newer and Node.js 22.19 or newer. See the [installation choices and replacement steps](../README.md#install).
10
10
 
11
11
  ```sh
12
12
  pi install npm:@howaboua/pi-agent-comms
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howaboua/pi-agent-comms",
3
- "version": "0.0.1-dev.14.1.g7d1d3da173aa",
3
+ "version": "0.0.1",
4
4
  "description": "Session notes, context continuity and agent message boards for Pi",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  ]
37
37
  },
38
38
  "engines": {
39
- "node": ">=22.18.0"
39
+ "node": ">=22.19.0"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "node scripts/build-viewer.mjs",
@@ -48,13 +48,14 @@
48
48
  "pack:dry": "npm pack --dry-run"
49
49
  },
50
50
  "dependencies": {
51
+ "@earendil-works/pi-schema": "1.5.2",
51
52
  "better-sqlite3": "13.0.3",
52
53
  "dompurify": "3.4.17",
53
54
  "marked": "18.2.0",
54
55
  "unicode-case-folding": "1.1.2"
55
56
  },
56
57
  "devDependencies": {
57
- "@howaboua/pi-codex-conversion": "4.0.9",
58
+ "@howaboua/pi-codex-conversion": "4.0.10",
58
59
  "@types/better-sqlite3": "9.6.0"
59
60
  },
60
61
  "peerDependencies": {
@@ -62,8 +63,7 @@
62
63
  "@earendil-works/pi-agent-core": ">=1.0.4",
63
64
  "@earendil-works/pi-ai": ">=1.1.0",
64
65
  "@earendil-works/pi-tui": ">=1.1.0",
65
- "@howaboua/pi-codex-conversion": ">=4.0.9",
66
- "typebox": "*"
66
+ "@howaboua/pi-codex-conversion": ">=4.0.10"
67
67
  },
68
68
  "peerDependenciesMeta": {
69
69
  "@howaboua/pi-codex-conversion": {
@@ -1,9 +1,14 @@
1
- import { type Static, Type } from "typebox";
2
- import { Check } from "typebox/value";
3
-
4
- function StringEnum<T extends readonly string[]>(values: T) {
5
- return Type.Unsafe<T[number]>({ type: "string", enum: values });
6
- }
1
+ import {
2
+ arr,
3
+ bool,
4
+ compile,
5
+ int,
6
+ obj,
7
+ oneOf,
8
+ opt,
9
+ type Static,
10
+ str,
11
+ } from "@earendil-works/pi-schema";
7
12
 
8
13
  const BOARD_ACTIONS = [
9
14
  "help",
@@ -21,22 +26,23 @@ const BOARD_ACTIONS = [
21
26
  ] as const;
22
27
  const THREAD_STATUSES = ["open", "completed", "abandoned"] as const;
23
28
  export type ThreadStatus = (typeof THREAD_STATUSES)[number];
24
- export const BoardParameters = Type.Object({
25
- action: Type.Optional(StringEnum(BOARD_ACTIONS)),
26
- });
27
- const positive = Type.Optional(
28
- Type.Integer({ minimum: 1, maximum: 0xffffffff }),
29
+ export const BoardParameters = obj(
30
+ {
31
+ action: opt({ ...oneOf(BOARD_ACTIONS), type: "string" }),
32
+ },
33
+ { open: true },
29
34
  );
30
- const string = Type.Optional(Type.String());
31
- const Request = Type.Object(
35
+ const positive = opt(int({ minimum: 1, maximum: 0xffffffff }));
36
+ const string = opt(str());
37
+ const Request = obj(
32
38
  {
33
- action: StringEnum(BOARD_ACTIONS),
39
+ action: { ...oneOf(BOARD_ACTIONS), type: "string" },
34
40
  channel_name: string,
35
41
  new_channel_name: string,
36
42
  thread_id: string,
37
43
  message_id: string,
38
44
  text: string,
39
- status: Type.Optional(StringEnum(THREAD_STATUSES)),
45
+ status: opt({ ...oneOf(THREAD_STATUSES), type: "string" }),
40
46
  comment: string,
41
47
  query: string,
42
48
  author: string,
@@ -44,21 +50,17 @@ const Request = Type.Object(
44
50
  after_message_id: string,
45
51
  board_id: string,
46
52
  cursor: string,
47
- full: Type.Optional(Type.Boolean()),
48
- subscribe: Type.Optional(Type.Boolean()),
49
- recent_first: Type.Optional(Type.Boolean()),
50
- sort: Type.Optional(StringEnum(["created", "activity"])),
53
+ full: opt(bool()),
54
+ subscribe: opt(bool()),
55
+ recent_first: opt(bool()),
56
+ sort: opt({ ...oneOf(["created", "activity"]), type: "string" }),
51
57
  limit: positive,
52
58
  max_chars_per_post: positive,
53
59
  limit_chars: positive,
54
- offset_chars: Type.Optional(
55
- Type.Integer({ minimum: 0, maximum: 0xffffffff }),
56
- ),
57
- agents_to_notify: Type.Optional(
58
- Type.Array(Type.String(), { maxItems: 256 }),
59
- ),
60
+ offset_chars: opt(int({ minimum: 0, maximum: 0xffffffff })),
61
+ agents_to_notify: opt(arr(str(), { maxItems: 256 })),
60
62
  },
61
- { additionalProperties: false },
63
+ { open: false },
62
64
  );
63
65
  export type BoardParams = Static<typeof Request>;
64
66
  export type BoardAction = BoardParams["action"];
@@ -115,6 +117,8 @@ const requiredFields: Partial<Record<BoardAction, string[]>> = {
115
117
  read_thread: ["thread_id"],
116
118
  read_post: ["message_id"],
117
119
  };
120
+ const requestValidator = compile(Request);
121
+
118
122
  export function parseBoardRequest(value: unknown): BoardParams {
119
123
  if (
120
124
  value === undefined ||
@@ -124,7 +128,7 @@ export function parseBoardRequest(value: unknown): BoardParams {
124
128
  Object.keys(value).length === 0)
125
129
  )
126
130
  return { action: "help" };
127
- if (!Check(Request, value))
131
+ if (!requestValidator.check(value))
128
132
  throw new Error("Invalid board request; call board help");
129
133
  const request = { ...(value as BoardParams) };
130
134
  const allowed = new Set(["action", ...fields[request.action]]);
@@ -3,58 +3,75 @@ import type {
3
3
  ExtensionAPI,
4
4
  ExtensionContext,
5
5
  } from "@earendil-works/pi-coding-agent";
6
- import { type Static, Type } from "typebox";
7
- import { Check } from "typebox/value";
6
+ import {
7
+ bool,
8
+ compile,
9
+ lit,
10
+ nul,
11
+ obj,
12
+ opt,
13
+ type Static,
14
+ str,
15
+ union,
16
+ } from "@earendil-works/pi-schema";
8
17
  import { readBoardConfig } from "./config.js";
9
18
 
10
- const nativeId = Type.String({ pattern: "^[a-zA-Z0-9_.-]+$" });
11
- export const BindingSchema = Type.Object(
19
+ const nativeId = str({ pattern: "^[a-zA-Z0-9_.-]+$" });
20
+ export const BindingSchema = obj(
12
21
  {
13
- protocol: Type.Literal(1),
22
+ protocol: lit(1),
14
23
  boardId: nativeId,
15
24
  rootSessionId: nativeId,
16
25
  sessionId: nativeId,
17
- agentName: Type.String({
26
+ agentName: str({
18
27
  pattern: "^/[a-zA-Z0-9_.-]+(?:/[a-zA-Z0-9_-]+)*$",
19
28
  }),
20
- legacyAgentName: Type.Optional(
21
- Type.String({ pattern: "^/root(?:/[a-zA-Z0-9_-]+)*$" }),
22
- ),
23
- parentSessionId: Type.Optional(nativeId),
24
- ownerFolder: Type.String({ minLength: 1 }),
25
- databasePath: Type.String({ minLength: 1 }),
26
- enabled: Type.Boolean(),
27
- upstream: Type.Optional(Type.String({ minLength: 1 })),
29
+ legacyAgentName: opt(str({ pattern: "^/root(?:/[a-zA-Z0-9_-]+)*$" })),
30
+ parentSessionId: opt(nativeId),
31
+ ownerFolder: str({ minLength: 1 }),
32
+ databasePath: str({ minLength: 1 }),
33
+ enabled: bool(),
34
+ upstream: opt(str({ minLength: 1 })),
28
35
  },
29
- { additionalProperties: false },
36
+ { open: false },
30
37
  );
31
38
  export type BoardBinding = Static<typeof BindingSchema>;
32
- const ChildSchema = Type.Object({
33
- parentSessionId: nativeId,
34
- binding: BindingSchema,
35
- machine: Type.String(),
36
- sessionFile: Type.String({ minLength: 1 }),
37
- });
39
+ const ChildSchema = obj(
40
+ {
41
+ parentSessionId: nativeId,
42
+ binding: BindingSchema,
43
+ machine: str(),
44
+ sessionFile: str({ minLength: 1 }),
45
+ },
46
+ { open: true },
47
+ );
38
48
  type BoardChild = Static<typeof ChildSchema>;
39
49
  const BINDING = "shepherdr-board-binding";
40
50
  const MEMBER = "shepherdr-board-member";
41
51
  const CHILD = "shepherdr-board-child";
42
52
  const SETTING = "shepherdr-board-setting";
43
53
  const defaults = new WeakMap<ExtensionContext["sessionManager"], boolean>();
54
+ const bindingSchemaValidator = compile(BindingSchema);
55
+ const childSchemaValidator = compile(ChildSchema);
56
+
44
57
  export function setBoardDefault(ctx: ExtensionContext, enabled: boolean) {
45
58
  defaults.set(ctx.sessionManager, enabled);
46
59
  }
47
60
  const REMOVED = "shepherdr-board-removed";
48
- const SettingSchema = Type.Object({
49
- sessionId: nativeId,
50
- enabled: Type.Union([Type.Boolean(), Type.Null()]),
51
- });
61
+ const SettingSchema = obj(
62
+ {
63
+ sessionId: nativeId,
64
+ enabled: union([bool(), nul()]),
65
+ },
66
+ { open: true },
67
+ );
68
+ const settingSchemaValidator = compile(SettingSchema);
52
69
 
53
70
  function sessionBoardSetting(ctx: ExtensionContext): boolean | undefined {
54
71
  let enabled: boolean | undefined;
55
72
  for (const entry of ctx.sessionManager.getEntries()) {
56
73
  if (entry.type !== "custom" || entry.customType !== SETTING) continue;
57
- if (!Check(SettingSchema, entry.data))
74
+ if (!settingSchemaValidator.check(entry.data))
58
75
  throw new Error("Invalid saved board setting");
59
76
  const value = entry.data as Static<typeof SettingSchema>;
60
77
  if (value.sessionId === ctx.sessionManager.getSessionId())
@@ -100,7 +117,7 @@ export function rootBoardSetting(ctx: ExtensionContext) {
100
117
  }
101
118
 
102
119
  export function parseBinding(value: unknown): BoardBinding {
103
- if (!Check(BindingSchema, value))
120
+ if (!bindingSchemaValidator.check(value))
104
121
  throw new Error("Invalid Shepherdr board binding");
105
122
  const saved = value as BoardBinding;
106
123
  assertSessionIdentity(saved.sessionId, saved.rootSessionId);
@@ -189,7 +206,7 @@ export function children(ctx: ExtensionContext): BoardChild[] {
189
206
  continue;
190
207
  }
191
208
  if (entry.type !== "custom" || entry.customType !== CHILD) continue;
192
- if (!Check(ChildSchema, entry.data))
209
+ if (!childSchemaValidator.check(entry.data))
193
210
  throw new Error("Invalid saved board child route");
194
211
  const value = entry.data as BoardChild;
195
212
  if (
@@ -224,7 +241,10 @@ export function boardAliases(
224
241
  let member: BoardBinding;
225
242
  if ([BINDING, MEMBER, REMOVED].includes(entry.customType))
226
243
  member = parseBinding(entry.data);
227
- else if (entry.customType === CHILD && Check(ChildSchema, entry.data))
244
+ else if (
245
+ entry.customType === CHILD &&
246
+ childSchemaValidator.check(entry.data)
247
+ )
228
248
  member = parseBinding((entry.data as BoardChild).binding);
229
249
  else continue;
230
250
  if (member.boardId === boardId && member.legacyAgentName) {
@@ -1,70 +1,109 @@
1
- import { type Static, Type } from "typebox";
2
- import { Check } from "typebox/value";
1
+ import {
2
+ arr,
3
+ bool,
4
+ compile,
5
+ int,
6
+ lit,
7
+ nul,
8
+ obj,
9
+ opt,
10
+ type Static,
11
+ str,
12
+ union,
13
+ unknown,
14
+ } from "@earendil-works/pi-schema";
3
15
  import { BindingSchema } from "./identity.js";
4
16
 
5
- const NoticeSchema = Type.Object(
17
+ const NoticeSchema = obj(
6
18
  {
7
- message_id: Type.String(),
8
- channel_name: Type.String(),
9
- author: Type.String(),
10
- thread_id: Type.String(),
11
- created_at: Type.String(),
12
- text_preview: Type.String({ maxLength: 300 }),
13
- n_chars: Type.Integer({ minimum: 0 }),
14
- truncated: Type.Boolean(),
19
+ message_id: str(),
20
+ channel_name: str(),
21
+ author: str(),
22
+ thread_id: str(),
23
+ created_at: str(),
24
+ text_preview: str({ maxLength: 300 }),
25
+ n_chars: int({ minimum: 0 }),
26
+ truncated: bool(),
15
27
  },
16
- { additionalProperties: false },
28
+ { open: false },
17
29
  );
18
- const Protocol = Type.Union([
19
- Type.Object({
20
- operation: Type.Literal("board-catchup"),
21
- caller: BindingSchema,
22
- seen: Type.Array(Type.String()),
23
- }),
24
- Type.Object({
25
- operation: Type.Literal("board-bind"),
26
- binding: BindingSchema,
27
- }),
28
- Type.Object({
29
- operation: Type.Literal("board-register"),
30
- caller: BindingSchema,
31
- member: BindingSchema,
32
- }),
33
- Type.Object({
34
- operation: Type.Literal("board-unregister"),
35
- caller: BindingSchema,
36
- member: BindingSchema,
37
- }),
38
- Type.Object({
39
- operation: Type.Literal("board-enabled"),
40
- boardId: Type.String(),
41
- enabled: Type.Boolean(),
42
- }),
43
- Type.Object({
44
- operation: Type.Literal("board-active"),
45
- caller: BindingSchema,
46
- turnId: Type.Union([Type.String(), Type.Null()]),
47
- previousTurnId: Type.Optional(Type.String()),
48
- }),
49
- Type.Object({
50
- operation: Type.Literal("board-call"),
51
- caller: BindingSchema,
52
- params: Type.Unknown(),
53
- requestId: Type.String(),
54
- }),
55
- Type.Object({
56
- operation: Type.Literal("board-notify"),
57
- boardId: Type.String(),
58
- target: Type.String(),
59
- route: Type.Optional(Type.Array(Type.String())),
60
- sessionId: Type.String(),
61
- turnId: Type.String(),
62
- notice: NoticeSchema,
63
- }),
30
+ const Protocol = union([
31
+ obj(
32
+ {
33
+ operation: lit("board-catchup"),
34
+ caller: BindingSchema,
35
+ seen: arr(str()),
36
+ },
37
+ { open: true },
38
+ ),
39
+ obj(
40
+ {
41
+ operation: lit("board-bind"),
42
+ binding: BindingSchema,
43
+ },
44
+ { open: true },
45
+ ),
46
+ obj(
47
+ {
48
+ operation: lit("board-register"),
49
+ caller: BindingSchema,
50
+ member: BindingSchema,
51
+ },
52
+ { open: true },
53
+ ),
54
+ obj(
55
+ {
56
+ operation: lit("board-unregister"),
57
+ caller: BindingSchema,
58
+ member: BindingSchema,
59
+ },
60
+ { open: true },
61
+ ),
62
+ obj(
63
+ {
64
+ operation: lit("board-enabled"),
65
+ boardId: str(),
66
+ enabled: bool(),
67
+ },
68
+ { open: true },
69
+ ),
70
+ obj(
71
+ {
72
+ operation: lit("board-active"),
73
+ caller: BindingSchema,
74
+ turnId: union([str(), nul()]),
75
+ previousTurnId: opt(str()),
76
+ },
77
+ { open: true },
78
+ ),
79
+ obj(
80
+ {
81
+ operation: lit("board-call"),
82
+ caller: BindingSchema,
83
+ params: unknown(),
84
+ requestId: str(),
85
+ },
86
+ { open: true },
87
+ ),
88
+ obj(
89
+ {
90
+ operation: lit("board-notify"),
91
+ boardId: str(),
92
+ target: str(),
93
+ route: opt(arr(str())),
94
+ sessionId: str(),
95
+ turnId: str(),
96
+ notice: NoticeSchema,
97
+ },
98
+ { open: true },
99
+ ),
64
100
  ]);
65
101
  export type BoardEnvelope = Static<typeof Protocol>;
102
+ const protocolValidator = compile(Protocol);
103
+
66
104
  export function parseEnvelope(value: unknown): BoardEnvelope {
67
- if (!Check(Protocol, value)) throw new Error("Invalid board host request");
105
+ if (!protocolValidator.check(value))
106
+ throw new Error("Invalid board host request");
68
107
  return value as BoardEnvelope;
69
108
  }
70
109
  export function isBoardEnvelope(value: unknown): boolean {
package/src/board/tool.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  import { defineTool } from "@earendil-works/pi-coding-agent";
2
+ import { compile } from "@earendil-works/pi-schema";
2
3
  import { BoardParameters } from "./contract.js";
3
4
  import { serializeBoardToolResult } from "./response.js";
4
5
  import type { BoardRuntime } from "./runtime/coordinator.js";
5
6
 
7
+ const boardParametersValidator = compile(BoardParameters);
8
+
6
9
  export function createBoardTool(board: BoardRuntime) {
7
10
  return defineTool({
8
11
  name: "board",
@@ -12,6 +15,8 @@ export function createBoardTool(board: BoardRuntime) {
12
15
  executionMode: "sequential",
13
16
  async execute(id, params, signal, _onUpdate, ctx) {
14
17
  signal?.throwIfAborted();
18
+ if (!boardParametersValidator.check(params))
19
+ throw new Error("Invalid board request; call board help");
15
20
  const value = await board.execute(ctx, params, id);
16
21
  return {
17
22
  content: [
@@ -1,35 +1,48 @@
1
- import { Type } from "typebox";
2
- import { Check } from "typebox/value";
1
+ import {
2
+ arr,
3
+ compile,
4
+ lit,
5
+ num,
6
+ obj,
7
+ opt,
8
+ str,
9
+ union,
10
+ } from "@earendil-works/pi-schema";
3
11
  import { contextTargetAgent, isContextAgentName } from "./agent-identity.js";
4
12
  import type { RemoteNoteReference } from "./context-sharing.js";
5
13
  import { normalizeNoteParams, readNotes } from "./notes.js";
6
14
  import type { NoteRevision } from "./store.js";
7
15
 
8
- const Snapshot = Type.Object({
9
- protocol: Type.Literal(1),
10
- timestamp: Type.Number({ minimum: 0 }),
11
- files: Type.Array(
12
- Type.Object({
13
- path: Type.String(),
14
- text: Type.String(),
15
- createdAt: Type.Number(),
16
- updatedAt: Type.Number(),
17
- operation: Type.Optional(
18
- Type.Union([
19
- Type.Literal("local_append_overlay"),
20
- Type.Literal("local_replacement"),
21
- ]),
16
+ const Snapshot = obj(
17
+ {
18
+ protocol: lit(1),
19
+ timestamp: num({ minimum: 0 }),
20
+ files: arr(
21
+ obj(
22
+ {
23
+ path: str(),
24
+ text: str(),
25
+ createdAt: num(),
26
+ updatedAt: num(),
27
+ operation: opt(
28
+ union([lit("local_append_overlay"), lit("local_replacement")]),
29
+ ),
30
+ },
31
+ { open: true },
22
32
  ),
23
- }),
24
- ),
25
- });
33
+ ),
34
+ },
35
+ { open: true },
36
+ );
37
+
38
+ const snapshotValidator = compile(Snapshot);
26
39
 
27
40
  /** Retained checkpoints remain readable without a running owner or database. */
28
41
  export function readAttachmentSnapshot(
29
42
  snapshot: unknown,
30
43
  params: Record<string, unknown>,
31
44
  ): Record<string, unknown> {
32
- if (!Check(Snapshot, snapshot))
45
+ if (!snapshotValidator.check(snapshot))
33
46
  throw new Error("Invalid retained note snapshot");
34
47
  if (
35
48
  !["list_files_by_prefix", "read_file", "search_contents"].includes(
@@ -3,6 +3,7 @@ import type {
3
3
  ExtensionAPI,
4
4
  ExtensionContext,
5
5
  } from "@earendil-works/pi-coding-agent";
6
+ import type { Schema } from "@earendil-works/pi-schema";
6
7
  import type { NotesActivation } from "./activation.js";
7
8
  import type { NotesLifecycle } from "./lifecycle.js";
8
9
  import {
@@ -54,6 +55,7 @@ export async function registerNotesToolIntegrations(
54
55
  throw error;
55
56
  }
56
57
  let refreshNested = () => {};
58
+ const noteProperties = NOTES_SCHEMA["properties"] as Record<string, Schema>;
57
59
  try {
58
60
  const { adaptToolForCodeMode, registerCodeModeExtensionTools } =
59
61
  await import("@howaboua/pi-codex-conversion/code-mode");
@@ -72,14 +74,15 @@ export async function registerNotesToolIntegrations(
72
74
  ? { resultValue: historyResultValue }
73
75
  : {}),
74
76
  }),
75
- // Code checks inputs before Pi can normalise this body alias.
77
+ // Code checks inputs before Pi can normalise these aliases.
76
78
  ...(tool.name === "notes"
77
79
  ? {
78
80
  inputSchema: {
79
81
  ...NOTES_SCHEMA,
80
82
  properties: {
81
- ...NOTES_SCHEMA.properties,
82
- content: NOTES_SCHEMA.properties.text,
83
+ ...noteProperties,
84
+ content: noteProperties["text"],
85
+ end_line: noteProperties["stop_line"],
83
86
  },
84
87
  },
85
88
  }