@agent-marshal/marshal-pi 0.48.1 → 0.49.3
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/README.md +83 -0
- package/package.json +12 -1
- package/src/daemon.ts +6 -2
- package/src/generated/index.ts +271 -271
- package/src/index.ts +51 -48
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Marshal for Pi
|
|
2
|
+
|
|
3
|
+
[`@agent-marshal/marshal-pi`](https://www.npmjs.com/package/@agent-marshal/marshal-pi)
|
|
4
|
+
is the native [Pi coding agent](https://pi.dev) bridge for
|
|
5
|
+
[Marshal](https://github.com/ignition-is-go/marshal). It connects a Pi session
|
|
6
|
+
to the same roster and message bus as Claude Code, Codex, Prime Agent, opencode,
|
|
7
|
+
and other Pi sessions.
|
|
8
|
+
|
|
9
|
+
The extension runs in-process. It:
|
|
10
|
+
|
|
11
|
+
- registers the Pi session on the Marshal roster;
|
|
12
|
+
- exposes native `marshal_*` tools without requiring the model to supply its
|
|
13
|
+
own session ID;
|
|
14
|
+
- subscribes to Marshal's live notification stream; and
|
|
15
|
+
- injects direct messages with Pi's steering API, starting a turn when the
|
|
16
|
+
recipient is idle.
|
|
17
|
+
|
|
18
|
+
A durable inbox pull before each turn recovers messages received while the
|
|
19
|
+
session was disconnected. Room broadcasts remain ambient unless the recipient
|
|
20
|
+
is directly mentioned.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
Start a reachable Marshal daemon, then install the Pi package:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
cargo install marshal-daemon
|
|
28
|
+
marshal-daemon &
|
|
29
|
+
pi install npm:@agent-marshal/marshal-pi
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Restart Pi after installation. No MCP server or wrapper is required. The
|
|
33
|
+
extension uses `ws://localhost:6155` by default; point it at a remote daemon
|
|
34
|
+
with:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
export MARSHAL_DAEMON_ADDRESS=ws://marshal.example.net:6155
|
|
38
|
+
pi
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`MYKO_ADDRESS` is accepted as a fallback. `MARSHAL_OPERATOR` optionally
|
|
42
|
+
overrides the operator shown on the roster.
|
|
43
|
+
|
|
44
|
+
## Verify
|
|
45
|
+
|
|
46
|
+
Run `/marshal-status` in Pi or call `marshal_whoami`. Send a direct message to
|
|
47
|
+
the Pi session's nickname from another Marshal-connected harness. The message
|
|
48
|
+
appears in the transcript as:
|
|
49
|
+
|
|
50
|
+
```text
|
|
51
|
+
new message from <nickname>: <body>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Peer content is untrusted input. The extension frames it that way in the system
|
|
55
|
+
prompt and directs replies through `marshal_send_message`.
|
|
56
|
+
|
|
57
|
+
## Tools
|
|
58
|
+
|
|
59
|
+
- `marshal_whoami`
|
|
60
|
+
- `marshal_roster`
|
|
61
|
+
- `marshal_messages`
|
|
62
|
+
- `marshal_send_message`
|
|
63
|
+
- `marshal_broadcast`
|
|
64
|
+
- `marshal_join_room`
|
|
65
|
+
- `marshal_leave_room`
|
|
66
|
+
- `marshal_set_status`
|
|
67
|
+
- `marshal_ack`
|
|
68
|
+
|
|
69
|
+
## Development
|
|
70
|
+
|
|
71
|
+
From the repository root:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
cd plugins/marshal-pi
|
|
75
|
+
npm ci --ignore-scripts --workspaces=false
|
|
76
|
+
npm run gen
|
|
77
|
+
npm run check
|
|
78
|
+
cd ../..
|
|
79
|
+
pi --extension ./plugins/marshal-pi/src/index.ts
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The generated TypeScript wire types come from the Rust `marshal-entities`
|
|
83
|
+
crate and are produced before validation and publication.
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
},
|
|
5
5
|
"description": "pi extension that connects a pi coding-agent session to the marshal coordination daemon — roster registration, send_message/broadcast/join_room/leave_room/set_status tools, and real-time + per-turn delivery of sibling-agent messages. The pi-native counterpart of the Claude Code marshal-shim, built on pi's extension API instead of a shim binary.",
|
|
6
6
|
"devDependencies": {
|
|
7
|
+
"@types/node": "^24.0.0",
|
|
7
8
|
"typescript": "^5.3.3"
|
|
8
9
|
},
|
|
9
10
|
"exports": {
|
|
@@ -18,6 +19,7 @@
|
|
|
18
19
|
"cargo:marshal-entities"
|
|
19
20
|
],
|
|
20
21
|
"tasks": [
|
|
22
|
+
"check",
|
|
21
23
|
"gen",
|
|
22
24
|
"publish"
|
|
23
25
|
]
|
|
@@ -39,6 +41,15 @@
|
|
|
39
41
|
"./src/index.ts"
|
|
40
42
|
]
|
|
41
43
|
},
|
|
44
|
+
"repository": {
|
|
45
|
+
"directory": "plugins/marshal-pi",
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/ignition-is-go/marshal"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"check": "tsc --noEmit",
|
|
51
|
+
"gen": "cargo run -p marshal-entities --no-default-features --features codegen --bin typegen -- src/generated"
|
|
52
|
+
},
|
|
42
53
|
"type": "module",
|
|
43
|
-
"version": "0.
|
|
54
|
+
"version": "0.49.3"
|
|
44
55
|
}
|
package/src/daemon.ts
CHANGED
|
@@ -155,6 +155,10 @@ export class MarshalDaemon {
|
|
|
155
155
|
host: this.cfg.identity.host ?? null,
|
|
156
156
|
gitBranch: this.cfg.identity.gitBranch ?? null,
|
|
157
157
|
project: this.cfg.identity.project ?? null,
|
|
158
|
+
// Pi can render custom messages and start/steer turns through its
|
|
159
|
+
// extension API, so identify the harness and advertise that capability.
|
|
160
|
+
channelsEnabled: true,
|
|
161
|
+
kind: "pi",
|
|
158
162
|
} as SessionItem;
|
|
159
163
|
(item as any).lastActivityAt = now;
|
|
160
164
|
this.sessions.set(sessionId, item);
|
|
@@ -229,7 +233,7 @@ export class MarshalDaemon {
|
|
|
229
233
|
inbox: opts.room ? false : true,
|
|
230
234
|
sent: false,
|
|
231
235
|
unread: false,
|
|
232
|
-
since: opts.since,
|
|
236
|
+
since: opts.since === undefined ? undefined : BigInt(opts.since),
|
|
233
237
|
limit: opts.limit ?? 50,
|
|
234
238
|
}));
|
|
235
239
|
const messages = result.messages ?? [];
|
|
@@ -351,4 +355,4 @@ export class MarshalDaemon {
|
|
|
351
355
|
private watch<I>(query: MarshalQuery<I>) {
|
|
352
356
|
return this.client.watchQuery(query as never) as unknown as import("rxjs").Observable<I[]>;
|
|
353
357
|
}
|
|
354
|
-
}
|
|
358
|
+
}
|
package/src/generated/index.ts
CHANGED
|
@@ -277,41 +277,41 @@ import type { SetSessionLastToolAt as _SetSessionLastToolAt } from "./SetSession
|
|
|
277
277
|
import type { SetSessionSessionName as _SetSessionSessionName } from "./SetSessionSessionName";
|
|
278
278
|
|
|
279
279
|
// Query classes
|
|
280
|
-
export class
|
|
281
|
-
static readonly queryId = "
|
|
282
|
-
static readonly queryItemType = "
|
|
283
|
-
readonly queryId = "
|
|
284
|
-
readonly queryItemType = "
|
|
285
|
-
readonly query: Omit<
|
|
286
|
-
declare readonly $res: () =>
|
|
280
|
+
export class GetMessageReadsByQuery {
|
|
281
|
+
static readonly queryId = "GetMessageReadsByQuery" as const;
|
|
282
|
+
static readonly queryItemType = "MessageRead" as const;
|
|
283
|
+
readonly queryId = "GetMessageReadsByQuery" as const;
|
|
284
|
+
readonly queryItemType = "MessageRead" as const;
|
|
285
|
+
readonly query: Omit<_GetMessageReadsByQuery, "tx" | "createdAt">;
|
|
286
|
+
declare readonly $res: () => MessageRead[];
|
|
287
287
|
|
|
288
|
-
constructor(args: Omit<
|
|
288
|
+
constructor(args: Omit<_GetMessageReadsByQuery, "tx" | "createdAt">) {
|
|
289
289
|
this.query = args;
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
export class
|
|
294
|
-
static readonly queryId = "
|
|
295
|
-
static readonly queryItemType = "
|
|
296
|
-
readonly queryId = "
|
|
297
|
-
readonly queryItemType = "
|
|
298
|
-
readonly query: Omit<
|
|
299
|
-
declare readonly $res: () =>
|
|
293
|
+
export class GetMessageReadsByIds {
|
|
294
|
+
static readonly queryId = "GetMessageReadsByIds" as const;
|
|
295
|
+
static readonly queryItemType = "MessageRead" as const;
|
|
296
|
+
readonly queryId = "GetMessageReadsByIds" as const;
|
|
297
|
+
readonly queryItemType = "MessageRead" as const;
|
|
298
|
+
readonly query: Omit<_GetMessageReadsByIds, "tx" | "createdAt">;
|
|
299
|
+
declare readonly $res: () => MessageRead[];
|
|
300
300
|
|
|
301
|
-
constructor(args: Omit<
|
|
301
|
+
constructor(args: Omit<_GetMessageReadsByIds, "tx" | "createdAt">) {
|
|
302
302
|
this.query = args;
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
export class
|
|
307
|
-
static readonly queryId = "
|
|
308
|
-
static readonly queryItemType = "
|
|
309
|
-
readonly queryId = "
|
|
310
|
-
readonly queryItemType = "
|
|
311
|
-
readonly query: Omit<
|
|
312
|
-
declare readonly $res: () =>
|
|
306
|
+
export class GetAllMessageReads {
|
|
307
|
+
static readonly queryId = "GetAllMessageReads" as const;
|
|
308
|
+
static readonly queryItemType = "MessageRead" as const;
|
|
309
|
+
readonly queryId = "GetAllMessageReads" as const;
|
|
310
|
+
readonly queryItemType = "MessageRead" as const;
|
|
311
|
+
readonly query: Omit<_GetAllMessageReads, "tx" | "createdAt">;
|
|
312
|
+
declare readonly $res: () => MessageRead[];
|
|
313
313
|
|
|
314
|
-
constructor(args: Omit<
|
|
314
|
+
constructor(args: Omit<_GetAllMessageReads, "tx" | "createdAt">) {
|
|
315
315
|
this.query = args;
|
|
316
316
|
}
|
|
317
317
|
}
|
|
@@ -355,41 +355,41 @@ export class GetAllRoomMembers {
|
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
-
export class
|
|
359
|
-
static readonly queryId = "
|
|
360
|
-
static readonly queryItemType = "
|
|
361
|
-
readonly queryId = "
|
|
362
|
-
readonly queryItemType = "
|
|
363
|
-
readonly query: Omit<
|
|
364
|
-
declare readonly $res: () =>
|
|
358
|
+
export class GetSessionsByQuery {
|
|
359
|
+
static readonly queryId = "GetSessionsByQuery" as const;
|
|
360
|
+
static readonly queryItemType = "Session" as const;
|
|
361
|
+
readonly queryId = "GetSessionsByQuery" as const;
|
|
362
|
+
readonly queryItemType = "Session" as const;
|
|
363
|
+
readonly query: Omit<_GetSessionsByQuery, "tx" | "createdAt">;
|
|
364
|
+
declare readonly $res: () => Session[];
|
|
365
365
|
|
|
366
|
-
constructor(args: Omit<
|
|
366
|
+
constructor(args: Omit<_GetSessionsByQuery, "tx" | "createdAt">) {
|
|
367
367
|
this.query = args;
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
|
|
371
|
-
export class
|
|
372
|
-
static readonly queryId = "
|
|
373
|
-
static readonly queryItemType = "
|
|
374
|
-
readonly queryId = "
|
|
375
|
-
readonly queryItemType = "
|
|
376
|
-
readonly query: Omit<
|
|
377
|
-
declare readonly $res: () =>
|
|
371
|
+
export class GetSessionsByIds {
|
|
372
|
+
static readonly queryId = "GetSessionsByIds" as const;
|
|
373
|
+
static readonly queryItemType = "Session" as const;
|
|
374
|
+
readonly queryId = "GetSessionsByIds" as const;
|
|
375
|
+
readonly queryItemType = "Session" as const;
|
|
376
|
+
readonly query: Omit<_GetSessionsByIds, "tx" | "createdAt">;
|
|
377
|
+
declare readonly $res: () => Session[];
|
|
378
378
|
|
|
379
|
-
constructor(args: Omit<
|
|
379
|
+
constructor(args: Omit<_GetSessionsByIds, "tx" | "createdAt">) {
|
|
380
380
|
this.query = args;
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
-
export class
|
|
385
|
-
static readonly queryId = "
|
|
386
|
-
static readonly queryItemType = "
|
|
387
|
-
readonly queryId = "
|
|
388
|
-
readonly queryItemType = "
|
|
389
|
-
readonly query: Omit<
|
|
390
|
-
declare readonly $res: () =>
|
|
384
|
+
export class GetAllSessions {
|
|
385
|
+
static readonly queryId = "GetAllSessions" as const;
|
|
386
|
+
static readonly queryItemType = "Session" as const;
|
|
387
|
+
readonly queryId = "GetAllSessions" as const;
|
|
388
|
+
readonly queryItemType = "Session" as const;
|
|
389
|
+
readonly query: Omit<_GetAllSessions, "tx" | "createdAt">;
|
|
390
|
+
declare readonly $res: () => Session[];
|
|
391
391
|
|
|
392
|
-
constructor(args: Omit<
|
|
392
|
+
constructor(args: Omit<_GetAllSessions, "tx" | "createdAt">) {
|
|
393
393
|
this.query = args;
|
|
394
394
|
}
|
|
395
395
|
}
|
|
@@ -472,41 +472,41 @@ export class GetAllRooms {
|
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
474
|
|
|
475
|
-
export class
|
|
476
|
-
static readonly queryId = "
|
|
477
|
-
static readonly queryItemType = "
|
|
478
|
-
readonly queryId = "
|
|
479
|
-
readonly queryItemType = "
|
|
480
|
-
readonly query: Omit<
|
|
481
|
-
declare readonly $res: () =>
|
|
475
|
+
export class GetSessionNicknamesByQuery {
|
|
476
|
+
static readonly queryId = "GetSessionNicknamesByQuery" as const;
|
|
477
|
+
static readonly queryItemType = "SessionNickname" as const;
|
|
478
|
+
readonly queryId = "GetSessionNicknamesByQuery" as const;
|
|
479
|
+
readonly queryItemType = "SessionNickname" as const;
|
|
480
|
+
readonly query: Omit<_GetSessionNicknamesByQuery, "tx" | "createdAt">;
|
|
481
|
+
declare readonly $res: () => SessionNickname[];
|
|
482
482
|
|
|
483
|
-
constructor(args: Omit<
|
|
483
|
+
constructor(args: Omit<_GetSessionNicknamesByQuery, "tx" | "createdAt">) {
|
|
484
484
|
this.query = args;
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
487
|
|
|
488
|
-
export class
|
|
489
|
-
static readonly queryId = "
|
|
490
|
-
static readonly queryItemType = "
|
|
491
|
-
readonly queryId = "
|
|
492
|
-
readonly queryItemType = "
|
|
493
|
-
readonly query: Omit<
|
|
494
|
-
declare readonly $res: () =>
|
|
488
|
+
export class GetSessionNicknamesByIds {
|
|
489
|
+
static readonly queryId = "GetSessionNicknamesByIds" as const;
|
|
490
|
+
static readonly queryItemType = "SessionNickname" as const;
|
|
491
|
+
readonly queryId = "GetSessionNicknamesByIds" as const;
|
|
492
|
+
readonly queryItemType = "SessionNickname" as const;
|
|
493
|
+
readonly query: Omit<_GetSessionNicknamesByIds, "tx" | "createdAt">;
|
|
494
|
+
declare readonly $res: () => SessionNickname[];
|
|
495
495
|
|
|
496
|
-
constructor(args: Omit<
|
|
496
|
+
constructor(args: Omit<_GetSessionNicknamesByIds, "tx" | "createdAt">) {
|
|
497
497
|
this.query = args;
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
|
|
501
|
-
export class
|
|
502
|
-
static readonly queryId = "
|
|
503
|
-
static readonly queryItemType = "
|
|
504
|
-
readonly queryId = "
|
|
505
|
-
readonly queryItemType = "
|
|
506
|
-
readonly query: Omit<
|
|
507
|
-
declare readonly $res: () =>
|
|
501
|
+
export class GetAllSessionNicknames {
|
|
502
|
+
static readonly queryId = "GetAllSessionNicknames" as const;
|
|
503
|
+
static readonly queryItemType = "SessionNickname" as const;
|
|
504
|
+
readonly queryId = "GetAllSessionNicknames" as const;
|
|
505
|
+
readonly queryItemType = "SessionNickname" as const;
|
|
506
|
+
readonly query: Omit<_GetAllSessionNicknames, "tx" | "createdAt">;
|
|
507
|
+
declare readonly $res: () => SessionNickname[];
|
|
508
508
|
|
|
509
|
-
constructor(args: Omit<
|
|
509
|
+
constructor(args: Omit<_GetAllSessionNicknames, "tx" | "createdAt">) {
|
|
510
510
|
this.query = args;
|
|
511
511
|
}
|
|
512
512
|
}
|
|
@@ -514,35 +514,35 @@ export class GetAllSessions {
|
|
|
514
514
|
// View classes
|
|
515
515
|
|
|
516
516
|
// Report classes
|
|
517
|
-
export class
|
|
518
|
-
static readonly reportId = "
|
|
519
|
-
readonly reportId = "
|
|
520
|
-
readonly report: Omit<
|
|
521
|
-
declare readonly $res: () =>
|
|
517
|
+
export class GetMessageReadById {
|
|
518
|
+
static readonly reportId = "GetMessageReadById" as const;
|
|
519
|
+
readonly reportId = "GetMessageReadById" as const;
|
|
520
|
+
readonly report: Omit<_GetMessageReadById, "tx">;
|
|
521
|
+
declare readonly $res: () => MessageRead | null;
|
|
522
522
|
|
|
523
|
-
constructor(args: Omit<
|
|
523
|
+
constructor(args: Omit<_GetMessageReadById, "tx">) {
|
|
524
524
|
this.report = args;
|
|
525
525
|
}
|
|
526
526
|
}
|
|
527
527
|
|
|
528
|
-
export class
|
|
529
|
-
static readonly reportId = "
|
|
530
|
-
readonly reportId = "
|
|
531
|
-
readonly report: Omit<
|
|
532
|
-
declare readonly $res: () =>
|
|
528
|
+
export class CountMessageReads {
|
|
529
|
+
static readonly reportId = "CountMessageReads" as const;
|
|
530
|
+
readonly reportId = "CountMessageReads" as const;
|
|
531
|
+
readonly report: Omit<_CountMessageReads, "tx">;
|
|
532
|
+
declare readonly $res: () => MessageReadCount;
|
|
533
533
|
|
|
534
|
-
constructor(args: Omit<
|
|
534
|
+
constructor(args: Omit<_CountMessageReads, "tx">) {
|
|
535
535
|
this.report = args;
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
|
|
539
|
-
export class
|
|
540
|
-
static readonly reportId = "
|
|
541
|
-
readonly reportId = "
|
|
542
|
-
readonly report: Omit<
|
|
543
|
-
declare readonly $res: () =>
|
|
539
|
+
export class CountAllMessageReads {
|
|
540
|
+
static readonly reportId = "CountAllMessageReads" as const;
|
|
541
|
+
readonly reportId = "CountAllMessageReads" as const;
|
|
542
|
+
readonly report: Omit<_CountAllMessageReads, "tx">;
|
|
543
|
+
declare readonly $res: () => MessageReadCount;
|
|
544
544
|
|
|
545
|
-
constructor(args: Omit<
|
|
545
|
+
constructor(args: Omit<_CountAllMessageReads, "tx">) {
|
|
546
546
|
this.report = args;
|
|
547
547
|
}
|
|
548
548
|
}
|
|
@@ -580,35 +580,35 @@ export class CountAllRoomMembers {
|
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
|
|
583
|
-
export class
|
|
584
|
-
static readonly reportId = "
|
|
585
|
-
readonly reportId = "
|
|
586
|
-
readonly report: Omit<
|
|
587
|
-
declare readonly $res: () =>
|
|
583
|
+
export class GetSessionById {
|
|
584
|
+
static readonly reportId = "GetSessionById" as const;
|
|
585
|
+
readonly reportId = "GetSessionById" as const;
|
|
586
|
+
readonly report: Omit<_GetSessionById, "tx">;
|
|
587
|
+
declare readonly $res: () => Session | null;
|
|
588
588
|
|
|
589
|
-
constructor(args: Omit<
|
|
589
|
+
constructor(args: Omit<_GetSessionById, "tx">) {
|
|
590
590
|
this.report = args;
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
593
|
|
|
594
|
-
export class
|
|
595
|
-
static readonly reportId = "
|
|
596
|
-
readonly reportId = "
|
|
597
|
-
readonly report: Omit<
|
|
598
|
-
declare readonly $res: () =>
|
|
594
|
+
export class CountSessions {
|
|
595
|
+
static readonly reportId = "CountSessions" as const;
|
|
596
|
+
readonly reportId = "CountSessions" as const;
|
|
597
|
+
readonly report: Omit<_CountSessions, "tx">;
|
|
598
|
+
declare readonly $res: () => SessionCount;
|
|
599
599
|
|
|
600
|
-
constructor(args: Omit<
|
|
600
|
+
constructor(args: Omit<_CountSessions, "tx">) {
|
|
601
601
|
this.report = args;
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
604
|
|
|
605
|
-
export class
|
|
606
|
-
static readonly reportId = "
|
|
607
|
-
readonly reportId = "
|
|
608
|
-
readonly report: Omit<
|
|
609
|
-
declare readonly $res: () =>
|
|
605
|
+
export class CountAllSessions {
|
|
606
|
+
static readonly reportId = "CountAllSessions" as const;
|
|
607
|
+
readonly reportId = "CountAllSessions" as const;
|
|
608
|
+
readonly report: Omit<_CountAllSessions, "tx">;
|
|
609
|
+
declare readonly $res: () => SessionCount;
|
|
610
610
|
|
|
611
|
-
constructor(args: Omit<
|
|
611
|
+
constructor(args: Omit<_CountAllSessions, "tx">) {
|
|
612
612
|
this.report = args;
|
|
613
613
|
}
|
|
614
614
|
}
|
|
@@ -679,58 +679,80 @@ export class CountAllRooms {
|
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
681
|
|
|
682
|
-
export class
|
|
683
|
-
static readonly reportId = "
|
|
684
|
-
readonly reportId = "
|
|
685
|
-
readonly report: Omit<
|
|
686
|
-
declare readonly $res: () =>
|
|
682
|
+
export class GetSessionNicknameById {
|
|
683
|
+
static readonly reportId = "GetSessionNicknameById" as const;
|
|
684
|
+
readonly reportId = "GetSessionNicknameById" as const;
|
|
685
|
+
readonly report: Omit<_GetSessionNicknameById, "tx">;
|
|
686
|
+
declare readonly $res: () => SessionNickname | null;
|
|
687
687
|
|
|
688
|
-
constructor(args: Omit<
|
|
688
|
+
constructor(args: Omit<_GetSessionNicknameById, "tx">) {
|
|
689
689
|
this.report = args;
|
|
690
690
|
}
|
|
691
691
|
}
|
|
692
692
|
|
|
693
|
-
export class
|
|
694
|
-
static readonly reportId = "
|
|
695
|
-
readonly reportId = "
|
|
696
|
-
readonly report: Omit<
|
|
697
|
-
declare readonly $res: () =>
|
|
693
|
+
export class CountSessionNicknames {
|
|
694
|
+
static readonly reportId = "CountSessionNicknames" as const;
|
|
695
|
+
readonly reportId = "CountSessionNicknames" as const;
|
|
696
|
+
readonly report: Omit<_CountSessionNicknames, "tx">;
|
|
697
|
+
declare readonly $res: () => SessionNicknameCount;
|
|
698
698
|
|
|
699
|
-
constructor(args: Omit<
|
|
699
|
+
constructor(args: Omit<_CountSessionNicknames, "tx">) {
|
|
700
700
|
this.report = args;
|
|
701
701
|
}
|
|
702
702
|
}
|
|
703
703
|
|
|
704
|
-
export class
|
|
705
|
-
static readonly reportId = "
|
|
706
|
-
readonly reportId = "
|
|
707
|
-
readonly report: Omit<
|
|
708
|
-
declare readonly $res: () =>
|
|
704
|
+
export class CountAllSessionNicknames {
|
|
705
|
+
static readonly reportId = "CountAllSessionNicknames" as const;
|
|
706
|
+
readonly reportId = "CountAllSessionNicknames" as const;
|
|
707
|
+
readonly report: Omit<_CountAllSessionNicknames, "tx">;
|
|
708
|
+
declare readonly $res: () => SessionNicknameCount;
|
|
709
709
|
|
|
710
|
-
constructor(args: Omit<
|
|
710
|
+
constructor(args: Omit<_CountAllSessionNicknames, "tx">) {
|
|
711
711
|
this.report = args;
|
|
712
712
|
}
|
|
713
713
|
}
|
|
714
714
|
|
|
715
715
|
// Command classes
|
|
716
|
-
export class
|
|
717
|
-
static readonly commandId = "
|
|
718
|
-
readonly commandId = "
|
|
719
|
-
readonly command: Omit<
|
|
720
|
-
declare readonly $res: () =>
|
|
716
|
+
export class SendMessage {
|
|
717
|
+
static readonly commandId = "SendMessage" as const;
|
|
718
|
+
readonly commandId = "SendMessage" as const;
|
|
719
|
+
readonly command: Omit<_SendMessage, "tx" | "createdAt">;
|
|
720
|
+
declare readonly $res: () => SendMessageResult;
|
|
721
721
|
|
|
722
|
-
constructor(args: Omit<
|
|
722
|
+
constructor(args: Omit<_SendMessage, "tx" | "createdAt">) {
|
|
723
723
|
this.command = args;
|
|
724
724
|
}
|
|
725
725
|
}
|
|
726
726
|
|
|
727
|
-
export class
|
|
728
|
-
static readonly commandId = "
|
|
729
|
-
readonly commandId = "
|
|
730
|
-
readonly command: Omit<
|
|
731
|
-
declare readonly $res: () =>
|
|
727
|
+
export class DeleteMessageReads {
|
|
728
|
+
static readonly commandId = "DeleteMessageReads" as const;
|
|
729
|
+
readonly commandId = "DeleteMessageReads" as const;
|
|
730
|
+
readonly command: Omit<_DeleteMessageReads, "tx" | "createdAt">;
|
|
731
|
+
declare readonly $res: () => DeleteMessageReadsResult;
|
|
732
732
|
|
|
733
|
-
constructor(args: Omit<
|
|
733
|
+
constructor(args: Omit<_DeleteMessageReads, "tx" | "createdAt">) {
|
|
734
|
+
this.command = args;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
export class DeleteMessageRead {
|
|
739
|
+
static readonly commandId = "DeleteMessageRead" as const;
|
|
740
|
+
readonly commandId = "DeleteMessageRead" as const;
|
|
741
|
+
readonly command: Omit<_DeleteMessageRead, "tx" | "createdAt">;
|
|
742
|
+
declare readonly $res: () => DeleteMessageReadResult;
|
|
743
|
+
|
|
744
|
+
constructor(args: Omit<_DeleteMessageRead, "tx" | "createdAt">) {
|
|
745
|
+
this.command = args;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
export class NotifyChannel {
|
|
750
|
+
static readonly commandId = "NotifyChannel" as const;
|
|
751
|
+
readonly commandId = "NotifyChannel" as const;
|
|
752
|
+
readonly command: Omit<_NotifyChannel, "tx" | "createdAt">;
|
|
753
|
+
declare readonly $res: () => void;
|
|
754
|
+
|
|
755
|
+
constructor(args: Omit<_NotifyChannel, "tx" | "createdAt">) {
|
|
734
756
|
this.command = args;
|
|
735
757
|
}
|
|
736
758
|
}
|
|
@@ -757,57 +779,112 @@ export class DeleteRoomMember {
|
|
|
757
779
|
}
|
|
758
780
|
}
|
|
759
781
|
|
|
760
|
-
export class
|
|
761
|
-
static readonly commandId = "
|
|
762
|
-
readonly commandId = "
|
|
763
|
-
readonly command: Omit<
|
|
764
|
-
declare readonly $res: () =>
|
|
782
|
+
export class DeleteSessions {
|
|
783
|
+
static readonly commandId = "DeleteSessions" as const;
|
|
784
|
+
readonly commandId = "DeleteSessions" as const;
|
|
785
|
+
readonly command: Omit<_DeleteSessions, "tx" | "createdAt">;
|
|
786
|
+
declare readonly $res: () => DeleteSessionsResult;
|
|
765
787
|
|
|
766
|
-
constructor(args: Omit<
|
|
788
|
+
constructor(args: Omit<_DeleteSessions, "tx" | "createdAt">) {
|
|
767
789
|
this.command = args;
|
|
768
790
|
}
|
|
769
791
|
}
|
|
770
792
|
|
|
771
|
-
export class
|
|
772
|
-
static readonly commandId = "
|
|
773
|
-
readonly commandId = "
|
|
774
|
-
readonly command: Omit<
|
|
775
|
-
declare readonly $res: () =>
|
|
793
|
+
export class DeleteSession {
|
|
794
|
+
static readonly commandId = "DeleteSession" as const;
|
|
795
|
+
readonly commandId = "DeleteSession" as const;
|
|
796
|
+
readonly command: Omit<_DeleteSession, "tx" | "createdAt">;
|
|
797
|
+
declare readonly $res: () => DeleteSessionResult;
|
|
776
798
|
|
|
777
|
-
constructor(args: Omit<
|
|
799
|
+
constructor(args: Omit<_DeleteSession, "tx" | "createdAt">) {
|
|
778
800
|
this.command = args;
|
|
779
801
|
}
|
|
780
802
|
}
|
|
781
803
|
|
|
782
|
-
export class
|
|
783
|
-
static readonly commandId = "
|
|
784
|
-
readonly commandId = "
|
|
785
|
-
readonly command: Omit<
|
|
786
|
-
declare readonly $res: () =>
|
|
804
|
+
export class SetSessionLastActivityAt {
|
|
805
|
+
static readonly commandId = "SetSessionLastActivityAt" as const;
|
|
806
|
+
readonly commandId = "SetSessionLastActivityAt" as const;
|
|
807
|
+
readonly command: Omit<_SetSessionLastActivityAt, "tx" | "createdAt">;
|
|
808
|
+
declare readonly $res: () => void;
|
|
787
809
|
|
|
788
|
-
constructor(args: Omit<
|
|
810
|
+
constructor(args: Omit<_SetSessionLastActivityAt, "tx" | "createdAt">) {
|
|
789
811
|
this.command = args;
|
|
790
812
|
}
|
|
791
813
|
}
|
|
792
814
|
|
|
793
|
-
export class
|
|
794
|
-
static readonly commandId = "
|
|
795
|
-
readonly commandId = "
|
|
796
|
-
readonly command: Omit<
|
|
797
|
-
declare readonly $res: () =>
|
|
815
|
+
export class SetSessionActivity {
|
|
816
|
+
static readonly commandId = "SetSessionActivity" as const;
|
|
817
|
+
readonly commandId = "SetSessionActivity" as const;
|
|
818
|
+
readonly command: Omit<_SetSessionActivity, "tx" | "createdAt">;
|
|
819
|
+
declare readonly $res: () => void;
|
|
798
820
|
|
|
799
|
-
constructor(args: Omit<
|
|
821
|
+
constructor(args: Omit<_SetSessionActivity, "tx" | "createdAt">) {
|
|
800
822
|
this.command = args;
|
|
801
823
|
}
|
|
802
824
|
}
|
|
803
825
|
|
|
804
|
-
export class
|
|
805
|
-
static readonly commandId = "
|
|
806
|
-
readonly commandId = "
|
|
807
|
-
readonly command: Omit<
|
|
826
|
+
export class SetSessionSessionName {
|
|
827
|
+
static readonly commandId = "SetSessionSessionName" as const;
|
|
828
|
+
readonly commandId = "SetSessionSessionName" as const;
|
|
829
|
+
readonly command: Omit<_SetSessionSessionName, "tx" | "createdAt">;
|
|
808
830
|
declare readonly $res: () => void;
|
|
809
831
|
|
|
810
|
-
constructor(args: Omit<
|
|
832
|
+
constructor(args: Omit<_SetSessionSessionName, "tx" | "createdAt">) {
|
|
833
|
+
this.command = args;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
export class SetSessionLastToolAt {
|
|
838
|
+
static readonly commandId = "SetSessionLastToolAt" as const;
|
|
839
|
+
readonly commandId = "SetSessionLastToolAt" as const;
|
|
840
|
+
readonly command: Omit<_SetSessionLastToolAt, "tx" | "createdAt">;
|
|
841
|
+
declare readonly $res: () => void;
|
|
842
|
+
|
|
843
|
+
constructor(args: Omit<_SetSessionLastToolAt, "tx" | "createdAt">) {
|
|
844
|
+
this.command = args;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
export class SetSessionLastTool {
|
|
849
|
+
static readonly commandId = "SetSessionLastTool" as const;
|
|
850
|
+
readonly commandId = "SetSessionLastTool" as const;
|
|
851
|
+
readonly command: Omit<_SetSessionLastTool, "tx" | "createdAt">;
|
|
852
|
+
declare readonly $res: () => void;
|
|
853
|
+
|
|
854
|
+
constructor(args: Omit<_SetSessionLastTool, "tx" | "createdAt">) {
|
|
855
|
+
this.command = args;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
export class SetSessionCurrentTask {
|
|
860
|
+
static readonly commandId = "SetSessionCurrentTask" as const;
|
|
861
|
+
readonly commandId = "SetSessionCurrentTask" as const;
|
|
862
|
+
readonly command: Omit<_SetSessionCurrentTask, "tx" | "createdAt">;
|
|
863
|
+
declare readonly $res: () => void;
|
|
864
|
+
|
|
865
|
+
constructor(args: Omit<_SetSessionCurrentTask, "tx" | "createdAt">) {
|
|
866
|
+
this.command = args;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
export class SetSessionGitBranch {
|
|
871
|
+
static readonly commandId = "SetSessionGitBranch" as const;
|
|
872
|
+
readonly commandId = "SetSessionGitBranch" as const;
|
|
873
|
+
readonly command: Omit<_SetSessionGitBranch, "tx" | "createdAt">;
|
|
874
|
+
declare readonly $res: () => void;
|
|
875
|
+
|
|
876
|
+
constructor(args: Omit<_SetSessionGitBranch, "tx" | "createdAt">) {
|
|
877
|
+
this.command = args;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
export class BroadcastMessage {
|
|
882
|
+
static readonly commandId = "BroadcastMessage" as const;
|
|
883
|
+
readonly commandId = "BroadcastMessage" as const;
|
|
884
|
+
readonly command: Omit<_BroadcastMessage, "tx" | "createdAt">;
|
|
885
|
+
declare readonly $res: () => BroadcastMessageResult;
|
|
886
|
+
|
|
887
|
+
constructor(args: Omit<_BroadcastMessage, "tx" | "createdAt">) {
|
|
811
888
|
this.command = args;
|
|
812
889
|
}
|
|
813
890
|
}
|
|
@@ -900,135 +977,58 @@ export class SetRoomDescription {
|
|
|
900
977
|
}
|
|
901
978
|
}
|
|
902
979
|
|
|
903
|
-
export class
|
|
904
|
-
static readonly commandId = "
|
|
905
|
-
readonly commandId = "
|
|
906
|
-
readonly command: Omit<
|
|
907
|
-
declare readonly $res: () =>
|
|
908
|
-
|
|
909
|
-
constructor(args: Omit<_BroadcastMessage, "tx" | "createdAt">) {
|
|
910
|
-
this.command = args;
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
export class DeleteSessions {
|
|
915
|
-
static readonly commandId = "DeleteSessions" as const;
|
|
916
|
-
readonly commandId = "DeleteSessions" as const;
|
|
917
|
-
readonly command: Omit<_DeleteSessions, "tx" | "createdAt">;
|
|
918
|
-
declare readonly $res: () => DeleteSessionsResult;
|
|
919
|
-
|
|
920
|
-
constructor(args: Omit<_DeleteSessions, "tx" | "createdAt">) {
|
|
921
|
-
this.command = args;
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
export class DeleteSession {
|
|
926
|
-
static readonly commandId = "DeleteSession" as const;
|
|
927
|
-
readonly commandId = "DeleteSession" as const;
|
|
928
|
-
readonly command: Omit<_DeleteSession, "tx" | "createdAt">;
|
|
929
|
-
declare readonly $res: () => DeleteSessionResult;
|
|
930
|
-
|
|
931
|
-
constructor(args: Omit<_DeleteSession, "tx" | "createdAt">) {
|
|
932
|
-
this.command = args;
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
export class SetSessionLastActivityAt {
|
|
937
|
-
static readonly commandId = "SetSessionLastActivityAt" as const;
|
|
938
|
-
readonly commandId = "SetSessionLastActivityAt" as const;
|
|
939
|
-
readonly command: Omit<_SetSessionLastActivityAt, "tx" | "createdAt">;
|
|
940
|
-
declare readonly $res: () => void;
|
|
941
|
-
|
|
942
|
-
constructor(args: Omit<_SetSessionLastActivityAt, "tx" | "createdAt">) {
|
|
943
|
-
this.command = args;
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
export class SetSessionActivity {
|
|
948
|
-
static readonly commandId = "SetSessionActivity" as const;
|
|
949
|
-
readonly commandId = "SetSessionActivity" as const;
|
|
950
|
-
readonly command: Omit<_SetSessionActivity, "tx" | "createdAt">;
|
|
951
|
-
declare readonly $res: () => void;
|
|
952
|
-
|
|
953
|
-
constructor(args: Omit<_SetSessionActivity, "tx" | "createdAt">) {
|
|
954
|
-
this.command = args;
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
export class SetSessionSessionName {
|
|
959
|
-
static readonly commandId = "SetSessionSessionName" as const;
|
|
960
|
-
readonly commandId = "SetSessionSessionName" as const;
|
|
961
|
-
readonly command: Omit<_SetSessionSessionName, "tx" | "createdAt">;
|
|
962
|
-
declare readonly $res: () => void;
|
|
963
|
-
|
|
964
|
-
constructor(args: Omit<_SetSessionSessionName, "tx" | "createdAt">) {
|
|
965
|
-
this.command = args;
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
export class SetSessionLastToolAt {
|
|
970
|
-
static readonly commandId = "SetSessionLastToolAt" as const;
|
|
971
|
-
readonly commandId = "SetSessionLastToolAt" as const;
|
|
972
|
-
readonly command: Omit<_SetSessionLastToolAt, "tx" | "createdAt">;
|
|
973
|
-
declare readonly $res: () => void;
|
|
974
|
-
|
|
975
|
-
constructor(args: Omit<_SetSessionLastToolAt, "tx" | "createdAt">) {
|
|
976
|
-
this.command = args;
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
export class SetSessionLastTool {
|
|
981
|
-
static readonly commandId = "SetSessionLastTool" as const;
|
|
982
|
-
readonly commandId = "SetSessionLastTool" as const;
|
|
983
|
-
readonly command: Omit<_SetSessionLastTool, "tx" | "createdAt">;
|
|
984
|
-
declare readonly $res: () => void;
|
|
980
|
+
export class DeleteSessionNicknames {
|
|
981
|
+
static readonly commandId = "DeleteSessionNicknames" as const;
|
|
982
|
+
readonly commandId = "DeleteSessionNicknames" as const;
|
|
983
|
+
readonly command: Omit<_DeleteSessionNicknames, "tx" | "createdAt">;
|
|
984
|
+
declare readonly $res: () => DeleteSessionNicknamesResult;
|
|
985
985
|
|
|
986
|
-
constructor(args: Omit<
|
|
986
|
+
constructor(args: Omit<_DeleteSessionNicknames, "tx" | "createdAt">) {
|
|
987
987
|
this.command = args;
|
|
988
988
|
}
|
|
989
989
|
}
|
|
990
990
|
|
|
991
|
-
export class
|
|
992
|
-
static readonly commandId = "
|
|
993
|
-
readonly commandId = "
|
|
994
|
-
readonly command: Omit<
|
|
995
|
-
declare readonly $res: () =>
|
|
991
|
+
export class DeleteSessionNickname {
|
|
992
|
+
static readonly commandId = "DeleteSessionNickname" as const;
|
|
993
|
+
readonly commandId = "DeleteSessionNickname" as const;
|
|
994
|
+
readonly command: Omit<_DeleteSessionNickname, "tx" | "createdAt">;
|
|
995
|
+
declare readonly $res: () => DeleteSessionNicknameResult;
|
|
996
996
|
|
|
997
|
-
constructor(args: Omit<
|
|
997
|
+
constructor(args: Omit<_DeleteSessionNickname, "tx" | "createdAt">) {
|
|
998
998
|
this.command = args;
|
|
999
999
|
}
|
|
1000
1000
|
}
|
|
1001
1001
|
|
|
1002
|
-
export class
|
|
1003
|
-
static readonly commandId = "
|
|
1004
|
-
readonly commandId = "
|
|
1005
|
-
readonly command: Omit<
|
|
1006
|
-
declare readonly $res: () =>
|
|
1002
|
+
export class ReadMessages {
|
|
1003
|
+
static readonly commandId = "ReadMessages" as const;
|
|
1004
|
+
readonly commandId = "ReadMessages" as const;
|
|
1005
|
+
readonly command: Omit<_ReadMessages, "tx" | "createdAt">;
|
|
1006
|
+
declare readonly $res: () => ReadMessagesResult;
|
|
1007
1007
|
|
|
1008
|
-
constructor(args: Omit<
|
|
1008
|
+
constructor(args: Omit<_ReadMessages, "tx" | "createdAt">) {
|
|
1009
1009
|
this.command = args;
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
1012
1012
|
|
|
1013
|
-
export class
|
|
1014
|
-
static readonly commandId = "
|
|
1015
|
-
readonly commandId = "
|
|
1016
|
-
readonly command: Omit<
|
|
1017
|
-
declare readonly $res: () =>
|
|
1013
|
+
export class AckMessages {
|
|
1014
|
+
static readonly commandId = "AckMessages" as const;
|
|
1015
|
+
readonly commandId = "AckMessages" as const;
|
|
1016
|
+
readonly command: Omit<_AckMessages, "tx" | "createdAt">;
|
|
1017
|
+
declare readonly $res: () => AckMessagesResult;
|
|
1018
1018
|
|
|
1019
|
-
constructor(args: Omit<
|
|
1019
|
+
constructor(args: Omit<_AckMessages, "tx" | "createdAt">) {
|
|
1020
1020
|
this.command = args;
|
|
1021
1021
|
}
|
|
1022
1022
|
}
|
|
1023
1023
|
|
|
1024
1024
|
// Item constructors
|
|
1025
1025
|
export const items = {
|
|
1026
|
-
SessionNickname: (args: SessionNickname) => ({ item: args, itemType: "SessionNickname" }),
|
|
1027
|
-
RoomMember: (args: RoomMember) => ({ item: args, itemType: "RoomMember" }),
|
|
1028
1026
|
MessageRead: (args: MessageRead) => ({ item: args, itemType: "MessageRead" }),
|
|
1027
|
+
RoomMember: (args: RoomMember) => ({ item: args, itemType: "RoomMember" }),
|
|
1028
|
+
Session: (args: Session) => ({ item: args, itemType: "Session" }),
|
|
1029
1029
|
Message: (args: Message) => ({ item: args, itemType: "Message" }),
|
|
1030
1030
|
Room: (args: Room) => ({ item: args, itemType: "Room" }),
|
|
1031
|
-
|
|
1031
|
+
SessionNickname: (args: SessionNickname) => ({ item: args, itemType: "SessionNickname" }),
|
|
1032
1032
|
};
|
|
1033
1033
|
|
|
1034
1034
|
// Message events
|
package/src/index.ts
CHANGED
|
@@ -19,7 +19,10 @@
|
|
|
19
19
|
// MARSHAL_OPERATOR (optional) in the environment pi runs under.
|
|
20
20
|
|
|
21
21
|
import { createHash, randomUUID } from "node:crypto";
|
|
22
|
-
import type {
|
|
22
|
+
import type {
|
|
23
|
+
AgentToolResult,
|
|
24
|
+
ExtensionAPI,
|
|
25
|
+
} from "@earendil-works/pi-coding-agent";
|
|
23
26
|
import { Type } from "typebox";
|
|
24
27
|
|
|
25
28
|
import { MarshalDaemon } from "./daemon.ts";
|
|
@@ -27,6 +30,7 @@ import { resolveIdentity, type Identity } from "./identity.ts";
|
|
|
27
30
|
import type { NotifyChannelMeta, SessionItem } from "./entities.ts";
|
|
28
31
|
|
|
29
32
|
const DEFAULT_ADDRESS = "ws://localhost:6155";
|
|
33
|
+
type MarshalToolResult = AgentToolResult<Record<string, unknown>>;
|
|
30
34
|
|
|
31
35
|
// @myko/core emits an unconditional ws-timing diagnostic via console.info every
|
|
32
36
|
// 250ms on any WS traffic. Drop those lines so they don't flood the log.
|
|
@@ -332,7 +336,7 @@ async function init(pi: ExtensionAPI) {
|
|
|
332
336
|
description: "Show THIS pi session's marshal coordination identity — its nickname, host, operator, project, git branch, and session id (how peers see and address you).",
|
|
333
337
|
promptSnippet: "Show your marshal identity",
|
|
334
338
|
parameters: Type.Object({}),
|
|
335
|
-
async execute() {
|
|
339
|
+
async execute(): Promise<MarshalToolResult> {
|
|
336
340
|
if (!daemon || !sessionId) return { content: [{ type: "text", text: "marshal: not connected" }], details: {} };
|
|
337
341
|
const nick = daemon.nicknameFor(sessionId);
|
|
338
342
|
const host = identity.host.name;
|
|
@@ -361,7 +365,7 @@ async function init(pi: ExtensionAPI) {
|
|
|
361
365
|
description: "List every live agent session on the marshal roster — host, cwd, operator, branch, and session id (use the id to send_message).",
|
|
362
366
|
promptSnippet: "List live peer sessions on the marshal roster",
|
|
363
367
|
parameters: Type.Object({}),
|
|
364
|
-
async execute(): Promise<
|
|
368
|
+
async execute(): Promise<MarshalToolResult> {
|
|
365
369
|
if (!daemon || !sessionId) return { content: [{ type: "text", text: "marshal: not connected" }], details: {} };
|
|
366
370
|
daemon.registerSession(sessionId);
|
|
367
371
|
const sessions = await daemon.roster_snapshot();
|
|
@@ -387,7 +391,10 @@ async function init(pi: ExtensionAPI) {
|
|
|
387
391
|
to: Type.String({ description: "recipient session id or nickname" }),
|
|
388
392
|
body: Type.String({ description: "message text" }),
|
|
389
393
|
}),
|
|
390
|
-
async execute(
|
|
394
|
+
async execute(
|
|
395
|
+
_toolCallId: string,
|
|
396
|
+
params: { to: string; body: string },
|
|
397
|
+
): Promise<MarshalToolResult> {
|
|
391
398
|
if (!daemon || !sessionId) return { content: [{ type: "text", text: "marshal: not connected" }], details: {} };
|
|
392
399
|
daemon.registerSession(sessionId);
|
|
393
400
|
try {
|
|
@@ -399,11 +406,7 @@ async function init(pi: ExtensionAPI) {
|
|
|
399
406
|
details: { messageId: r.messageId, livePush, wake },
|
|
400
407
|
};
|
|
401
408
|
} catch (e: unknown) {
|
|
402
|
-
|
|
403
|
-
content: [{ type: "text", text: `marshal_send_message failed: ${String(e)}` }],
|
|
404
|
-
details: {},
|
|
405
|
-
isError: true,
|
|
406
|
-
};
|
|
409
|
+
throw new Error(`marshal_send_message failed: ${String(e)}`);
|
|
407
410
|
}
|
|
408
411
|
},
|
|
409
412
|
});
|
|
@@ -417,7 +420,10 @@ async function init(pi: ExtensionAPI) {
|
|
|
417
420
|
room: Type.String({ description: "room id/name (e.g. everyone, host:myhost, op:user@example.com, project:marshal)" }),
|
|
418
421
|
body: Type.String({ description: "message text" }),
|
|
419
422
|
}),
|
|
420
|
-
async execute(
|
|
423
|
+
async execute(
|
|
424
|
+
_toolCallId: string,
|
|
425
|
+
params: { room: string; body: string },
|
|
426
|
+
): Promise<MarshalToolResult> {
|
|
421
427
|
if (!daemon || !sessionId) return { content: [{ type: "text", text: "marshal: not connected" }], details: {} };
|
|
422
428
|
daemon.registerSession(sessionId);
|
|
423
429
|
try {
|
|
@@ -427,11 +433,7 @@ async function init(pi: ExtensionAPI) {
|
|
|
427
433
|
details: { toRoom: r.toRoomName, delivered: r.delivered.length, total: r.total },
|
|
428
434
|
};
|
|
429
435
|
} catch (e: unknown) {
|
|
430
|
-
|
|
431
|
-
content: [{ type: "text", text: `marshal_broadcast failed: ${String(e)}` }],
|
|
432
|
-
details: {},
|
|
433
|
-
isError: true,
|
|
434
|
-
};
|
|
436
|
+
throw new Error(`marshal_broadcast failed: ${String(e)}`);
|
|
435
437
|
}
|
|
436
438
|
},
|
|
437
439
|
});
|
|
@@ -445,7 +447,10 @@ async function init(pi: ExtensionAPI) {
|
|
|
445
447
|
name: Type.String({ description: "room name" }),
|
|
446
448
|
description: Type.Optional(Type.String({ description: "optional room description" })),
|
|
447
449
|
}),
|
|
448
|
-
async execute(
|
|
450
|
+
async execute(
|
|
451
|
+
_toolCallId: string,
|
|
452
|
+
params: { name: string; description?: string },
|
|
453
|
+
): Promise<MarshalToolResult> {
|
|
449
454
|
if (!daemon || !sessionId) return { content: [{ type: "text", text: "marshal: not connected" }], details: {} };
|
|
450
455
|
daemon.registerSession(sessionId);
|
|
451
456
|
try {
|
|
@@ -455,11 +460,7 @@ async function init(pi: ExtensionAPI) {
|
|
|
455
460
|
details: { room: r.name, joined: r.joined, created: r.created },
|
|
456
461
|
};
|
|
457
462
|
} catch (e: unknown) {
|
|
458
|
-
|
|
459
|
-
content: [{ type: "text", text: `marshal_join_room failed: ${String(e)}` }],
|
|
460
|
-
details: {},
|
|
461
|
-
isError: true,
|
|
462
|
-
};
|
|
463
|
+
throw new Error(`marshal_join_room failed: ${String(e)}`);
|
|
463
464
|
}
|
|
464
465
|
},
|
|
465
466
|
});
|
|
@@ -472,7 +473,10 @@ async function init(pi: ExtensionAPI) {
|
|
|
472
473
|
parameters: Type.Object({
|
|
473
474
|
room: Type.String({ description: "room id/name" }),
|
|
474
475
|
}),
|
|
475
|
-
async execute(
|
|
476
|
+
async execute(
|
|
477
|
+
_toolCallId: string,
|
|
478
|
+
params: { room: string },
|
|
479
|
+
): Promise<MarshalToolResult> {
|
|
476
480
|
if (!daemon || !sessionId) return { content: [{ type: "text", text: "marshal: not connected" }], details: {} };
|
|
477
481
|
daemon.registerSession(sessionId);
|
|
478
482
|
try {
|
|
@@ -482,11 +486,7 @@ async function init(pi: ExtensionAPI) {
|
|
|
482
486
|
details: { room: r.roomId, left: r.left },
|
|
483
487
|
};
|
|
484
488
|
} catch (e: unknown) {
|
|
485
|
-
|
|
486
|
-
content: [{ type: "text", text: `marshal_leave_room failed: ${String(e)}` }],
|
|
487
|
-
details: {},
|
|
488
|
-
isError: true,
|
|
489
|
-
};
|
|
489
|
+
throw new Error(`marshal_leave_room failed: ${String(e)}`);
|
|
490
490
|
}
|
|
491
491
|
},
|
|
492
492
|
});
|
|
@@ -499,18 +499,17 @@ async function init(pi: ExtensionAPI) {
|
|
|
499
499
|
parameters: Type.Object({
|
|
500
500
|
text: Type.String({ description: "status text shown on the roster" }),
|
|
501
501
|
}),
|
|
502
|
-
async execute(
|
|
502
|
+
async execute(
|
|
503
|
+
_toolCallId: string,
|
|
504
|
+
params: { text: string },
|
|
505
|
+
): Promise<MarshalToolResult> {
|
|
503
506
|
if (!daemon || !sessionId) return { content: [{ type: "text", text: "marshal: not connected" }], details: {} };
|
|
504
507
|
daemon.registerSession(sessionId);
|
|
505
508
|
try {
|
|
506
509
|
await daemon.setStatus(sessionId, params.text);
|
|
507
510
|
return { content: [{ type: "text", text: `status set: ${params.text}` }], details: {} };
|
|
508
511
|
} catch (e: unknown) {
|
|
509
|
-
|
|
510
|
-
content: [{ type: "text", text: `marshal_set_status failed: ${String(e)}` }],
|
|
511
|
-
details: {},
|
|
512
|
-
isError: true,
|
|
513
|
-
};
|
|
512
|
+
throw new Error(`marshal_set_status failed: ${String(e)}`);
|
|
514
513
|
}
|
|
515
514
|
},
|
|
516
515
|
});
|
|
@@ -522,10 +521,19 @@ async function init(pi: ExtensionAPI) {
|
|
|
522
521
|
promptSnippet: "Read marshal message history",
|
|
523
522
|
parameters: Type.Object({
|
|
524
523
|
room: Type.Optional(Type.String({ description: "room id to read (e.g. project:marshal, everyone); omit for your inbox" })),
|
|
525
|
-
since: Type.Optional(Type.
|
|
526
|
-
|
|
524
|
+
since: Type.Optional(Type.Integer({
|
|
525
|
+
description: "only messages after this unix-millis timestamp",
|
|
526
|
+
minimum: 0,
|
|
527
|
+
})),
|
|
528
|
+
limit: Type.Optional(Type.Integer({
|
|
529
|
+
description: "max messages (default 50)",
|
|
530
|
+
minimum: 1,
|
|
531
|
+
})),
|
|
527
532
|
}),
|
|
528
|
-
async execute(
|
|
533
|
+
async execute(
|
|
534
|
+
_toolCallId: string,
|
|
535
|
+
params: { room?: string; since?: number; limit?: number },
|
|
536
|
+
): Promise<MarshalToolResult> {
|
|
529
537
|
if (!daemon || !sessionId) return { content: [{ type: "text", text: "marshal: not connected" }], details: {} };
|
|
530
538
|
daemon.registerSession(sessionId);
|
|
531
539
|
try {
|
|
@@ -538,11 +546,7 @@ async function init(pi: ExtensionAPI) {
|
|
|
538
546
|
const lines = msgs.map((m) => daemon!.formatMessageLine(m));
|
|
539
547
|
return { content: [{ type: "text", text: lines.join("\n") }], details: { count: msgs.length } };
|
|
540
548
|
} catch (e: unknown) {
|
|
541
|
-
|
|
542
|
-
content: [{ type: "text", text: `marshal_messages failed: ${String(e)}` }],
|
|
543
|
-
details: {},
|
|
544
|
-
isError: true,
|
|
545
|
-
};
|
|
549
|
+
throw new Error(`marshal_messages failed: ${String(e)}`);
|
|
546
550
|
}
|
|
547
551
|
},
|
|
548
552
|
});
|
|
@@ -555,18 +559,17 @@ async function init(pi: ExtensionAPI) {
|
|
|
555
559
|
parameters: Type.Object({
|
|
556
560
|
message_ids: Type.Array(Type.String(), { description: "message ids to mark read" }),
|
|
557
561
|
}),
|
|
558
|
-
async execute(
|
|
562
|
+
async execute(
|
|
563
|
+
_toolCallId: string,
|
|
564
|
+
params: { message_ids: string[] },
|
|
565
|
+
): Promise<MarshalToolResult> {
|
|
559
566
|
if (!daemon || !sessionId) return { content: [{ type: "text", text: "marshal: not connected" }], details: {} };
|
|
560
567
|
daemon.registerSession(sessionId);
|
|
561
568
|
try {
|
|
562
569
|
const n = await daemon.ackMessages(sessionId, params.message_ids);
|
|
563
570
|
return { content: [{ type: "text", text: `acked ${n} message(s)` }], details: { acked: n } };
|
|
564
571
|
} catch (e: unknown) {
|
|
565
|
-
|
|
566
|
-
content: [{ type: "text", text: `marshal_ack failed: ${String(e)}` }],
|
|
567
|
-
details: {},
|
|
568
|
-
isError: true,
|
|
569
|
-
};
|
|
572
|
+
throw new Error(`marshal_ack failed: ${String(e)}`);
|
|
570
573
|
}
|
|
571
574
|
},
|
|
572
575
|
});
|
|
@@ -590,4 +593,4 @@ async function init(pi: ExtensionAPI) {
|
|
|
590
593
|
ctx.ui.notify(lines.join("\n"), "info");
|
|
591
594
|
},
|
|
592
595
|
});
|
|
593
|
-
}
|
|
596
|
+
}
|