Skip to content

feat(pilotctl): add --encoding flag to send-message#8

Open
voidborne-d wants to merge 2 commits intoTeoSlayer:mainfrom
voidborne-d:feat/encoding-flag
Open

feat(pilotctl): add --encoding flag to send-message#8
voidborne-d wants to merge 2 commits intoTeoSlayer:mainfrom
voidborne-d:feat/encoding-flag

Conversation

@voidborne-d
Copy link

Summary

Adds a --encoding flag to pilotctl send-message that wraps the payload in a JSON envelope before sending. No wire protocol changes — the data is sent as a standard TypeJSON frame.

Usage

pilotctl send-message target --data "?Uk/co" --encoding lambda
# Sends TypeJSON: {"encoding":"lambda","data":"?Uk/co"}

The receiver can inspect the encoding field to decode the payload with the appropriate decoder (e.g. lambda-go).

Design

As discussed in #5, this is purely client-side convenience:

  • No new frame types
  • No new dependencies
  • No wire protocol changes
  • The --encoding flag wraps --data in {"encoding":"<name>","data":"..."} and forces --type json
  • Output includes encoding field when set

This pairs with pilotctl set-tags lambda-lang for tag-based discovery of Lambda-capable agents.

Changes

  • cmd/pilotctl/main.go: Add --encoding flag to cmdSendMessage, update usage string and context command

Testing

  • go build ./cmd/pilotctl/ ✅ compiles cleanly
  • Flag is optional — existing behavior unchanged when --encoding is not set

Ref: #5


Standalone encoder library: github.com/voidborne-d/lambda-go

Add client-side --encoding flag that wraps the payload in a JSON
envelope before sending. No wire protocol changes — the data is
sent as a standard TypeJSON frame.

Usage:
  pilotctl send-message target --data '?Uk/co' --encoding lambda
  # Sends TypeJSON: {"encoding":"lambda","data":"?Uk/co"}

This enables agents to exchange messages in custom encodings
(e.g. Lambda Lang for 3x compression) while keeping the protocol
encoding-agnostic and dependency-free.

Ref: TeoSlayer#5
@TeoSlayer TeoSlayer self-requested a review March 11, 2026 13:03
@TeoSlayer TeoSlayer self-assigned this Mar 13, 2026
@TeoSlayer TeoSlayer added the enhancement New feature or request label Mar 13, 2026
TeoSlayer
TeoSlayer previously approved these changes Mar 13, 2026
Copy link
Owner

@TeoSlayer TeoSlayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Use int64 arithmetic for size computation before allocating the
file frame payload buffer. This prevents a potential integer overflow
when len(name) + len(Payload) exceeds math.MaxInt on 32-bit platforms.

Fixes CodeQL high-severity alert: 'Size computation for allocation may overflow'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants