@agentclientprotocol/codex-acp 1.12.1-preview.3 → 1.12.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 +45 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -29681,6 +29681,20 @@ function hasOnlyKeys(value, allowed) {
29681
29681
  return Object.keys(value).every((key) => allowedKeys.has(key));
29682
29682
  }
29683
29683
 
29684
+ // src/SessionNotice.ts
29685
+ function clientSupportsNotices(capabilities) {
29686
+ const notices = capabilities?.session?.notices;
29687
+ return typeof notices === "object" && notices !== null && !Array.isArray(notices);
29688
+ }
29689
+ function createSessionNotice(severity, title, description) {
29690
+ return {
29691
+ sessionUpdate: "notice",
29692
+ severity,
29693
+ title,
29694
+ ...description == null ? {} : { description }
29695
+ };
29696
+ }
29697
+
29684
29698
  // src/CodexEventHandler.ts
29685
29699
  var MAX_SESSION_FAILURE_TITLE_LENGTH = 240;
29686
29700
  var SESSION_FAILURE_POLICY = {
@@ -29763,8 +29777,9 @@ var CodexEventHandler = class _CodexEventHandler {
29763
29777
  sessionState.sessionId,
29764
29778
  false,
29765
29779
  new ACPSessionConnection(connection, sessionState.sessionId)
29766
- ), onAccountUpdated, collectTurnDiffs = false, supportsCompaction = false) {
29780
+ ), onAccountUpdated, collectTurnDiffs = false, supportsCompaction = false, supportsNotices = false) {
29767
29781
  this.supportsCompaction = supportsCompaction;
29782
+ this.supportsNotices = supportsNotices;
29768
29783
  this.onAccountUpdated = onAccountUpdated;
29769
29784
  this.sessionState = sessionState;
29770
29785
  this.supportsPlanUpdates = supportsPlanUpdates;
@@ -29778,6 +29793,7 @@ var CodexEventHandler = class _CodexEventHandler {
29778
29793
  }
29779
29794
  }
29780
29795
  supportsCompaction;
29796
+ supportsNotices;
29781
29797
  static PLAN_UPDATE_INTERVAL_MS = 150;
29782
29798
  sessionState;
29783
29799
  supportsPlanUpdates;
@@ -30208,6 +30224,9 @@ var CodexEventHandler = class _CodexEventHandler {
30208
30224
  return createAgentTextMessageChunk(event.delta, event.itemId, createCodexMessagePhaseMeta(phase));
30209
30225
  }
30210
30226
  async createConfigWarningEvent(event) {
30227
+ if (this.supportsNotices) {
30228
+ return createSessionNotice("warning", event.summary.trim() || "Configuration warning", event.details);
30229
+ }
30211
30230
  if (this.supportsTypedSessionFailures) {
30212
30231
  return this.createSessionFailureUpdate(this.recordSessionNotice(...this.sessionNoticeContent(event.summary, event.details)));
30213
30232
  }
@@ -30218,18 +30237,19 @@ ${event.details}` : event.summary;
30218
30237
 
30219
30238
  `);
30220
30239
  }
30221
- /**
30222
- * Unlike `warning` and `configWarning`, this notification was dropped outright, so there is no
30223
- * legacy rendering to preserve. It is surfaced only to clients that negotiated typed records;
30224
- * every other client keeps seeing exactly what it sees today, which is nothing.
30225
- */
30226
30240
  createDeprecationNoticeEvent(event) {
30241
+ if (this.supportsNotices) {
30242
+ return createSessionNotice("warning", event.summary.trim() || "Deprecated configuration", event.details);
30243
+ }
30227
30244
  if (!this.supportsTypedSessionFailures) return null;
30228
30245
  return this.createSessionFailureUpdate(
30229
30246
  this.recordSessionNotice(...this.sessionNoticeContent(event.summary, event.details))
30230
30247
  );
30231
30248
  }
30232
30249
  createWarningEvent(event) {
30250
+ if (this.supportsNotices) {
30251
+ return createSessionNotice("warning", event.message.trim() || "Codex warning");
30252
+ }
30233
30253
  if (this.supportsTypedSessionFailures) {
30234
30254
  return this.createSessionFailureUpdate(this.recordSessionNotice(event.message));
30235
30255
  }
@@ -30238,9 +30258,16 @@ ${event.details}` : event.summary;
30238
30258
  `);
30239
30259
  }
30240
30260
  createModelReroutedEvent(event) {
30241
- return createAgentTextThoughtChunk(`Model rerouted from ${event.fromModel} to ${event.toModel} (${event.reason}).
30261
+ if (!this.supportsNotices) {
30262
+ return createAgentTextThoughtChunk(`Model rerouted from ${event.fromModel} to ${event.toModel} (${event.reason}).
30242
30263
 
30243
30264
  `);
30265
+ }
30266
+ return createSessionNotice(
30267
+ "info",
30268
+ "Model rerouted",
30269
+ `Switched from ${event.fromModel} to ${event.toModel} (${event.reason}).`
30270
+ );
30244
30271
  }
30245
30272
  createThreadGoalUpdatedEvent(event) {
30246
30273
  this.sessionState.goalRevision += 1;
@@ -30492,7 +30519,14 @@ ${event.details}` : event.summary;
30492
30519
  return createAgentTextMessageChunk(text);
30493
30520
  }
30494
30521
  createContextCompactedEvent() {
30495
- return createAgentTextMessageChunk("*Context compacted to fit the model's context window.*\n\n");
30522
+ if (!this.supportsNotices) {
30523
+ return createAgentTextMessageChunk("*Context compacted to fit the model's context window.*\n\n");
30524
+ }
30525
+ return createSessionNotice(
30526
+ "info",
30527
+ "Context compacted",
30528
+ "Conversation compacted to fit the model's context window."
30529
+ );
30496
30530
  }
30497
30531
  createCommandOutputDeltaEvent(event) {
30498
30532
  if (event.delta.length > 0) {
@@ -33052,7 +33086,7 @@ var package_default = {
33052
33086
  publishConfig: {
33053
33087
  access: "public"
33054
33088
  },
33055
- version: "1.12.1-preview.3",
33089
+ version: "1.12.1-preview.4",
33056
33090
  description: "",
33057
33091
  main: "dist/index.js",
33058
33092
  bin: {
@@ -39789,7 +39823,8 @@ Check ${configPath} and project .codex directories, especially their config.toml
39789
39823
  sessionState.subagents,
39790
39824
  (accountUpdated) => this.handleAccountUpdated(accountUpdated),
39791
39825
  agentFileChangeReportRequest !== null,
39792
- clientSupportsCompaction(this.clientCapabilities)
39826
+ clientSupportsCompaction(this.clientCapabilities),
39827
+ clientSupportsNotices(this.clientCapabilities)
39793
39828
  );
39794
39829
  eventHandler = promptEventHandler;
39795
39830
  const permissionLifecycle = this.permissionLifecycleContext(sessionState);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.12.1-preview.3",
6
+ "version": "1.12.1-preview.4",
7
7
  "description": "",
8
8
  "main": "dist/index.js",
9
9
  "bin": {