@karlorz/codexhost-cli-win32-x64 0.13.3-3 → 0.13.3-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.
@@ -15262,6 +15262,36 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
15262
15262
  var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
15263
15263
  var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
15264
15264
 
15265
+ // ../../shared-contracts/dist/realtime-call.js
15266
+ var REALTIME_CALL_FORWARDED_HEADERS = [
15267
+ "openai-alpha",
15268
+ "thread-id",
15269
+ "session-id",
15270
+ "originator",
15271
+ "x-codex-turn-metadata"
15272
+ ];
15273
+ var FORWARDED_HEADERS = new Set(REALTIME_CALL_FORWARDED_HEADERS);
15274
+ var REALTIME_CALL_ID_PATTERN = /^rtc_[A-Za-z0-9_-]{1,128}$/u;
15275
+ var requestId = external_exports.string().min(1).max(128);
15276
+ var realtimeCallParamsSchema = external_exports.discriminatedUnion("operation", [
15277
+ external_exports.object({
15278
+ operation: external_exports.literal("create"),
15279
+ requestId,
15280
+ body: external_exports.string().min(1).max(16 << 20),
15281
+ headers: external_exports.record(external_exports.string(), external_exports.string()).default({})
15282
+ }),
15283
+ external_exports.object({ operation: external_exports.literal("cancel"), requestId }),
15284
+ external_exports.object({
15285
+ operation: external_exports.literal("hangup"),
15286
+ callId: external_exports.string().regex(REALTIME_CALL_ID_PATTERN)
15287
+ })
15288
+ ]);
15289
+ var realtimeCallResponseSchema = external_exports.object({
15290
+ status: external_exports.number().int().min(200).max(599),
15291
+ body: external_exports.string(),
15292
+ headers: external_exports.record(external_exports.string(), external_exports.string())
15293
+ });
15294
+
15265
15295
  // ../../shared-contracts/dist/console.js
15266
15296
  var consoleAnnouncementSchema = external_exports.strictObject({
15267
15297
  title: external_exports.string().trim().min(1).max(200),
@@ -18578,8 +18608,8 @@ var ConnectionContext = class {
18578
18608
  /**
18579
18609
  * Sends a protocol-level request cancellation notification.
18580
18610
  */
18581
- sendCancelRequest(requestId) {
18582
- return this.connection.sendCancelRequest(requestId);
18611
+ sendCancelRequest(requestId2) {
18612
+ return this.connection.sendCancelRequest(requestId2);
18583
18613
  }
18584
18614
  /**
18585
18615
  * Registers a handler that can be disposed independently.
@@ -18764,8 +18794,8 @@ var Connection = class {
18764
18794
  /**
18765
18795
  * Sends a protocol-level request cancellation notification.
18766
18796
  */
18767
- sendCancelRequest(requestId) {
18768
- return this.sendNotification(CANCEL_REQUEST_METHOD, { requestId });
18797
+ sendCancelRequest(requestId2) {
18798
+ return this.sendNotification(CANCEL_REQUEST_METHOD, { requestId: requestId2 });
18769
18799
  }
18770
18800
  /**
18771
18801
  * Sends a JSON-RPC notification.
@@ -19073,15 +19103,15 @@ var Connection = class {
19073
19103
  if (message.method !== CANCEL_REQUEST_METHOD) {
19074
19104
  return;
19075
19105
  }
19076
- const requestId = cancelRequestId(message.params);
19077
- if (requestId === void 0) {
19106
+ const requestId2 = cancelRequestId(message.params);
19107
+ if (requestId2 === void 0) {
19078
19108
  return;
19079
19109
  }
19080
- const controller = this.incomingRequests.get(requestId);
19110
+ const controller = this.incomingRequests.get(requestId2);
19081
19111
  if (!controller || controller.signal.aborted) {
19082
19112
  return;
19083
19113
  }
19084
- controller.abort(RequestError.requestCancelled({ requestId }));
19114
+ controller.abort(RequestError.requestCancelled({ requestId: requestId2 }));
19085
19115
  }
19086
19116
  closedReason() {
19087
19117
  return this.abortController.signal.reason ?? new Error("ACP connection closed");
@@ -19547,12 +19577,12 @@ var AcpContext = class {
19547
19577
  }
19548
19578
  };
19549
19579
  var AgentContext = class _AgentContext extends AcpContext {
19550
- constructor(cx, requestId) {
19551
- super(cx, requestId);
19580
+ constructor(cx, requestId2) {
19581
+ super(cx, requestId2);
19552
19582
  }
19553
19583
  /** @internal */
19554
- static create(cx, requestId) {
19555
- return new _AgentContext(cx, requestId);
19584
+ static create(cx, requestId2) {
19585
+ return new _AgentContext(cx, requestId2);
19556
19586
  }
19557
19587
  request(method, params, options) {
19558
19588
  const spec = clientRequestSpecsByMethod[method];
@@ -19563,12 +19593,12 @@ var AgentContext = class _AgentContext extends AcpContext {
19563
19593
  }
19564
19594
  };
19565
19595
  var ClientContext = class _ClientContext extends AcpContext {
19566
- constructor(cx, requestId) {
19567
- super(cx, requestId);
19596
+ constructor(cx, requestId2) {
19597
+ super(cx, requestId2);
19568
19598
  }
19569
19599
  /** @internal */
19570
- static create(cx, requestId) {
19571
- return new _ClientContext(cx, requestId);
19600
+ static create(cx, requestId2) {
19601
+ return new _ClientContext(cx, requestId2);
19572
19602
  }
19573
19603
  /** @internal */
19574
19604
  [startActiveSession](params, options) {
@@ -20001,10 +20031,10 @@ var agentRequestSpecsByMethod = specsByMethod(agentRequestSpecs);
20001
20031
  var agentNotificationSpecsByMethod = specsByMethod(agentNotificationSpecs);
20002
20032
  var clientRequestSpecsByMethod = specsByMethod(clientRequestSpecs);
20003
20033
  var clientNotificationSpecsByMethod = specsByMethod(clientNotificationSpecs);
20004
- function agentRequestContext(params, client2, signal, requestId) {
20034
+ function agentRequestContext(params, client2, signal, requestId2) {
20005
20035
  return {
20006
20036
  params,
20007
- requestId,
20037
+ requestId: requestId2,
20008
20038
  signal,
20009
20039
  client: client2
20010
20040
  };
@@ -20016,10 +20046,10 @@ function agentNotificationContext(params, client2, signal) {
20016
20046
  client: client2
20017
20047
  };
20018
20048
  }
20019
- function clientRequestContext(params, agent, signal, requestId) {
20049
+ function clientRequestContext(params, agent, signal, requestId2) {
20020
20050
  return {
20021
20051
  params,
20022
- requestId,
20052
+ requestId: requestId2,
20023
20053
  signal,
20024
20054
  agent
20025
20055
  };
@@ -20144,7 +20174,7 @@ var AgentApp = class {
20144
20174
  return this.notification(spec, handlerOrParams);
20145
20175
  }
20146
20176
  request(spec, handler) {
20147
- registerAppRequest(this.builder, spec, (params, cx, signal, requestId) => agentRequestContext(params, AgentContext.create(cx, requestId), signal, requestId), handler);
20177
+ registerAppRequest(this.builder, spec, (params, cx, signal, requestId2) => agentRequestContext(params, AgentContext.create(cx, requestId2), signal, requestId2), handler);
20148
20178
  return this;
20149
20179
  }
20150
20180
  notification(spec, handler) {
@@ -20244,7 +20274,7 @@ var ClientApp = class {
20244
20274
  return this.notification(spec, handlerOrParams);
20245
20275
  }
20246
20276
  request(spec, handler) {
20247
- registerAppRequest(this.builder, spec, (params, cx, signal, requestId) => clientRequestContext(params, ClientContext.create(cx, requestId), signal, requestId), handler);
20277
+ registerAppRequest(this.builder, spec, (params, cx, signal, requestId2) => clientRequestContext(params, ClientContext.create(cx, requestId2), signal, requestId2), handler);
20248
20278
  return this;
20249
20279
  }
20250
20280
  notification(spec, handler) {
@@ -15121,6 +15121,36 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
15121
15121
  var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
15122
15122
  var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
15123
15123
 
15124
+ // ../../shared-contracts/dist/realtime-call.js
15125
+ var REALTIME_CALL_FORWARDED_HEADERS = [
15126
+ "openai-alpha",
15127
+ "thread-id",
15128
+ "session-id",
15129
+ "originator",
15130
+ "x-codex-turn-metadata"
15131
+ ];
15132
+ var FORWARDED_HEADERS = new Set(REALTIME_CALL_FORWARDED_HEADERS);
15133
+ var REALTIME_CALL_ID_PATTERN = /^rtc_[A-Za-z0-9_-]{1,128}$/u;
15134
+ var requestId = external_exports.string().min(1).max(128);
15135
+ var realtimeCallParamsSchema = external_exports.discriminatedUnion("operation", [
15136
+ external_exports.object({
15137
+ operation: external_exports.literal("create"),
15138
+ requestId,
15139
+ body: external_exports.string().min(1).max(16 << 20),
15140
+ headers: external_exports.record(external_exports.string(), external_exports.string()).default({})
15141
+ }),
15142
+ external_exports.object({ operation: external_exports.literal("cancel"), requestId }),
15143
+ external_exports.object({
15144
+ operation: external_exports.literal("hangup"),
15145
+ callId: external_exports.string().regex(REALTIME_CALL_ID_PATTERN)
15146
+ })
15147
+ ]);
15148
+ var realtimeCallResponseSchema = external_exports.object({
15149
+ status: external_exports.number().int().min(200).max(599),
15150
+ body: external_exports.string(),
15151
+ headers: external_exports.record(external_exports.string(), external_exports.string())
15152
+ });
15153
+
15124
15154
  // ../../shared-contracts/dist/console.js
15125
15155
  var consoleAnnouncementSchema = external_exports.strictObject({
15126
15156
  title: external_exports.string().trim().min(1).max(200),
@@ -18559,8 +18589,8 @@ var ConnectionContext = class {
18559
18589
  /**
18560
18590
  * Sends a protocol-level request cancellation notification.
18561
18591
  */
18562
- sendCancelRequest(requestId) {
18563
- return this.connection.sendCancelRequest(requestId);
18592
+ sendCancelRequest(requestId2) {
18593
+ return this.connection.sendCancelRequest(requestId2);
18564
18594
  }
18565
18595
  /**
18566
18596
  * Registers a handler that can be disposed independently.
@@ -18745,8 +18775,8 @@ var Connection = class {
18745
18775
  /**
18746
18776
  * Sends a protocol-level request cancellation notification.
18747
18777
  */
18748
- sendCancelRequest(requestId) {
18749
- return this.sendNotification(CANCEL_REQUEST_METHOD, { requestId });
18778
+ sendCancelRequest(requestId2) {
18779
+ return this.sendNotification(CANCEL_REQUEST_METHOD, { requestId: requestId2 });
18750
18780
  }
18751
18781
  /**
18752
18782
  * Sends a JSON-RPC notification.
@@ -19054,15 +19084,15 @@ var Connection = class {
19054
19084
  if (message.method !== CANCEL_REQUEST_METHOD) {
19055
19085
  return;
19056
19086
  }
19057
- const requestId = cancelRequestId(message.params);
19058
- if (requestId === void 0) {
19087
+ const requestId2 = cancelRequestId(message.params);
19088
+ if (requestId2 === void 0) {
19059
19089
  return;
19060
19090
  }
19061
- const controller = this.incomingRequests.get(requestId);
19091
+ const controller = this.incomingRequests.get(requestId2);
19062
19092
  if (!controller || controller.signal.aborted) {
19063
19093
  return;
19064
19094
  }
19065
- controller.abort(RequestError.requestCancelled({ requestId }));
19095
+ controller.abort(RequestError.requestCancelled({ requestId: requestId2 }));
19066
19096
  }
19067
19097
  closedReason() {
19068
19098
  return this.abortController.signal.reason ?? new Error("ACP connection closed");
@@ -19528,12 +19558,12 @@ var AcpContext = class {
19528
19558
  }
19529
19559
  };
19530
19560
  var AgentContext = class _AgentContext extends AcpContext {
19531
- constructor(cx, requestId) {
19532
- super(cx, requestId);
19561
+ constructor(cx, requestId2) {
19562
+ super(cx, requestId2);
19533
19563
  }
19534
19564
  /** @internal */
19535
- static create(cx, requestId) {
19536
- return new _AgentContext(cx, requestId);
19565
+ static create(cx, requestId2) {
19566
+ return new _AgentContext(cx, requestId2);
19537
19567
  }
19538
19568
  request(method, params, options) {
19539
19569
  const spec = clientRequestSpecsByMethod[method];
@@ -19544,12 +19574,12 @@ var AgentContext = class _AgentContext extends AcpContext {
19544
19574
  }
19545
19575
  };
19546
19576
  var ClientContext = class _ClientContext extends AcpContext {
19547
- constructor(cx, requestId) {
19548
- super(cx, requestId);
19577
+ constructor(cx, requestId2) {
19578
+ super(cx, requestId2);
19549
19579
  }
19550
19580
  /** @internal */
19551
- static create(cx, requestId) {
19552
- return new _ClientContext(cx, requestId);
19581
+ static create(cx, requestId2) {
19582
+ return new _ClientContext(cx, requestId2);
19553
19583
  }
19554
19584
  /** @internal */
19555
19585
  [startActiveSession](params, options) {
@@ -19982,10 +20012,10 @@ var agentRequestSpecsByMethod = specsByMethod(agentRequestSpecs);
19982
20012
  var agentNotificationSpecsByMethod = specsByMethod(agentNotificationSpecs);
19983
20013
  var clientRequestSpecsByMethod = specsByMethod(clientRequestSpecs);
19984
20014
  var clientNotificationSpecsByMethod = specsByMethod(clientNotificationSpecs);
19985
- function agentRequestContext(params, client2, signal, requestId) {
20015
+ function agentRequestContext(params, client2, signal, requestId2) {
19986
20016
  return {
19987
20017
  params,
19988
- requestId,
20018
+ requestId: requestId2,
19989
20019
  signal,
19990
20020
  client: client2
19991
20021
  };
@@ -19997,10 +20027,10 @@ function agentNotificationContext(params, client2, signal) {
19997
20027
  client: client2
19998
20028
  };
19999
20029
  }
20000
- function clientRequestContext(params, agent, signal, requestId) {
20030
+ function clientRequestContext(params, agent, signal, requestId2) {
20001
20031
  return {
20002
20032
  params,
20003
- requestId,
20033
+ requestId: requestId2,
20004
20034
  signal,
20005
20035
  agent
20006
20036
  };
@@ -20125,7 +20155,7 @@ var AgentApp = class {
20125
20155
  return this.notification(spec, handlerOrParams);
20126
20156
  }
20127
20157
  request(spec, handler) {
20128
- registerAppRequest(this.builder, spec, (params, cx, signal, requestId) => agentRequestContext(params, AgentContext.create(cx, requestId), signal, requestId), handler);
20158
+ registerAppRequest(this.builder, spec, (params, cx, signal, requestId2) => agentRequestContext(params, AgentContext.create(cx, requestId2), signal, requestId2), handler);
20129
20159
  return this;
20130
20160
  }
20131
20161
  notification(spec, handler) {
@@ -20225,7 +20255,7 @@ var ClientApp = class {
20225
20255
  return this.notification(spec, handlerOrParams);
20226
20256
  }
20227
20257
  request(spec, handler) {
20228
- registerAppRequest(this.builder, spec, (params, cx, signal, requestId) => clientRequestContext(params, ClientContext.create(cx, requestId), signal, requestId), handler);
20258
+ registerAppRequest(this.builder, spec, (params, cx, signal, requestId2) => clientRequestContext(params, ClientContext.create(cx, requestId2), signal, requestId2), handler);
20229
20259
  return this;
20230
20260
  }
20231
20261
  notification(spec, handler) {
@@ -15321,6 +15321,36 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
15321
15321
  var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
15322
15322
  var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
15323
15323
 
15324
+ // ../../shared-contracts/dist/realtime-call.js
15325
+ var REALTIME_CALL_FORWARDED_HEADERS = [
15326
+ "openai-alpha",
15327
+ "thread-id",
15328
+ "session-id",
15329
+ "originator",
15330
+ "x-codex-turn-metadata"
15331
+ ];
15332
+ var FORWARDED_HEADERS = new Set(REALTIME_CALL_FORWARDED_HEADERS);
15333
+ var REALTIME_CALL_ID_PATTERN = /^rtc_[A-Za-z0-9_-]{1,128}$/u;
15334
+ var requestId = external_exports.string().min(1).max(128);
15335
+ var realtimeCallParamsSchema = external_exports.discriminatedUnion("operation", [
15336
+ external_exports.object({
15337
+ operation: external_exports.literal("create"),
15338
+ requestId,
15339
+ body: external_exports.string().min(1).max(16 << 20),
15340
+ headers: external_exports.record(external_exports.string(), external_exports.string()).default({})
15341
+ }),
15342
+ external_exports.object({ operation: external_exports.literal("cancel"), requestId }),
15343
+ external_exports.object({
15344
+ operation: external_exports.literal("hangup"),
15345
+ callId: external_exports.string().regex(REALTIME_CALL_ID_PATTERN)
15346
+ })
15347
+ ]);
15348
+ var realtimeCallResponseSchema = external_exports.object({
15349
+ status: external_exports.number().int().min(200).max(599),
15350
+ body: external_exports.string(),
15351
+ headers: external_exports.record(external_exports.string(), external_exports.string())
15352
+ });
15353
+
15324
15354
  // ../../shared-contracts/dist/console.js
15325
15355
  var consoleAnnouncementSchema = external_exports.strictObject({
15326
15356
  title: external_exports.string().trim().min(1).max(200),
@@ -17630,8 +17660,8 @@ function ompUsageRecord(message3, extra = {}) {
17630
17660
  const usage = isRecord5(message3.usage) ? message3.usage : null;
17631
17661
  const input = nonNegativeSafeInteger(usage?.input);
17632
17662
  const output = nonNegativeSafeInteger(usage?.output);
17633
- const requestId = typeof message3.responseId === "string" && message3.responseId.length > 0 ? message3.responseId : typeof message3.timestamp === "number" && Number.isSafeInteger(message3.timestamp) ? `t${message3.timestamp}` : null;
17634
- if (!usage || input === null || output === null || requestId === null) {
17663
+ const requestId2 = typeof message3.responseId === "string" && message3.responseId.length > 0 ? message3.responseId : typeof message3.timestamp === "number" && Number.isSafeInteger(message3.timestamp) ? `t${message3.timestamp}` : null;
17664
+ if (!usage || input === null || output === null || requestId2 === null) {
17635
17665
  return { kind: "missing" };
17636
17666
  }
17637
17667
  const cacheRead = nonNegativeSafeInteger(usage.cacheRead);
@@ -17642,7 +17672,7 @@ function ompUsageRecord(message3, extra = {}) {
17642
17672
  return {
17643
17673
  kind: "request",
17644
17674
  request: parseHostUsageRequest({
17645
- requestId,
17675
+ requestId: requestId2,
17646
17676
  ...extra.historical ? { historical: true } : {},
17647
17677
  // Omp's provider is a configurable name, not a standard provider ID.
17648
17678
  ...typeof message3.model === "string" && message3.model.length > 0 ? { model: message3.model } : {},
@@ -19492,11 +19522,11 @@ var OmpRpcSession = class {
19492
19522
  #startInteraction(active, value) {
19493
19523
  if (!this.#isBlockingInteraction(value))
19494
19524
  return;
19495
- const requestId = value.id;
19525
+ const requestId2 = value.id;
19496
19526
  const method = value.method;
19497
19527
  const title = value.title;
19498
19528
  const timeoutMs = value.timeout;
19499
- if (typeof requestId !== "string" || requestId.length === 0 || typeof method !== "string" || typeof title !== "string" || title.length === 0 || timeoutMs !== void 0 && (typeof timeoutMs !== "number" || !Number.isFinite(timeoutMs) || timeoutMs < 0) || active.interactions.has(requestId)) {
19529
+ if (typeof requestId2 !== "string" || requestId2.length === 0 || typeof method !== "string" || typeof title !== "string" || title.length === 0 || timeoutMs !== void 0 && (typeof timeoutMs !== "number" || !Number.isFinite(timeoutMs) || timeoutMs < 0) || active.interactions.has(requestId2)) {
19500
19530
  throw new OmpRpcFaultError("protocolError", "Omp RPC returned an invalid Interaction request");
19501
19531
  }
19502
19532
  let request;
@@ -19512,7 +19542,7 @@ var OmpRpcSession = class {
19512
19542
  optionDetails = value.optionDetails.map(({ description }) => description === void 0 ? {} : { description });
19513
19543
  }
19514
19544
  request = {
19515
- requestId,
19545
+ requestId: requestId2,
19516
19546
  method,
19517
19547
  title,
19518
19548
  options: [...value.options],
@@ -19524,7 +19554,7 @@ var OmpRpcSession = class {
19524
19554
  throw new OmpRpcFaultError("protocolError", "Omp RPC confirm request has no message");
19525
19555
  }
19526
19556
  request = {
19527
- requestId,
19557
+ requestId: requestId2,
19528
19558
  method,
19529
19559
  title,
19530
19560
  message: value.message,
@@ -19535,7 +19565,7 @@ var OmpRpcSession = class {
19535
19565
  throw new OmpRpcFaultError("protocolError", "Omp RPC input placeholder is invalid");
19536
19566
  }
19537
19567
  request = {
19538
- requestId,
19568
+ requestId: requestId2,
19539
19569
  method,
19540
19570
  title,
19541
19571
  ...typeof value.placeholder === "string" ? { placeholder: value.placeholder } : {},
@@ -19546,7 +19576,7 @@ var OmpRpcSession = class {
19546
19576
  throw new OmpRpcFaultError("protocolError", "Omp RPC editor prefill is invalid");
19547
19577
  }
19548
19578
  request = {
19549
- requestId,
19579
+ requestId: requestId2,
19550
19580
  method: "editor",
19551
19581
  title,
19552
19582
  ...typeof value.prefill === "string" ? { prefill: value.prefill } : {},
@@ -19556,16 +19586,16 @@ var OmpRpcSession = class {
19556
19586
  const pending = { request, timeout: null };
19557
19587
  if (request.timeoutMs !== void 0) {
19558
19588
  pending.timeout = setTimeout(() => {
19559
- if (this.#activeTurn !== active || !active.interactions.has(requestId))
19589
+ if (this.#activeTurn !== active || !active.interactions.has(requestId2))
19560
19590
  return;
19561
- void this.#resolveInteraction({ requestId, cancelled: true }, "expired").catch((error51) => {
19591
+ void this.#resolveInteraction({ requestId: requestId2, cancelled: true }, "expired").catch((error51) => {
19562
19592
  if (this.#closed || this.#failed)
19563
19593
  return;
19564
19594
  this.#fail(new OmpRpcFaultError("protocolError", `Omp RPC Interaction timeout handling failed: ${message2(error51)}`));
19565
19595
  });
19566
19596
  }, request.timeoutMs);
19567
19597
  }
19568
- active.interactions.set(requestId, pending);
19598
+ active.interactions.set(requestId2, pending);
19569
19599
  active.onEvent({ type: "interaction.requested", request });
19570
19600
  }
19571
19601
  #handleResponse(value) {
@@ -19917,11 +19947,11 @@ var OmpRpcSession = class {
19917
19947
  this.#options.onFault?.(finalFault);
19918
19948
  }
19919
19949
  #closeInteractions(active, reason) {
19920
- for (const [requestId, pending] of active.interactions) {
19921
- active.interactions.delete(requestId);
19950
+ for (const [requestId2, pending] of active.interactions) {
19951
+ active.interactions.delete(requestId2);
19922
19952
  if (pending.timeout)
19923
19953
  clearTimeout(pending.timeout);
19924
- active.onEvent({ type: "interaction.closed", requestId, reason });
19954
+ active.onEvent({ type: "interaction.closed", requestId: requestId2, reason });
19925
19955
  }
19926
19956
  }
19927
19957
  #rejectActiveTurn(error51) {
@@ -15318,6 +15318,36 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
15318
15318
  var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
15319
15319
  var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
15320
15320
 
15321
+ // ../../shared-contracts/dist/realtime-call.js
15322
+ var REALTIME_CALL_FORWARDED_HEADERS = [
15323
+ "openai-alpha",
15324
+ "thread-id",
15325
+ "session-id",
15326
+ "originator",
15327
+ "x-codex-turn-metadata"
15328
+ ];
15329
+ var FORWARDED_HEADERS = new Set(REALTIME_CALL_FORWARDED_HEADERS);
15330
+ var REALTIME_CALL_ID_PATTERN = /^rtc_[A-Za-z0-9_-]{1,128}$/u;
15331
+ var requestId = external_exports.string().min(1).max(128);
15332
+ var realtimeCallParamsSchema = external_exports.discriminatedUnion("operation", [
15333
+ external_exports.object({
15334
+ operation: external_exports.literal("create"),
15335
+ requestId,
15336
+ body: external_exports.string().min(1).max(16 << 20),
15337
+ headers: external_exports.record(external_exports.string(), external_exports.string()).default({})
15338
+ }),
15339
+ external_exports.object({ operation: external_exports.literal("cancel"), requestId }),
15340
+ external_exports.object({
15341
+ operation: external_exports.literal("hangup"),
15342
+ callId: external_exports.string().regex(REALTIME_CALL_ID_PATTERN)
15343
+ })
15344
+ ]);
15345
+ var realtimeCallResponseSchema = external_exports.object({
15346
+ status: external_exports.number().int().min(200).max(599),
15347
+ body: external_exports.string(),
15348
+ headers: external_exports.record(external_exports.string(), external_exports.string())
15349
+ });
15350
+
15321
15351
  // ../../shared-contracts/dist/console.js
15322
15352
  var consoleAnnouncementSchema = external_exports.strictObject({
15323
15353
  title: external_exports.string().trim().min(1).max(200),
@@ -15318,6 +15318,36 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
15318
15318
  var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
15319
15319
  var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
15320
15320
 
15321
+ // ../../shared-contracts/dist/realtime-call.js
15322
+ var REALTIME_CALL_FORWARDED_HEADERS = [
15323
+ "openai-alpha",
15324
+ "thread-id",
15325
+ "session-id",
15326
+ "originator",
15327
+ "x-codex-turn-metadata"
15328
+ ];
15329
+ var FORWARDED_HEADERS = new Set(REALTIME_CALL_FORWARDED_HEADERS);
15330
+ var REALTIME_CALL_ID_PATTERN = /^rtc_[A-Za-z0-9_-]{1,128}$/u;
15331
+ var requestId = external_exports.string().min(1).max(128);
15332
+ var realtimeCallParamsSchema = external_exports.discriminatedUnion("operation", [
15333
+ external_exports.object({
15334
+ operation: external_exports.literal("create"),
15335
+ requestId,
15336
+ body: external_exports.string().min(1).max(16 << 20),
15337
+ headers: external_exports.record(external_exports.string(), external_exports.string()).default({})
15338
+ }),
15339
+ external_exports.object({ operation: external_exports.literal("cancel"), requestId }),
15340
+ external_exports.object({
15341
+ operation: external_exports.literal("hangup"),
15342
+ callId: external_exports.string().regex(REALTIME_CALL_ID_PATTERN)
15343
+ })
15344
+ ]);
15345
+ var realtimeCallResponseSchema = external_exports.object({
15346
+ status: external_exports.number().int().min(200).max(599),
15347
+ body: external_exports.string(),
15348
+ headers: external_exports.record(external_exports.string(), external_exports.string())
15349
+ });
15350
+
15321
15351
  // ../../shared-contracts/dist/console.js
15322
15352
  var consoleAnnouncementSchema = external_exports.strictObject({
15323
15353
  title: external_exports.string().trim().min(1).max(200),
@@ -18001,8 +18031,8 @@ function piUsageRecord(message3, extra = {}) {
18001
18031
  const usage = isRecord4(message3.usage) ? message3.usage : null;
18002
18032
  const input = nonNegativeSafeInteger(usage?.input);
18003
18033
  const output = nonNegativeSafeInteger(usage?.output);
18004
- const requestId = typeof message3.responseId === "string" && message3.responseId.length > 0 ? message3.responseId : typeof message3.timestamp === "number" && Number.isSafeInteger(message3.timestamp) ? `t${message3.timestamp}` : null;
18005
- if (!usage || input === null || output === null || requestId === null) {
18034
+ const requestId2 = typeof message3.responseId === "string" && message3.responseId.length > 0 ? message3.responseId : typeof message3.timestamp === "number" && Number.isSafeInteger(message3.timestamp) ? `t${message3.timestamp}` : null;
18035
+ if (!usage || input === null || output === null || requestId2 === null) {
18006
18036
  return { kind: "missing" };
18007
18037
  }
18008
18038
  const cacheRead = nonNegativeSafeInteger(usage.cacheRead);
@@ -18013,7 +18043,7 @@ function piUsageRecord(message3, extra = {}) {
18013
18043
  return {
18014
18044
  kind: "request",
18015
18045
  request: parseHostUsageRequest({
18016
- requestId,
18046
+ requestId: requestId2,
18017
18047
  ...extra.historical ? { historical: true } : {},
18018
18048
  // Pi's provider is a user-configurable name, not a standard provider ID.
18019
18049
  ...typeof message3.model === "string" && message3.model.length > 0 ? { model: message3.model } : {},
@@ -19735,26 +19765,26 @@ var PiSubagentRpc = class {
19735
19765
  if (!Array.isArray(data?.commands) || !data.commands.some((command) => command?.name === "subagents-inspect-rpc" && command.source === "extension")) {
19736
19766
  throw new Error("Installed Pi has no pi-subagents Host inspection command");
19737
19767
  }
19738
- const requestId = randomUUID4();
19768
+ const requestId2 = randomUUID4();
19739
19769
  const reply = new Promise((resolve, reject) => {
19740
19770
  const timer = setTimeout(() => {
19741
- this.#pending.delete(requestId);
19771
+ this.#pending.delete(requestId2);
19742
19772
  reject(new Error("Pi subagent inspection timed out"));
19743
19773
  }, this.timeoutMs);
19744
- this.#pending.set(requestId, { resolve, reject, timer });
19774
+ this.#pending.set(requestId2, { resolve, reject, timer });
19745
19775
  });
19746
19776
  try {
19747
- const message3 = `/subagents-inspect-rpc ${requestId} ${address.runId}${address.childId ? ` ${address.childId}` : ""} --lines 200`;
19777
+ const message3 = `/subagents-inspect-rpc ${requestId2} ${address.runId}${address.childId ? ` ${address.childId}` : ""} --lines 200`;
19748
19778
  const [, result] = await Promise.all([this.send("prompt", { message: message3 }), reply]);
19749
19779
  if (!result.error && (result.asyncId !== address.runId && result.asyncId !== address.childId || result.childId !== address.childId)) {
19750
19780
  throw new Error("Pi subagent inspection identity does not match the request");
19751
19781
  }
19752
19782
  return result;
19753
19783
  } finally {
19754
- const pending = this.#pending.get(requestId);
19784
+ const pending = this.#pending.get(requestId2);
19755
19785
  if (pending) {
19756
19786
  clearTimeout(pending.timer);
19757
- this.#pending.delete(requestId);
19787
+ this.#pending.delete(requestId2);
19758
19788
  }
19759
19789
  }
19760
19790
  }
@@ -20613,11 +20643,11 @@ var PiRpcSession = class {
20613
20643
  #startInteraction(active, value) {
20614
20644
  if (!this.#isBlockingInteraction(value))
20615
20645
  return;
20616
- const requestId = value.id;
20646
+ const requestId2 = value.id;
20617
20647
  const method = value.method;
20618
20648
  const title = value.title;
20619
20649
  const timeoutMs = value.timeout;
20620
- if (typeof requestId !== "string" || requestId.length === 0 || typeof method !== "string" || typeof title !== "string" || title.length === 0 || timeoutMs !== void 0 && (typeof timeoutMs !== "number" || !Number.isFinite(timeoutMs) || timeoutMs < 0) || active.interactions.has(requestId)) {
20650
+ if (typeof requestId2 !== "string" || requestId2.length === 0 || typeof method !== "string" || typeof title !== "string" || title.length === 0 || timeoutMs !== void 0 && (typeof timeoutMs !== "number" || !Number.isFinite(timeoutMs) || timeoutMs < 0) || active.interactions.has(requestId2)) {
20621
20651
  throw new PiRpcFaultError("protocolError", "Pi RPC returned an invalid Interaction request");
20622
20652
  }
20623
20653
  let request;
@@ -20626,7 +20656,7 @@ var PiRpcSession = class {
20626
20656
  throw new PiRpcFaultError("protocolError", "Pi RPC select request has invalid options");
20627
20657
  }
20628
20658
  request = {
20629
- requestId,
20659
+ requestId: requestId2,
20630
20660
  method,
20631
20661
  title,
20632
20662
  options: [...value.options],
@@ -20637,7 +20667,7 @@ var PiRpcSession = class {
20637
20667
  throw new PiRpcFaultError("protocolError", "Pi RPC confirm request has no message");
20638
20668
  }
20639
20669
  request = {
20640
- requestId,
20670
+ requestId: requestId2,
20641
20671
  method,
20642
20672
  title,
20643
20673
  message: value.message,
@@ -20648,7 +20678,7 @@ var PiRpcSession = class {
20648
20678
  throw new PiRpcFaultError("protocolError", "Pi RPC input placeholder is invalid");
20649
20679
  }
20650
20680
  request = {
20651
- requestId,
20681
+ requestId: requestId2,
20652
20682
  method,
20653
20683
  title,
20654
20684
  ...typeof value.placeholder === "string" ? { placeholder: value.placeholder } : {},
@@ -20659,7 +20689,7 @@ var PiRpcSession = class {
20659
20689
  throw new PiRpcFaultError("protocolError", "Pi RPC editor prefill is invalid");
20660
20690
  }
20661
20691
  request = {
20662
- requestId,
20692
+ requestId: requestId2,
20663
20693
  method: "editor",
20664
20694
  title,
20665
20695
  ...typeof value.prefill === "string" ? { prefill: value.prefill } : {},
@@ -20669,16 +20699,16 @@ var PiRpcSession = class {
20669
20699
  const pending = { request, timeout: null };
20670
20700
  if (request.timeoutMs !== void 0) {
20671
20701
  pending.timeout = setTimeout(() => {
20672
- if (this.#activeTurn !== active || !active.interactions.has(requestId))
20702
+ if (this.#activeTurn !== active || !active.interactions.has(requestId2))
20673
20703
  return;
20674
- void this.#resolveInteraction({ requestId, cancelled: true }, "expired").catch((error51) => {
20704
+ void this.#resolveInteraction({ requestId: requestId2, cancelled: true }, "expired").catch((error51) => {
20675
20705
  if (this.#closed || this.#failed)
20676
20706
  return;
20677
20707
  this.#fail(new PiRpcFaultError("protocolError", `Pi RPC Interaction timeout handling failed: ${message2(error51)}`));
20678
20708
  });
20679
20709
  }, request.timeoutMs);
20680
20710
  }
20681
- active.interactions.set(requestId, pending);
20711
+ active.interactions.set(requestId2, pending);
20682
20712
  active.onEvent({ type: "interaction.requested", request });
20683
20713
  }
20684
20714
  #handleResponse(value) {
@@ -20932,13 +20962,13 @@ var PiRpcSession = class {
20932
20962
  this.#options.onFault?.(finalFault);
20933
20963
  }
20934
20964
  #closeInteractions(active, reason) {
20935
- for (const [requestId, pending] of active.interactions) {
20936
- active.interactions.delete(requestId);
20965
+ for (const [requestId2, pending] of active.interactions) {
20966
+ active.interactions.delete(requestId2);
20937
20967
  if (pending.timeout)
20938
20968
  clearTimeout(pending.timeout);
20939
20969
  active.onEvent({
20940
20970
  type: "interaction.closed",
20941
- requestId,
20971
+ requestId: requestId2,
20942
20972
  reason
20943
20973
  });
20944
20974
  }