@karlorz/codexhost-cli-win32-x64 0.17.1-0 → 0.17.4-0

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 CHANGED
@@ -7,7 +7,7 @@ Run Pi and Claude Code as first-class external harnesses inside Codex Desktop.
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- npm install -g @karlorz/codexhost-cli@0.17.1-0
10
+ npm install -g @karlorz/codexhost-cli@0.17.4-0
11
11
  ```
12
12
 
13
13
  Do not install this package directly. npm selects it through the optional dependencies of `@karlorz/codexhost-cli`.
@@ -1 +1 @@
1
- {"schemaVersion":1,"version":"0.17.1-0","distribution":"npm","target":"windows-x64"}
1
+ {"schemaVersion":1,"version":"0.17.4-0","distribution":"npm","target":"windows-x64"}
@@ -16455,6 +16455,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
16455
16455
  /** The text about to be steered; a Harness command always stops and restarts. */
16456
16456
  text: external_exports.string().optional()
16457
16457
  }).strict();
16458
+ var threadSteeringContextSchema = external_exports.object({
16459
+ kind: external_exports.literal("application"),
16460
+ value: external_exports.string().transform((text, context) => {
16461
+ try {
16462
+ return JSON.parse(text);
16463
+ } catch {
16464
+ context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
16465
+ return external_exports.NEVER;
16466
+ }
16467
+ }).pipe(external_exports.object({
16468
+ expectedTurnId: hostTurnIdSchema,
16469
+ clientUserMessageId: external_exports.string().min(1),
16470
+ delivery: external_exports.enum(["newTurn", "activeTurn"])
16471
+ }).strict())
16472
+ }).strict().transform((context) => context.value);
16458
16473
  var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
16459
16474
  var threadSteeringInspectResultSchema = external_exports.object({
16460
16475
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
@@ -15675,6 +15675,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15675
15675
  /** The text about to be steered; a Harness command always stops and restarts. */
15676
15676
  text: external_exports.string().optional()
15677
15677
  }).strict();
15678
+ var threadSteeringContextSchema = external_exports.object({
15679
+ kind: external_exports.literal("application"),
15680
+ value: external_exports.string().transform((text, context) => {
15681
+ try {
15682
+ return JSON.parse(text);
15683
+ } catch {
15684
+ context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
15685
+ return external_exports.NEVER;
15686
+ }
15687
+ }).pipe(external_exports.object({
15688
+ expectedTurnId: hostTurnIdSchema,
15689
+ clientUserMessageId: external_exports.string().min(1),
15690
+ delivery: external_exports.enum(["newTurn", "activeTurn"])
15691
+ }).strict())
15692
+ }).strict().transform((context) => context.value);
15678
15693
  var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
15679
15694
  var threadSteeringInspectResultSchema = external_exports.object({
15680
15695
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
@@ -15581,6 +15581,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15581
15581
  text: external_exports.string().optional()
15582
15582
  }).strict();
15583
15583
  var THREAD_STEER_DELIVERY_PARAM = "codexhostSteerDelivery";
15584
+ var threadSteeringContextSchema = external_exports.object({
15585
+ kind: external_exports.literal("application"),
15586
+ value: external_exports.string().transform((text, context) => {
15587
+ try {
15588
+ return JSON.parse(text);
15589
+ } catch {
15590
+ context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
15591
+ return external_exports.NEVER;
15592
+ }
15593
+ }).pipe(external_exports.object({
15594
+ expectedTurnId: hostTurnIdSchema,
15595
+ clientUserMessageId: external_exports.string().min(1),
15596
+ delivery: external_exports.enum(["newTurn", "activeTurn"])
15597
+ }).strict())
15598
+ }).strict().transform((context) => context.value);
15584
15599
  var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
15585
15600
  var threadSteeringInspectResultSchema = external_exports.object({
15586
15601
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
@@ -16652,10 +16667,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16652
16667
  function lastVoiceLaunchProductExperience() {
16653
16668
  return lastVoiceProductExperience;
16654
16669
  }
16655
- function isExternalHarnessComposer(owner = globalThis) {
16656
- if (lastVoiceProductExperience === "chat") return false;
16657
- if (selectedComposerModel(owner).startsWith("codexhost/")) return true;
16658
- if (lastVoiceProductExperience !== "work") return false;
16670
+ function lastAgentIsExternalHarness(owner) {
16659
16671
  const storage = owner.localStorage;
16660
16672
  if (!storage) return false;
16661
16673
  try {
@@ -16665,6 +16677,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16665
16677
  return false;
16666
16678
  }
16667
16679
  }
16680
+ function isExternalHarnessComposer(owner = globalThis) {
16681
+ if (lastVoiceProductExperience === "chat") return false;
16682
+ if (selectedComposerModel(owner).startsWith("codexhost/")) return true;
16683
+ if (lastVoiceProductExperience === "codex") return false;
16684
+ if (lastVoiceProductExperience !== "work" && !isWorkComposerSurface(owner)) return false;
16685
+ return lastAgentIsExternalHarness(owner);
16686
+ }
16668
16687
  function wrapClientOwnedVoiceFetch(client, bridge, workOverride, responseError, chatOverride = () => false, workSurface = () => isWorkComposerSurface(), externalHarness = () => isExternalHarnessComposer()) {
16669
16688
  const original = client.fetch;
16670
16689
  const wrapped = async function(url2, options) {
@@ -17079,9 +17098,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17079
17098
  return code === -32601 || code === -32600 && typeof message === "string" && message.startsWith(`Invalid request: unknown variant \`${method}\``);
17080
17099
  }
17081
17100
 
17101
+ // src/renderer-steering-delivery.ts
17102
+ async function inspectRendererSteeringDelivery(send, threadId, text) {
17103
+ const inspect = "codexhost/thread/steering/inspect";
17104
+ try {
17105
+ const response2 = await send(inspect, { threadId, ...text !== void 0 ? { text } : {} });
17106
+ return threadSteeringInspectResultSchema.parse(response2).delivery;
17107
+ } catch (error51) {
17108
+ if (!isUnsupportedMethod(error51, inspect)) throw error51;
17109
+ }
17110
+ const ownership = "codexhost/thread/ownership/list";
17111
+ let response;
17112
+ try {
17113
+ response = await send(ownership, { threadIds: [threadId] });
17114
+ } catch (error51) {
17115
+ if (!isUnsupportedMethod(error51, ownership)) throw error51;
17116
+ await verifyNativeCodexThread(send, threadId);
17117
+ return "official";
17118
+ }
17119
+ const result = threadOwnershipListResultSchema.parse(response);
17120
+ const owner = result.threads.find((thread) => thread.threadId === threadId)?.owner;
17121
+ if (!owner) throw new Error("Thread ownership could not be resolved for steering");
17122
+ return owner === "codex" ? "official" : "newTurn";
17123
+ }
17124
+
17082
17125
  // src/renderer-external-steering.ts
17083
- var THREAD_STEERING_INSPECT_METHOD = "codexhost/thread/steering/inspect";
17084
- var THREAD_OWNERSHIP_LIST_METHOD = "codexhost/thread/ownership/list";
17085
17126
  function isRecord4(value) {
17086
17127
  return value !== null && typeof value === "object" && !Array.isArray(value);
17087
17128
  }
@@ -17288,34 +17329,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17288
17329
  };
17289
17330
  });
17290
17331
  };
17291
- const inspectDelivery = async (threadId, text) => {
17292
- try {
17293
- const response = await originalSend.call(manager, THREAD_STEERING_INSPECT_METHOD, {
17294
- threadId,
17295
- ...text !== void 0 ? { text } : {}
17296
- });
17297
- return threadSteeringInspectResultSchema.parse(response).delivery;
17298
- } catch (error51) {
17299
- if (!isUnsupportedMethod(error51, THREAD_STEERING_INSPECT_METHOD)) throw error51;
17300
- }
17301
- let ownershipResponse;
17302
- try {
17303
- ownershipResponse = await originalSend.call(manager, THREAD_OWNERSHIP_LIST_METHOD, {
17304
- threadIds: [threadId]
17305
- });
17306
- } catch (error51) {
17307
- if (!isUnsupportedMethod(error51, THREAD_OWNERSHIP_LIST_METHOD)) throw error51;
17308
- await verifyNativeCodexThread(
17309
- (method, params) => originalSend.call(manager, method, params),
17310
- threadId
17311
- );
17312
- return "official";
17313
- }
17314
- const ownership = threadOwnershipListResultSchema.parse(ownershipResponse);
17315
- const owner = ownership.threads.find((thread) => thread.threadId === threadId)?.owner;
17316
- if (!owner) throw new Error("Thread ownership could not be resolved for steering");
17317
- return owner === "codex" ? "official" : "newTurn";
17318
- };
17332
+ const inspectDelivery = (threadId, text) => inspectRendererSteeringDelivery(
17333
+ (method, params) => originalSend.call(manager, method, params),
17334
+ threadId,
17335
+ text
17336
+ );
17319
17337
  const steer = async function(...args) {
17320
17338
  const [
17321
17339
  threadId,
@@ -17326,7 +17344,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17326
17344
  clientUserMessageId,
17327
17345
  additionalContext,
17328
17346
  toolOutput,
17329
- onMessageAdded
17347
+ onMessageAdded,
17348
+ beforeSendRequest,
17349
+ assertRequestCurrent
17330
17350
  ] = args;
17331
17351
  if (typeof threadId !== "string") return originalSteer.apply(manager, args);
17332
17352
  const role = manager.getStreamRole?.(threadId);
@@ -17411,7 +17431,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17411
17431
  attachments: attachments ?? [],
17412
17432
  commentAttachments: context.commentAttachments ?? [],
17413
17433
  mcpAppModelContextAttachments: context.mcpAppModelContextAttachments,
17414
- useAppServerPermissionDefault: true
17434
+ useAppServerPermissionDefault: true,
17435
+ beforeSendRequest,
17436
+ assertRequestCurrent
17415
17437
  }
17416
17438
  },
17417
17439
  onMessageAdded
@@ -17801,7 +17823,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17801
17823
  // src/renderer-voice-start-capability.ts
17802
17824
  var GLOBAL = "__codexhostVoiceStartCapabilityV1";
17803
17825
  var record3 = (v) => v !== null && typeof v === "object";
17804
- function gatewayVoiceStartRequest(request, workGateway, chatGateway = false) {
17826
+ function gatewayVoiceStartRequest(request, workGateway, chatGateway = false, externalHarness = false) {
17805
17827
  if (!record3(request) || request.productExperience !== "work" && request.productExperience !== "codex" && request.productExperience !== "chat")
17806
17828
  return false;
17807
17829
  if (request.source === "composer_button_existing_thread") {
@@ -17812,7 +17834,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17812
17834
  const mode = request.activeCollaborationMode;
17813
17835
  const settings = record3(mode) ? mode.settings : void 0;
17814
17836
  const model2 = record3(settings) ? settings.model : void 0;
17815
- return workGateway || typeof model2 === "string" && model2.startsWith("codexhost/");
17837
+ return workGateway || externalHarness || typeof model2 === "string" && model2.startsWith("codexhost/");
17816
17838
  }
17817
17839
  function wrapGatewayVoiceStarter(start, options) {
17818
17840
  let active;
@@ -17914,7 +17936,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17914
17936
  qualifies: (request) => !disposed && !!readCpaLiveVoiceHookConfig(target) && gatewayVoiceStartRequest(
17915
17937
  request,
17916
17938
  cpaLiveVoicePreferenceAllowsInstall(target),
17917
- chatLiveVoicePreferenceAllowsOverride(target)
17939
+ chatLiveVoicePreferenceAllowsOverride(target),
17940
+ isExternalHarnessComposer(target)
17918
17941
  ),
17919
17942
  ready: async () => {
17920
17943
  const hook = target.__codexhostClientOwnedVoiceV1;