@sjawhar/pi-legion-envoy 0.8.4 → 0.8.5

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 (2) hide show
  1. package/dist/envoy.js +29 -0
  2. package/package.json +3 -2
package/dist/envoy.js CHANGED
@@ -31329,6 +31329,34 @@ function toolFailure(error) {
31329
31329
  return { content: [{ type: "text", text: messageFor(error) }], details: {}, isError: true };
31330
31330
  }
31331
31331
 
31332
+ // extensions/envoy-message-renderer.ts
31333
+ import { Box, Spacer, Text } from "@oh-my-pi/pi-tui";
31334
+ var ENVOY_MESSAGE_COLLAPSED_LINES = 12;
31335
+ function renderEnvoyMessage(message, options, theme) {
31336
+ const box = new Box(1, 1, undefined, {
31337
+ chars: theme.boxRound,
31338
+ color: (text) => theme.fg("borderMuted", text)
31339
+ });
31340
+ box.setIgnoreTight(true);
31341
+ box.addChild(new Text(theme.fg("customMessageLabel", theme.bold(message.customType)), 0, 0));
31342
+ box.addChild(new Spacer(1));
31343
+ let text = message.content;
31344
+ if (!options.expanded) {
31345
+ const lines = text.split(`
31346
+ `);
31347
+ if (lines.length > ENVOY_MESSAGE_COLLAPSED_LINES) {
31348
+ text = `${lines.slice(0, ENVOY_MESSAGE_COLLAPSED_LINES).join(`
31349
+ `)}
31350
+ \u2026`;
31351
+ }
31352
+ }
31353
+ box.addChild(new Text(theme.fg("customMessageText", text), 0, 0));
31354
+ return box;
31355
+ }
31356
+ function registerEnvoyMessageRenderer(pi) {
31357
+ pi.registerMessageRenderer("envoy-message", renderEnvoyMessage);
31358
+ }
31359
+
31332
31360
  // extensions/envoy-whoami-command.ts
31333
31361
  import { copyToClipboard } from "@oh-my-pi/pi-coding-agent";
31334
31362
  function registerEnvoyWhoamiCommand(api, cachedSessionID) {
@@ -31410,6 +31438,7 @@ function envoyExtension(pi) {
31410
31438
  let activeSessionContext;
31411
31439
  const inbox = [];
31412
31440
  pi.on("resources_discover", async () => ({ skillPaths: [SKILLS_DIRECTORY] }));
31441
+ registerEnvoyMessageRenderer(pi);
31413
31442
  const ensureConnection = async () => {
31414
31443
  if (connection?.isClosed() === false)
31415
31444
  return connection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion-envoy",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "type": "module",
5
5
  "omp": {
6
6
  "extensions": [
@@ -15,7 +15,7 @@
15
15
  "dist"
16
16
  ],
17
17
  "scripts": {
18
- "build": "bun build extensions/envoy.ts extensions/legion.ts --outdir dist --target bun --format esm --external @oh-my-pi/pi-coding-agent",
18
+ "build": "bun build extensions/envoy.ts extensions/legion.ts --outdir dist --target bun --format esm --external @oh-my-pi/pi-coding-agent --external @oh-my-pi/pi-tui",
19
19
  "prepack": "./scripts/prepack.sh",
20
20
  "postpack": "rm -rf dist/skills",
21
21
  "typecheck": "bunx tsc --noEmit",
@@ -27,6 +27,7 @@
27
27
  "@legion/contracts": "0.10.0",
28
28
  "@legion/envoy-client": "0.1.0",
29
29
  "@legion/workspace": "0.1.0",
30
+ "@oh-my-pi/pi-tui": "^18.1.15",
30
31
  "@toon-format/toon": "^4.1.1",
31
32
  "@types/bun": "latest",
32
33
  "nats": "^2.29.2",