@cydm/pie 4.3.2 → 4.3.4

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.
@@ -2,6 +2,7 @@ import { createRequire as __createRequire } from "node:module"; const require =
2
2
  import {
3
3
  BoundedIdSet,
4
4
  DEFAULT_SEND_WAIT_MS,
5
+ DISPATCH_PREFIX,
5
6
  FrameDecoder,
6
7
  HEARTBEAT_INTERVAL_MS,
7
8
  IPC_PROTOCOL_VERSION,
@@ -20,9 +21,10 @@ import {
20
21
  peerHealth,
21
22
  peerLabel,
22
23
  resolveIpcConfig,
24
+ takeDispatchFrame,
23
25
  wrapInboundText,
24
26
  wrappedMessageMarker
25
- } from "../../../chunks/chunk-GJLSYBFN.js";
27
+ } from "../../../chunks/chunk-HT6J4QOC.js";
26
28
  import {
27
29
  Type
28
30
  } from "../../../chunks/chunk-XXGYUYXI.js";
@@ -521,7 +523,8 @@ function buildStatusFile(input) {
521
523
  updatedAt: Date.now(),
522
524
  state: "idle",
523
525
  undeliveredInjections: 0,
524
- port: input.port
526
+ port: input.port,
527
+ ...input.unattended === true ? { unattended: true } : {}
525
528
  };
526
529
  }
527
530
 
@@ -869,6 +872,16 @@ var InboundDelivery = class {
869
872
  text: clipBody(envelope.text),
870
873
  receivedAt: Date.now()
871
874
  };
875
+ if (this.options.onProtocolFrame && this.options.protocolFramePrefix && message.text.trimStart().startsWith(this.options.protocolFramePrefix)) {
876
+ try {
877
+ if (this.options.onProtocolFrame(message.text)) {
878
+ this.counters.injected += 1;
879
+ return "injected";
880
+ }
881
+ } catch (error) {
882
+ this.host.log(`pie-ipc: protocol frame handler failed: ${error instanceof Error ? error.message : String(error)}`);
883
+ }
884
+ }
872
885
  try {
873
886
  this.host.appendEntry("pie.ipc.message", {
874
887
  id: message.id,
@@ -1329,7 +1342,8 @@ var Runtime = class {
1329
1342
  sessionId: this.sessionId,
1330
1343
  sessionName: this.sessionName,
1331
1344
  cwd: this.ctx.cwd,
1332
- port
1345
+ port,
1346
+ unattended: this.ctx.capabilities?.unattended === true
1333
1347
  });
1334
1348
  this.statusBase.secret = this.transport.secret;
1335
1349
  this.serverReady = true;
@@ -2030,7 +2044,16 @@ function pieIpcExtension(ctx) {
2030
2044
  getMessages: () => ctx.getMessages(),
2031
2045
  log: (message) => ctx.log(message)
2032
2046
  },
2033
- { autoInject: config.autoInject ?? true, allowPolicy: runtime.allowPolicy, onConsumed: (id) => runtime.markConsumed(id) }
2047
+ {
2048
+ autoInject: config.autoInject ?? true,
2049
+ allowPolicy: runtime.allowPolicy,
2050
+ onConsumed: (id) => runtime.markConsumed(id),
2051
+ // Dirty-dispatch fix (11-12): protocol frames (im-forward event-hub
2052
+ // dispatches to this session's owner) are claimed BEFORE the ordinary
2053
+ // wrap/inject — they never enter the model context as peer chatter.
2054
+ protocolFramePrefix: DISPATCH_PREFIX,
2055
+ onProtocolFrame: takeDispatchFrame
2056
+ }
2034
2057
  );
2035
2058
  void runtime.startServer().then(() => {
2036
2059
  ctx.log(`pie-ipc: listening + advertised as ${runtime.instanceId}`);