@agentclientprotocol/codex-acp 1.11.1-preview.3 → 1.11.1-preview.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.
Files changed (2) hide show
  1. package/dist/index.js +44 -30
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -26090,7 +26090,9 @@ function cancelledResponse() {
26090
26090
  }
26091
26091
 
26092
26092
  // src/CodexElicitationHandler.ts
26093
- var USER_INPUT_OTHER_FIELD_SUFFIX = "__other";
26093
+ var USER_INPUT_NOTE_FIELD_SUFFIX = "_note";
26094
+ var USER_INPUT_OTHER_OPTION = "None of the above";
26095
+ var USER_INPUT_NOTE_PREFIX = "user_note: ";
26094
26096
  function normalizeElicitationSchema(value) {
26095
26097
  const normalized = normalizeElicitationSchemaValue(value);
26096
26098
  if (!isRecord2(normalized)) {
@@ -26147,16 +26149,14 @@ function elicitationResponseMeta(response, context, persist = void 0) {
26147
26149
  }
26148
26150
  return Object.keys(meta3).length === 0 ? null : meta3;
26149
26151
  }
26150
- function userInputOtherFieldId(questionId, questionIds) {
26151
- const base = `${questionId}${USER_INPUT_OTHER_FIELD_SUFFIX}`;
26152
- if (!questionIds.has(base)) {
26153
- return base;
26154
- }
26152
+ function userInputNoteFieldId(questionId, questionIds) {
26153
+ const base = `${questionId}${USER_INPUT_NOTE_FIELD_SUFFIX}`;
26154
+ let fieldId = base;
26155
26155
  let index = 1;
26156
- while (questionIds.has(`${base}${index}`)) {
26157
- index += 1;
26156
+ while (questionIds.has(fieldId)) {
26157
+ fieldId = `${base}${index++}`;
26158
26158
  }
26159
- return `${base}${index}`;
26159
+ return fieldId;
26160
26160
  }
26161
26161
  function userInputResponseValue(content, fieldId) {
26162
26162
  const value = content[fieldId];
@@ -26395,8 +26395,8 @@ var CodexElicitationHandler = class {
26395
26395
  const hasOptions = options.length > 0;
26396
26396
  const hasOtherAnswer = question.isOther && hasOptions;
26397
26397
  const base = {
26398
- title: question.header || question.id,
26399
- description: question.question,
26398
+ title: question.question || question.header || question.id,
26399
+ ...question.header ? { description: question.header } : {},
26400
26400
  _meta: {
26401
26401
  codex: {
26402
26402
  isOther: question.isOther,
@@ -26404,42 +26404,45 @@ var CodexElicitationHandler = class {
26404
26404
  }
26405
26405
  }
26406
26406
  };
26407
- if (!hasOtherAnswer) {
26408
- required2.push(question.id);
26409
- }
26407
+ required2.push(question.id);
26410
26408
  properties[question.id] = hasOptions ? {
26411
26409
  ...base,
26412
26410
  type: "string",
26413
- oneOf: options.map((option) => ({
26414
- const: option.label,
26415
- title: option.label,
26416
- description: option.description
26417
- }))
26411
+ oneOf: [
26412
+ ...options.map((option) => ({
26413
+ const: option.label,
26414
+ title: option.label,
26415
+ ...option.description ? { description: option.description } : {}
26416
+ })),
26417
+ ...hasOtherAnswer && !options.some((option) => option.label === USER_INPUT_OTHER_OPTION) ? [{
26418
+ const: USER_INPUT_OTHER_OPTION,
26419
+ title: USER_INPUT_OTHER_OPTION,
26420
+ description: "Provide a different answer in the note field."
26421
+ }] : []
26422
+ ]
26418
26423
  } : {
26419
26424
  ...base,
26420
26425
  type: "string"
26421
26426
  };
26422
26427
  if (hasOtherAnswer) {
26423
- properties[userInputOtherFieldId(question.id, questionIds)] = {
26428
+ properties[userInputNoteFieldId(question.id, questionIds)] = {
26424
26429
  type: "string",
26425
- title: "Other",
26426
- description: "Type your own answer instead of choosing an option above.",
26430
+ title: "Additional answer or note",
26427
26431
  _meta: {
26428
26432
  codex: {
26429
26433
  questionId: question.id,
26430
- isOtherAnswer: true,
26434
+ role: "user_note",
26431
26435
  isSecret: question.isSecret
26432
26436
  }
26433
26437
  }
26434
26438
  };
26435
26439
  }
26436
26440
  }
26437
- const firstQuestion = params.questions[0];
26438
26441
  return {
26439
26442
  sessionId: params.threadId,
26440
26443
  toolCallId: params.itemId,
26441
26444
  mode: "form",
26442
- message: params.questions.length === 1 && firstQuestion ? firstQuestion.question : "Input requested",
26445
+ message: "Codex needs your input to continue.",
26443
26446
  requestedSchema: {
26444
26447
  type: "object",
26445
26448
  properties,
@@ -26490,12 +26493,23 @@ var CodexElicitationHandler = class {
26490
26493
  const content = contentRecord(response.content);
26491
26494
  const questionIds = new Set(params.questions.map((question) => question.id));
26492
26495
  for (const question of params.questions) {
26493
- const value = question.isOther && question.options != null && question.options.length > 0 ? userInputResponseValue(content, userInputOtherFieldId(question.id, questionIds)) ?? userInputResponseValue(content, question.id) : userInputResponseValue(content, question.id);
26494
- if (value === void 0) {
26496
+ const answerValues = [];
26497
+ const value = userInputResponseValue(content, question.id);
26498
+ if (value !== void 0) {
26499
+ answerValues.push(...Array.isArray(value) ? value.map(String) : [String(value)]);
26500
+ }
26501
+ if (question.isOther && question.options != null && question.options.length > 0) {
26502
+ const note = userInputResponseValue(content, userInputNoteFieldId(question.id, questionIds));
26503
+ if (note !== void 0) {
26504
+ const notes = Array.isArray(note) ? note : [note];
26505
+ answerValues.push(...notes.map((item) => `${USER_INPUT_NOTE_PREFIX}${String(item).trim()}`));
26506
+ }
26507
+ }
26508
+ if (answerValues.length === 0) {
26495
26509
  continue;
26496
26510
  }
26497
26511
  answers[question.id] = {
26498
- answers: Array.isArray(value) ? value.map(String) : [String(value)]
26512
+ answers: answerValues
26499
26513
  };
26500
26514
  }
26501
26515
  return { answers };
@@ -27417,7 +27431,7 @@ var package_default = {
27417
27431
  publishConfig: {
27418
27432
  access: "public"
27419
27433
  },
27420
- version: "1.11.1-preview.3",
27434
+ version: "1.11.1-preview.4",
27421
27435
  description: "",
27422
27436
  main: "dist/index.js",
27423
27437
  bin: {
@@ -27480,7 +27494,7 @@ var package_default = {
27480
27494
  },
27481
27495
  dependencies: {
27482
27496
  "@agentclientprotocol/sdk": "^1.4.0",
27483
- "@openai/codex": "^0.153.4",
27497
+ "@openai/codex": "^0.154.0",
27484
27498
  diff: "^9.0.0",
27485
27499
  open: "^11.0.1",
27486
27500
  "vscode-jsonrpc": "^9.0.1",
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.11.1-preview.3",
6
+ "version": "1.11.1-preview.4",
7
7
  "description": "",
8
8
  "main": "dist/index.js",
9
9
  "bin": {
@@ -66,7 +66,7 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "@agentclientprotocol/sdk": "^1.4.0",
69
- "@openai/codex": "^0.153.4",
69
+ "@openai/codex": "^0.154.0",
70
70
  "diff": "^9.0.0",
71
71
  "open": "^11.0.1",
72
72
  "vscode-jsonrpc": "^9.0.1",