@scotthuang/agent-knock-knock 0.13.16 → 0.13.18

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 (184) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +4 -4
  3. package/dist/src/claude-terminal-agent-adapter.js +1 -1
  4. package/dist/src/claude-terminal-agent-adapter.js.map +1 -1
  5. package/dist/src/codex-app-server-interaction-client.js +68 -26
  6. package/dist/src/codex-app-server-interaction-client.js.map +1 -1
  7. package/dist/src/codex-app-server-read-client.js +52 -20
  8. package/dist/src/codex-app-server-read-client.js.map +1 -1
  9. package/dist/src/codex-astra-composer-proof.js +1 -1
  10. package/dist/src/codex-astra-composer-proof.js.map +1 -1
  11. package/dist/src/codex-async-question-adapter.js +14 -4
  12. package/dist/src/codex-async-question-adapter.js.map +1 -1
  13. package/dist/src/codex-lifecycle-compatibility.d.ts +1 -1
  14. package/dist/src/codex-lifecycle-compatibility.js +9 -3
  15. package/dist/src/codex-lifecycle-compatibility.js.map +1 -1
  16. package/dist/src/codex-open-rollout-inventory.d.ts +51 -0
  17. package/dist/src/codex-open-rollout-inventory.js +365 -0
  18. package/dist/src/codex-open-rollout-inventory.js.map +1 -0
  19. package/dist/src/codex-paginated-thread-binding.js +1 -1
  20. package/dist/src/codex-paginated-thread-binding.js.map +1 -1
  21. package/dist/src/codex-permission-surface.d.ts +1 -1
  22. package/dist/src/codex-permission-surface.js +1 -1
  23. package/dist/src/codex-permission-surface.js.map +1 -1
  24. package/dist/src/codex-rollout-bound-completion.d.ts +44 -0
  25. package/dist/src/codex-rollout-bound-completion.js +357 -0
  26. package/dist/src/codex-rollout-bound-completion.js.map +1 -0
  27. package/dist/src/codex-rollout-file.d.ts +15 -0
  28. package/dist/src/codex-rollout-file.js +98 -0
  29. package/dist/src/codex-rollout-file.js.map +1 -0
  30. package/dist/src/codex-rollout-human-task.d.ts +61 -0
  31. package/dist/src/codex-rollout-human-task.js +555 -0
  32. package/dist/src/codex-rollout-human-task.js.map +1 -0
  33. package/dist/src/codex-rollout-interaction-evidence.d.ts +48 -0
  34. package/dist/src/codex-rollout-interaction-evidence.js +521 -0
  35. package/dist/src/codex-rollout-interaction-evidence.js.map +1 -0
  36. package/dist/src/codex-rollout-inventory.d.ts +5 -0
  37. package/dist/src/codex-rollout-inventory.js +81 -0
  38. package/dist/src/codex-rollout-inventory.js.map +1 -0
  39. package/dist/src/codex-rollout-records.d.ts +49 -0
  40. package/dist/src/codex-rollout-records.js +298 -0
  41. package/dist/src/codex-rollout-records.js.map +1 -0
  42. package/dist/src/codex-sqlite-thread-query.d.ts +85 -0
  43. package/dist/src/codex-sqlite-thread-query.js +440 -0
  44. package/dist/src/codex-sqlite-thread-query.js.map +1 -0
  45. package/dist/src/codex-status-history-navigation.d.ts +1 -1
  46. package/dist/src/codex-status-history-navigation.js +1 -1
  47. package/dist/src/codex-status-history-navigation.js.map +1 -1
  48. package/dist/src/codex-store-adapter.d.ts +3 -50
  49. package/dist/src/codex-store-adapter.js +5 -796
  50. package/dist/src/codex-store-adapter.js.map +1 -1
  51. package/dist/src/codex-terminal-agent-adapter.js +4 -2
  52. package/dist/src/codex-terminal-agent-adapter.js.map +1 -1
  53. package/dist/src/native-thread-lifecycle-cli-adapter.d.ts +4 -134
  54. package/dist/src/native-thread-lifecycle-cli-adapter.js +19 -633
  55. package/dist/src/native-thread-lifecycle-cli-adapter.js.map +1 -1
  56. package/dist/src/native-thread-lifecycle-cli-contract.d.ts +138 -0
  57. package/dist/src/native-thread-lifecycle-cli-contract.js +2 -0
  58. package/dist/src/native-thread-lifecycle-cli-contract.js.map +1 -0
  59. package/dist/src/semantic-permission-control.js +33 -6
  60. package/dist/src/semantic-permission-control.js.map +1 -1
  61. package/dist/src/semantic-tool-descriptions.d.ts +26 -0
  62. package/dist/src/semantic-tool-descriptions.js +259 -0
  63. package/dist/src/semantic-tool-descriptions.js.map +1 -0
  64. package/dist/src/semantic-tool-runtime.js +45 -37
  65. package/dist/src/semantic-tool-runtime.js.map +1 -1
  66. package/dist/src/semantic-tool-schemas.js +134 -33
  67. package/dist/src/semantic-tool-schemas.js.map +1 -1
  68. package/dist/src/terminal-action-contracts.d.ts +4 -0
  69. package/dist/src/terminal-action-contracts.js +695 -0
  70. package/dist/src/terminal-action-contracts.js.map +1 -0
  71. package/dist/src/terminal-composer-classifier.d.ts +1 -1
  72. package/dist/src/terminal-composer-classifier.js +2 -2
  73. package/dist/src/terminal-composer-classifier.js.map +1 -1
  74. package/dist/src/terminal-interaction-response-bridge.js +1 -1
  75. package/dist/src/terminal-interaction-response-bridge.js.map +1 -1
  76. package/dist/src/terminal-list-renderer.d.ts +1 -2
  77. package/dist/src/terminal-list-renderer.js +8 -424
  78. package/dist/src/terminal-list-renderer.js.map +1 -1
  79. package/dist/src/terminal-model-control-action-policy.d.ts +1 -1
  80. package/dist/src/terminal-model-control-availability.d.ts +1 -1
  81. package/dist/src/terminal-model-control-availability.js +1 -1
  82. package/dist/src/terminal-model-control-availability.js.map +1 -1
  83. package/dist/src/terminal-model-control-cli-adapter.d.ts +34 -0
  84. package/dist/src/terminal-model-control-cli-adapter.js +669 -0
  85. package/dist/src/terminal-model-control-cli-adapter.js.map +1 -0
  86. package/dist/src/terminal-model-control-contract.d.ts +198 -0
  87. package/dist/src/terminal-model-control-contract.js +15 -0
  88. package/dist/src/terminal-model-control-contract.js.map +1 -0
  89. package/dist/src/terminal-model-control-input.d.ts +29 -0
  90. package/dist/src/terminal-model-control-input.js +86 -0
  91. package/dist/src/terminal-model-control-input.js.map +1 -0
  92. package/dist/src/terminal-model-control-profile.d.ts +5 -1
  93. package/dist/src/terminal-model-control-profile.js +21 -7
  94. package/dist/src/terminal-model-control-profile.js.map +1 -1
  95. package/dist/src/terminal-model-control-subject.d.ts +52 -0
  96. package/dist/src/terminal-model-control-subject.js +73 -0
  97. package/dist/src/terminal-model-control-subject.js.map +1 -1
  98. package/dist/src/terminal-model-control-surface.d.ts +82 -0
  99. package/dist/src/terminal-model-control-surface.js +688 -0
  100. package/dist/src/terminal-model-control-surface.js.map +1 -0
  101. package/dist/src/terminal-model-control.d.ts +6 -270
  102. package/dist/src/terminal-model-control.js +11 -988
  103. package/dist/src/terminal-model-control.js.map +1 -1
  104. package/dist/src/terminal-model-selection.d.ts +33 -0
  105. package/dist/src/terminal-model-selection.js +143 -0
  106. package/dist/src/terminal-model-selection.js.map +1 -0
  107. package/dist/src/terminal-monitor-application-service.js +38 -59
  108. package/dist/src/terminal-monitor-application-service.js.map +1 -1
  109. package/dist/src/terminal-monitor-attention-store.d.ts +65 -0
  110. package/dist/src/terminal-monitor-attention-store.js +518 -0
  111. package/dist/src/terminal-monitor-attention-store.js.map +1 -0
  112. package/dist/src/terminal-monitor-collateral-recovery.d.ts +12 -0
  113. package/dist/src/terminal-monitor-collateral-recovery.js +415 -0
  114. package/dist/src/terminal-monitor-collateral-recovery.js.map +1 -0
  115. package/dist/src/terminal-monitor-interaction-projection.d.ts +19 -0
  116. package/dist/src/terminal-monitor-interaction-projection.js +48 -0
  117. package/dist/src/terminal-monitor-interaction-projection.js.map +1 -0
  118. package/dist/src/terminal-monitor-startup-recovery.d.ts +15 -0
  119. package/dist/src/terminal-monitor-startup-recovery.js +767 -0
  120. package/dist/src/terminal-monitor-startup-recovery.js.map +1 -0
  121. package/dist/src/terminal-monitor-state-cli-adapter.d.ts +2 -104
  122. package/dist/src/terminal-monitor-state-cli-adapter.js +28 -1640
  123. package/dist/src/terminal-monitor-state-cli-adapter.js.map +1 -1
  124. package/dist/src/terminal-monitor-state-contract.d.ts +108 -0
  125. package/dist/src/terminal-monitor-state-contract.js +8 -0
  126. package/dist/src/terminal-monitor-state-contract.js.map +1 -0
  127. package/dist/src/terminal-native-inspection-bridge.d.ts +4 -153
  128. package/dist/src/terminal-native-inspection-bridge.js +7 -646
  129. package/dist/src/terminal-native-inspection-bridge.js.map +1 -1
  130. package/dist/src/terminal-native-inspection-contract.d.ts +128 -0
  131. package/dist/src/terminal-native-inspection-contract.js +38 -0
  132. package/dist/src/terminal-native-inspection-contract.js.map +1 -0
  133. package/dist/src/terminal-native-inspection-profile.d.ts +15 -0
  134. package/dist/src/terminal-native-inspection-profile.js +189 -0
  135. package/dist/src/terminal-native-inspection-profile.js.map +1 -0
  136. package/dist/src/terminal-native-inspection-proof.d.ts +62 -0
  137. package/dist/src/terminal-native-inspection-proof.js +362 -0
  138. package/dist/src/terminal-native-inspection-proof.js.map +1 -0
  139. package/dist/src/terminal-permission-control-bridge.js +1 -1
  140. package/dist/src/terminal-permission-control-bridge.js.map +1 -1
  141. package/dist/src/terminal-permission-control.js +5 -1
  142. package/dist/src/terminal-permission-control.js.map +1 -1
  143. package/dist/src/terminal-questionnaire-adapter.js +5 -2
  144. package/dist/src/terminal-questionnaire-adapter.js.map +1 -1
  145. package/dist/src/terminal-runtime-cli-adapter.d.ts +2 -1
  146. package/dist/src/terminal-runtime-cli-adapter.js +1 -1
  147. package/dist/src/terminal-runtime-cli-adapter.js.map +1 -1
  148. package/dist/src/terminal-submission-acceptance.d.ts +5 -148
  149. package/dist/src/terminal-submission-acceptance.js +21 -1845
  150. package/dist/src/terminal-submission-acceptance.js.map +1 -1
  151. package/dist/src/terminal-watch-anchor-capture.d.ts +9 -0
  152. package/dist/src/terminal-watch-anchor-capture.js +139 -0
  153. package/dist/src/terminal-watch-anchor-capture.js.map +1 -0
  154. package/dist/src/terminal-watch-cli-adapter.d.ts +3 -117
  155. package/dist/src/terminal-watch-cli-adapter.js +10 -1992
  156. package/dist/src/terminal-watch-cli-adapter.js.map +1 -1
  157. package/dist/src/terminal-watch-cli-contract.d.ts +117 -0
  158. package/dist/src/terminal-watch-cli-contract.js +2 -0
  159. package/dist/src/terminal-watch-cli-contract.js.map +1 -0
  160. package/dist/src/terminal-watch-fallback-observation.d.ts +15 -0
  161. package/dist/src/terminal-watch-fallback-observation.js +249 -0
  162. package/dist/src/terminal-watch-fallback-observation.js.map +1 -0
  163. package/dist/src/terminal-watch-interaction-observation.d.ts +26 -0
  164. package/dist/src/terminal-watch-interaction-observation.js +262 -0
  165. package/dist/src/terminal-watch-interaction-observation.js.map +1 -0
  166. package/dist/src/terminal-watch-observation-adapter.d.ts +4 -0
  167. package/dist/src/terminal-watch-observation-adapter.js +307 -0
  168. package/dist/src/terminal-watch-observation-adapter.js.map +1 -0
  169. package/dist/src/terminal-watch-observation-evidence.d.ts +25 -0
  170. package/dist/src/terminal-watch-observation-evidence.js +184 -0
  171. package/dist/src/terminal-watch-observation-evidence.js.map +1 -0
  172. package/dist/src/terminal-watch-response-authority.d.ts +6 -0
  173. package/dist/src/terminal-watch-response-authority.js +333 -0
  174. package/dist/src/terminal-watch-response-authority.js.map +1 -0
  175. package/dist/src/terminal-watch-response-cli-adapter.d.ts +3 -0
  176. package/dist/src/terminal-watch-response-cli-adapter.js +230 -0
  177. package/dist/src/terminal-watch-response-cli-adapter.js.map +1 -0
  178. package/dist/src/terminal-watch-terminal-identity.d.ts +39 -0
  179. package/dist/src/terminal-watch-terminal-identity.js +380 -0
  180. package/dist/src/terminal-watch-terminal-identity.js.map +1 -0
  181. package/docs/codex-0.160.0-compatibility.md +126 -0
  182. package/docs/codex-permissions.md +12 -1
  183. package/package.json +3 -2
  184. package/templates/openclaw-skills/agent-knock-knock/SKILL.md +3 -3
@@ -0,0 +1,380 @@
1
+ /** Exact terminal identity and validated Watch command inputs. */
2
+ import { assertAutomaticActivityWatchIdentity } from "./terminal-watch-send-activity.js";
3
+ import { createHash } from "node:crypto";
4
+ import path from "node:path";
5
+ import { paginatedWatchProcessMatches } from "./codex-paginated-watch.js";
6
+ import { rolloutFileIdentityMatches } from "./terminal-binding-authority.js";
7
+ import { sameTerminalControlEvidenceIncarnation, terminalControlEvidence } from "./terminal-control-ref.js";
8
+ import { isTerminalActivityWatch, isUserExplicitFallbackWatch } from "./terminal-watch-store.js";
9
+ import { isRecord, nonBlankString as stringValue } from "./value-guards.js";
10
+ export function assertSameUserExplicitFallbackTerminal(expected, observed) {
11
+ if (requiredString(observed.id, "terminal id") !== expected.conversationId ||
12
+ terminalAgent(observed) !== expected.agent ||
13
+ positiveInteger(observed.pid, "terminal PID") !== expected.pid ||
14
+ !isRecord(observed.terminal_control) ||
15
+ !sameTerminalControlEvidenceIncarnation(expected.terminalControl, observed.terminal_control)) {
16
+ throw new Error("terminal changed before the user-explicit fallback Watch anchor was captured");
17
+ }
18
+ }
19
+ export function assertPreparedFallbackTerminal(prepared, observed) {
20
+ if (requiredString(observed.id, "terminal id") !== prepared.terminalId ||
21
+ terminalAgent(observed) !== prepared.agent ||
22
+ positiveInteger(observed.pid, "terminal PID") !== prepared.pid ||
23
+ !isRecord(observed.terminal_control) ||
24
+ !sameTerminalControlEvidenceIncarnation(prepared.terminalEndpoint, observed.terminal_control)) {
25
+ throw new Error("terminal changed before the user-explicit fallback Watch was attached");
26
+ }
27
+ if (isTerminalActivityWatch(prepared)) {
28
+ assertAutomaticActivityWatchIdentity(prepared.anchor, observed, terminalWorkspace(observed), prepared.terminalIdentity.workspace);
29
+ }
30
+ }
31
+ export async function exactTerminalForWatch(terminalId, options, dependencies) {
32
+ const observation = await dependencies.observeExactTerminal({
33
+ options,
34
+ terminalId
35
+ });
36
+ if (observation.state === "unavailable") {
37
+ throw new Error("authoritative observation of the exact terminal is temporarily " +
38
+ "unavailable; retry after refreshing AKK list");
39
+ }
40
+ if (observation.state === "absent") {
41
+ throw new Error(`expected exact terminal ${terminalId}; observed none`);
42
+ }
43
+ return observation;
44
+ }
45
+ function bindingTokenForWatch(terminal) {
46
+ return requiredSha256(terminal.lifecycle_binding_token, "current terminal binding token");
47
+ }
48
+ export function bestEffortBindingTokenForWatch(terminal) {
49
+ try {
50
+ return { token: bindingTokenForWatch(terminal) };
51
+ }
52
+ catch {
53
+ const terminalControl = terminalControlForWatch(terminal);
54
+ return {
55
+ token: sha256({
56
+ schema: "agent-knock-knock/terminal-watch-observation-binding",
57
+ version: 1,
58
+ terminal_id: requiredString(terminal.id, "terminal id"),
59
+ agent: terminalAgent(terminal),
60
+ pid: positiveInteger(terminal.pid, "terminal PID"),
61
+ endpoint: terminalControlEvidence(terminalControl),
62
+ process_uuid: stringValue(terminal.native_agent_process_uuid) ?? null,
63
+ process_birth: stringValue(terminal.native_agent_process_birth) ?? null
64
+ }),
65
+ warning: "lifecycle_binding_token_unavailable: Watch used read-only terminal/process observation identity"
66
+ };
67
+ }
68
+ }
69
+ export function terminalActivityState(terminal) {
70
+ const state = stringValue(terminal.activity_state);
71
+ return state === "awaiting_approval" || state === "working" ||
72
+ state === "idle"
73
+ ? state
74
+ : "unknown";
75
+ }
76
+ export function sameManualWatchTarget(watch, agent, terminal, anchor) {
77
+ return watch.status === "active" &&
78
+ watch.agent === agent &&
79
+ watch.terminal.terminal_id === terminal.terminal_id &&
80
+ watch.terminal.workspace === terminal.workspace &&
81
+ sameTerminalControlEvidenceIncarnation(watch.terminal.terminal_endpoint, terminal.terminal_endpoint) &&
82
+ sameManualWatchAnchorTarget(watch.anchor, anchor);
83
+ }
84
+ function sameManualWatchAnchorTarget(left, right) {
85
+ if (left.schema !== right.schema)
86
+ return false;
87
+ if (left.schema === "agent-knock-knock/codex-paginated-task-anchor" && right.schema === left.schema) {
88
+ return samePaginatedWatchTask(left, right);
89
+ }
90
+ if (left.schema ===
91
+ "agent-knock-knock/codex-human-started-active-task-anchor" &&
92
+ right.schema === left.schema) {
93
+ return left.turn_id === right.turn_id &&
94
+ left.process_uuid === right.process_uuid &&
95
+ left.process_birth === right.process_birth &&
96
+ left.rollout.device === right.rollout.device &&
97
+ left.rollout.inode === right.rollout.inode;
98
+ }
99
+ if (left.schema ===
100
+ "agent-knock-knock/claude-human-started-active-task-anchor" &&
101
+ right.schema === left.schema) {
102
+ return sameClaudeWatchTask(left, right);
103
+ }
104
+ if (left.schema === "agent-knock-knock/terminal-activity-watch-anchor" &&
105
+ right.schema === left.schema) {
106
+ return left.origin === right.origin &&
107
+ left.request_hash === right.request_hash &&
108
+ left.pid === right.pid &&
109
+ optionalIdentityCompatible(left.native_process_uuid, right.native_process_uuid) &&
110
+ optionalIdentityCompatible(left.native_process_birth, right.native_process_birth);
111
+ }
112
+ return left.anchor_fingerprint === right.anchor_fingerprint;
113
+ }
114
+ function sameClaudeWatchTask(left, right) {
115
+ return left.prompt_uuid === right.prompt_uuid &&
116
+ left.pid === right.pid &&
117
+ left.agent_started_at_ms === right.agent_started_at_ms &&
118
+ left.device === right.device &&
119
+ left.inode === right.inode;
120
+ }
121
+ function samePaginatedWatchTask(left, right) {
122
+ return left.native_thread_id === right.native_thread_id && left.turn_id === right.turn_id &&
123
+ left.process_uuid === right.process_uuid && left.process_birth === right.process_birth &&
124
+ left.origin === right.origin && left.codex_home === right.codex_home;
125
+ }
126
+ function optionalIdentityCompatible(left, right) {
127
+ return left === undefined || right === undefined || left === right;
128
+ }
129
+ export function safeDiagnostic(error) {
130
+ const message = error instanceof Error ? error.message : String(error);
131
+ return message.replace(/[\r\n\0]+/gu, " ").trim().slice(0, 500) ||
132
+ "unknown provider observation error";
133
+ }
134
+ export function terminalControlForWatch(terminal) {
135
+ if (!isRecord(terminal.terminal_control)) {
136
+ throw new Error("the exact terminal has no terminal control authority");
137
+ }
138
+ return terminal.terminal_control;
139
+ }
140
+ export function terminalWatchCandidateMatchesLiveContext(watch, terminal) {
141
+ if (!terminalMatchesWatch(terminal, watch))
142
+ return false;
143
+ if (watch.anchor.schema === "agent-knock-knock/codex-paginated-task-anchor") {
144
+ return paginatedWatchProcessMatches(terminal, watch.anchor);
145
+ }
146
+ const sessionId = stringValue(terminal.native_agent_session_id);
147
+ if (watch.anchor.schema ===
148
+ "agent-knock-knock/codex-human-started-active-task-anchor") {
149
+ return sessionId?.toLowerCase() === watch.anchor.native_thread_id &&
150
+ rolloutFileIdentityMatches(terminal.native_agent_rollout, watch.anchor.rollout);
151
+ }
152
+ if (watch.anchor.schema ===
153
+ "agent-knock-knock/codex-user-explicit-fallback-watch-anchor") {
154
+ const checkpoint = watch.observation_checkpoint;
155
+ return "schema" in checkpoint &&
156
+ checkpoint.schema ===
157
+ "agent-knock-knock/codex-user-explicit-fallback-watch-checkpoint" &&
158
+ checkpoint.accepted_identity !== undefined &&
159
+ sessionId?.toLowerCase() === checkpoint.accepted_identity.native_thread_id &&
160
+ rolloutFileIdentityMatches(terminal.native_agent_rollout, checkpoint.accepted_identity.rollout);
161
+ }
162
+ if (watch.anchor.schema ===
163
+ "agent-knock-knock/claude-human-started-active-task-anchor") {
164
+ return sessionId === watch.anchor.session_id;
165
+ }
166
+ if (watch.anchor.schema ===
167
+ "agent-knock-knock/claude-user-explicit-fallback-watch-anchor") {
168
+ return sessionId === watch.anchor.transcript_anchor.session_id;
169
+ }
170
+ return false;
171
+ }
172
+ export async function currentTerminalForWatch(watch, options, dependencies) {
173
+ return dependencies.observeExactTerminal({
174
+ options,
175
+ terminalId: watch.terminal.terminal_id
176
+ });
177
+ }
178
+ export function terminalMatchesWatch(terminal, watch) {
179
+ try {
180
+ return terminalAgent(terminal) === watch.agent &&
181
+ requiredString(terminal.id, "terminal id") ===
182
+ watch.terminal.terminal_id &&
183
+ terminalWorkspace(terminal) === watch.terminal.workspace &&
184
+ isRecord(terminal.terminal_control) &&
185
+ sameTerminalControlEvidenceIncarnation(terminal.terminal_control, watch.terminal.terminal_endpoint);
186
+ }
187
+ catch {
188
+ return false;
189
+ }
190
+ }
191
+ export function terminalActivityWatchIdentityMatch(terminal, watch) {
192
+ try {
193
+ if (!isTerminalActivityWatch(watch) ||
194
+ terminalAgent(terminal) !== watch.agent ||
195
+ requiredString(terminal.id, "terminal id") !==
196
+ watch.terminal.terminal_id ||
197
+ terminalWorkspace(terminal) !== watch.terminal.workspace ||
198
+ positiveInteger(terminal.pid, "terminal PID") !== watch.anchor.pid) {
199
+ return "mismatch";
200
+ }
201
+ if (!isRecord(terminal.terminal_control)) {
202
+ return "unavailable";
203
+ }
204
+ if (!sameTerminalControlEvidenceIncarnation(terminal.terminal_control, watch.terminal.terminal_endpoint)) {
205
+ return "mismatch";
206
+ }
207
+ const processUuid = stringValue(terminal.native_agent_process_uuid);
208
+ const processBirth = stringValue(terminal.native_agent_process_birth);
209
+ if ((watch.anchor.native_process_uuid !== undefined && !processUuid) ||
210
+ (watch.anchor.native_process_birth !== undefined && !processBirth)) {
211
+ return "unavailable";
212
+ }
213
+ return (watch.anchor.native_process_uuid !== undefined &&
214
+ processUuid !== watch.anchor.native_process_uuid) || (watch.anchor.native_process_birth !== undefined &&
215
+ processBirth !== watch.anchor.native_process_birth)
216
+ ? "mismatch"
217
+ : "match";
218
+ }
219
+ catch {
220
+ return "unavailable";
221
+ }
222
+ }
223
+ export function terminalMatchesUserExplicitFallbackWatch(terminal, watch) {
224
+ try {
225
+ if (!isUserExplicitFallbackWatch(watch) ||
226
+ terminalAgent(terminal) !== watch.agent ||
227
+ requiredString(terminal.id, "terminal id") !==
228
+ watch.terminal.terminal_id ||
229
+ terminalWorkspace(terminal) !== watch.terminal.workspace ||
230
+ !isRecord(terminal.terminal_control) ||
231
+ !sameTerminalControlEvidenceIncarnation(terminal.terminal_control, watch.terminal.terminal_endpoint)) {
232
+ return false;
233
+ }
234
+ if (watch.anchor.schema ===
235
+ "agent-knock-knock/codex-user-explicit-fallback-watch-anchor") {
236
+ return requiredString(terminal.native_agent_process_uuid, "Codex process UUID") === watch.anchor.acceptance_anchor.process_uuid &&
237
+ requiredString(terminal.native_agent_process_birth, "Codex process birth") === watch.anchor.acceptance_anchor.process_birth;
238
+ }
239
+ return watch.anchor.schema ===
240
+ "agent-knock-knock/claude-user-explicit-fallback-watch-anchor" &&
241
+ positiveInteger(terminal.pid, "Claude PID") ===
242
+ watch.anchor.transcript_anchor.pid;
243
+ }
244
+ catch {
245
+ return false;
246
+ }
247
+ }
248
+ export function terminalWatchIdentity(terminal, bindingToken) {
249
+ const terminalControl = terminal.terminal_control;
250
+ return {
251
+ terminal_id: requiredString(terminal.id, "terminal id"),
252
+ terminal_endpoint: terminalControlEvidence(terminalControl),
253
+ workspace: terminalWorkspace(terminal),
254
+ binding_token: bindingToken
255
+ };
256
+ }
257
+ export function codexIdentity(terminal) {
258
+ if (!isRecord(terminal.native_agent_rollout)) {
259
+ throw new Error("Codex terminal has no exact rollout identity");
260
+ }
261
+ return {
262
+ sessionId: requiredString(terminal.native_agent_session_id, "Codex native thread id"),
263
+ processUuid: requiredString(terminal.native_agent_process_uuid, "Codex process UUID"),
264
+ processBirth: requiredString(terminal.native_agent_process_birth, "Codex process birth"),
265
+ rollout: {
266
+ fd: requiredString(terminal.native_agent_rollout.fd, "Codex rollout fd"),
267
+ device: requiredString(terminal.native_agent_rollout.device, "Codex rollout device"),
268
+ inode: requiredString(terminal.native_agent_rollout.inode, "Codex rollout inode"),
269
+ path: requiredString(terminal.native_agent_rollout.path, "Codex rollout path")
270
+ }
271
+ };
272
+ }
273
+ export function codexIdentityForWatch(watch) {
274
+ if (watch.agent !== "codex" ||
275
+ watch.anchor.schema !==
276
+ "agent-knock-knock/codex-human-started-active-task-anchor") {
277
+ throw new Error("terminal Watch has no Codex identity");
278
+ }
279
+ return {
280
+ sessionId: watch.anchor.native_thread_id,
281
+ processUuid: watch.anchor.process_uuid,
282
+ processBirth: watch.anchor.process_birth,
283
+ rollout: watch.anchor.rollout
284
+ };
285
+ }
286
+ export function terminalAgent(terminal) {
287
+ const agent = stringValue(terminal.agent);
288
+ if (agent !== "codex" && agent !== "claude") {
289
+ throw new Error("terminal Watch supports only Codex or Claude Code");
290
+ }
291
+ return agent;
292
+ }
293
+ export function terminalWorkspace(terminal) {
294
+ const workspace = requiredString(terminal.workspace ?? terminal.cwd, "terminal workspace");
295
+ if (!path.isAbsolute(workspace)) {
296
+ throw new Error("terminal workspace must be absolute");
297
+ }
298
+ return path.resolve(workspace);
299
+ }
300
+ export function requiredWatchId(value) {
301
+ const watchId = requiredString(value, "--watch");
302
+ if (!/^terminal-watch-[A-Za-z0-9._:-]+$/u.test(watchId)) {
303
+ throw new Error("--watch must be an exact Terminal Watch id");
304
+ }
305
+ return watchId;
306
+ }
307
+ export function requiredString(value, label) {
308
+ const result = stringValue(value);
309
+ if (!result || result.includes("\0")) {
310
+ throw new Error(`${label} is required`);
311
+ }
312
+ return result;
313
+ }
314
+ export function requiredSha256(value, label) {
315
+ const result = requiredString(value, label);
316
+ if (!/^[a-f0-9]{64}$/u.test(result)) {
317
+ throw new Error(`${label} must be exactly 64 lowercase ASCII hexadecimal characters`);
318
+ }
319
+ return result;
320
+ }
321
+ export function requiredTimestamp(value, label) {
322
+ const result = requiredString(value, label);
323
+ if (!Number.isFinite(Date.parse(result))) {
324
+ throw new Error(`${label} must be a valid timestamp`);
325
+ }
326
+ return result;
327
+ }
328
+ export function parseWatchInteractionResponse(value) {
329
+ const serialized = requiredString(value, "--response-json");
330
+ try {
331
+ const parsed = JSON.parse(serialized);
332
+ if (!isRecord(parsed)) {
333
+ throw new Error("response must be an object");
334
+ }
335
+ return parsed;
336
+ }
337
+ catch (error) {
338
+ throw new Error(`--response-json is invalid: ${safeDiagnostic(error)}`);
339
+ }
340
+ }
341
+ export function assertWatchControllerSession(watch, requestedValue) {
342
+ const requested = stringValue(requestedValue);
343
+ if (!requested || requested !== watch.openclaw_session) {
344
+ throw new Error(`terminal Watch ${watch.watch_id} belongs to a different controller session; no terminal input was sent`);
345
+ }
346
+ }
347
+ export function requiredExecutableWatchInteraction(watch, interactionId, expectedFingerprint) {
348
+ if (watch.status !== "active") {
349
+ throw new Error(`terminal Watch ${watch.watch_id} is ${watch.status}`);
350
+ }
351
+ const interaction = watch.current_interaction;
352
+ if (watch.interaction_policy !== "respond_when_exact" ||
353
+ !interaction ||
354
+ interaction.aggregate.state !== "pending" ||
355
+ interaction.projection.interaction_id !== interactionId ||
356
+ interaction.projection.prompt_fingerprint !== expectedFingerprint ||
357
+ interaction.projection.response_authority !== "executable" ||
358
+ !interaction.projection.capabilities.respond) {
359
+ throw new Error("terminal Watch has no matching executable interaction offer; refresh status");
360
+ }
361
+ return interaction;
362
+ }
363
+ export function positiveInteger(value, label) {
364
+ const result = Number(value);
365
+ if (!Number.isSafeInteger(result) || result <= 0) {
366
+ throw new Error(`${label} must be a positive integer`);
367
+ }
368
+ return result;
369
+ }
370
+ export function positiveMinutes(value, fallback) {
371
+ const result = value === undefined ? fallback : Number(value);
372
+ if (!Number.isFinite(result) || result <= 0) {
373
+ throw new Error("--hard-timeout-minutes must be a positive number");
374
+ }
375
+ return result;
376
+ }
377
+ export function sha256(value) {
378
+ return createHash("sha256").update(JSON.stringify(value)).digest("hex");
379
+ }
380
+ //# sourceMappingURL=terminal-watch-terminal-identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-watch-terminal-identity.js","sourceRoot":"","sources":["../../src/terminal-watch-terminal-identity.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,OAAO,EAAE,oCAAoC,EAAE,MAAM,mCAAmC,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAE1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,OAAO,EAEL,sCAAsC,EACtC,uBAAuB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAM5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,cAAc,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAS5E,MAAM,UAAU,sCAAsC,CACpD,QAAyC,EACzC,QAAiC;IAEjC,IACE,cAAc,CAAC,QAAQ,CAAC,EAAE,EAAE,aAAa,CAAC,KAAK,QAAQ,CAAC,cAAc;QACtE,aAAa,CAAC,QAAQ,CAAC,KAAK,QAAQ,CAAC,KAAK;QAC1C,eAAe,CAAC,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC,KAAK,QAAQ,CAAC,GAAG;QAC9D,CAAC,QAAQ,CA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162.0-alpha` channel. AKK 0.13.18 also reviews the 0.159.3
5
+ foreground client because already-running clients can share the upgraded
6
+ 0.160.0 app-server.
7
+
8
+ ## Contract review
9
+
10
+ The native binaries generate byte-identical experimental TypeScript schemas
11
+ across 0.159.2, 0.159.3, and 0.160.0 (875 files), and byte-identical JSON
12
+ schemas between 0.159.3 and 0.160.0 (440 files). The official source comparison
13
+ also preserves paginated history, thread/turn identity, request-user-input,
14
+ and async-answer wire shapes. Runtime response validation remains required;
15
+ schema equality alone does not authorize a native write.
16
+
17
+ The 0.160.0 macOS Option-key hint no longer contains a plus sign:
18
+ `⌥↑ to answer`, `⌥↓ main prompt`, and `⌥↑ next question`. AKK uses a distinct
19
+ async UI profile for this grammar. Older frontends retain their old spelling;
20
+ unknown or mixed keymaps remain non-executable. The native status reader
21
+ accepts both closed display spellings without granting input authority.
22
+
23
+ Native model, permission, questionnaire, and status profiles cover 0.159.3 and
24
+ 0.160.0. The new projectless `Workspace (granular)` default is represented as
25
+ `workspace_granular`, a current-only state. Its actual native picker offers
26
+ three standard presets with no current marker. AKK may select a freshly
27
+ advertised preset; it never treats granular as Ask for approval, exposes it as
28
+ a selectable target, or accepts arbitrary custom/granular labels. New status cards may omit reasoning summaries on server connections;
29
+ this field is not an identity requirement. Plan footer hints remain display
30
+ information, not task identity.
31
+
32
+ Exact audited interaction pairs are:
33
+
34
+ | Foreground CLI | app-server | Basis |
35
+ | --- | --- | --- |
36
+ | 0.159.3 | 0.159.3 | Identical protocol and reviewed source; regression tests |
37
+ | 0.159.3 | 0.160.0 | Shared-backend upgrade pair; native verification below |
38
+ | 0.160.0 | 0.160.0 | Current stable pair; native verification below |
39
+
40
+ Existing audited older pairs remain available. The reverse 0.160.0/0.159.3
41
+ pair, 0.159.2/0.160.0, and unreviewed later pairs do not gain answer authority.
42
+ Read-only contract negotiation continues to support compatible newer backends;
43
+ a changed backend can retain exact observation, but withdraws an executable
44
+ question offer until its own fresh authority is established.
45
+
46
+ ## Verification
47
+
48
+ On 2026-10-04, isolated macOS tmux sessions ran the actual 0.159.3/0.160.0
49
+ and 0.160.0/0.160.0 foreground/backend combinations. Every launch used the
50
+ existing `mycodes` wrapper; an owned PATH shim selected the old executable for
51
+ the mixed pair. No user terminal or shared daemon was restarted.
52
+
53
+ Both pairs passed two real model turns each, through built production adapters:
54
+
55
+ - Discover the exact process and pane; capture a fresh native status/thread.
56
+ - Send once, prove exact native request acceptance, and attach an automatic
57
+ paginated task Watch.
58
+ - Attach another exact Watch while the same async task is working.
59
+ - Receive the async question callback; answer once to that exact turn, then
60
+ prove the matching durable user-message/question ID.
61
+ - Receive and answer a native Plan-mode blocking question; prove the canonical
62
+ function output before treating its answer as confirmed.
63
+ - Prove the exact native turn completed with the requested nonce and answer;
64
+ repeated reconciliation delivers exactly one completion callback per Watch.
65
+
66
+ A separate real 0.160.0 pane passed native `/status` identity, model catalog
67
+ inspection without changing its model/effort, and permission discovery followed
68
+ by Ask for approval → Full Access (including native confirmation) → Ask for
69
+ approval. Every permission result was confirmed against the same thread and
70
+ fresh status/menu, with `defaults_changed=false`. The initial read-only state
71
+ was not selectable in this platform's picker; cleanup retained the final
72
+ standard preset only in the disposable test session.
73
+
74
+ The final candidate also passed the production permission APIs starting from
75
+ an actual `Workspace (granular)` session: discovery returned only the three
76
+ standard choices, followed by granular → Full Access → Ask for approval. Both
77
+ changes had fresh same-thread status/menu confirmation and unchanged defaults;
78
+ model and effort remained unchanged. The prior invalidated Watch stayed
79
+ invalidated throughout, and no task was resent or revived.
80
+
81
+ Callbacks were collected at the production Watch transport boundary in a local
82
+ sink. This proves AKK callback generation/deduplication, not delivery to an
83
+ external chat service. The live terminal used the `shift+arrow` keymap; the new
84
+ macOS Option spelling and Plan-cycle hint have official-source and regression
85
+ coverage, not live-keymap coverage. Herdr transport, remote endpoints, other
86
+ platforms, native model-setting commits, and command approval prompts were not
87
+ newly exercised live in this review.
88
+
89
+ An initial isolated attempt exposed the existing strict cwd boundary: macOS
90
+ `/var/...` was later persisted as `/private/var/...`, so its Watch was correctly
91
+ invalidated and was not revived or resent. Passing runs used physical canonical
92
+ workspace paths from launch. Launching through other symlink paths can still
93
+ encounter this conservative identity limitation.
94
+
95
+ `npm run test:fast` passed 2,464 tests; type checking, build, and architecture
96
+ validation passed. The immediate pre-publication `npm run test:release` gate
97
+ passed 2,979 tests, isolated OpenClaw 2026.9.1 compatibility (24 tools,
98
+ callback delivery, install/update/uninstall), ClawHub runtime validation, and
99
+ publication dry-run. The general native lifecycle smoke was not run because
100
+ paginated new/resume remains outside the supported path; the targeted native
101
+ proof above covers this release's actual task and permission paths.
102
+
103
+ ## Retained boundaries
104
+
105
+ - Ordinary List/Status reads live terminal activity. Without an existing exact
106
+ anchor it does not invent a native task identity, type `/status`, or create a
107
+ Watch. A same-workspace history guess cannot prove task completion.
108
+ - Exact Send/Watch preparation uses the existing locked native status
109
+ transaction, then validates the native thread, turn, request, and durable
110
+ completion. Compatible reads do not bypass input-owning modal or styled
111
+ Composer checks.
112
+ - A first Watch on an already-blocking question without a prior task anchor
113
+ remains activity-only/manual-response. Safe fallback is explicitly labeled
114
+ `terminal_activity`; idle is not proof of task completion.
115
+ - Paginated managed session-only dispatch and native new/resume remain outside
116
+ this adapter. The upstream permission-resume changes do not enable them.
117
+ - No existing user TUI or shared daemon needs to restart for installation.
118
+ Updating the CLI changes future launches; running processes retain their
119
+ loaded version. Explicit restarts must preserve the wrapper and exact UUID.
120
+
121
+ ## Sources
122
+
123
+ - [Official 0.160.0 release](https://github.com/openai/codex/releases/tag/rust-v0.160.0)
124
+ - [Official app-server documentation](https://learn.chatgpt.com/docs/app-server)
125
+ - [0.159.2 to 0.159.3 source comparison](https://github.com/openai/codex/compare/rust-v0.159.2...rust-v0.159.3)
126
+ - [0.159.3 to 0.160.0 source comparison](https://github.com/openai/codex/compare/rust-v0.159.3...rust-v0.160.0)
@@ -21,6 +21,14 @@ For example, `ask_for_approval` may be available on a given Codex build. A mode
21
21
  reported as current is not necessarily selectable: macOS can report `read_only`
22
22
  while omitting it from its menu. Named/custom profiles are not supported.
23
23
 
24
+ Codex 0.160.0 can start a local folder outside a project with
25
+ `Workspace (granular)` permissions. AKK reports this as `workspace_granular`,
26
+ which describes the current state only; it cannot be selected. The native menu
27
+ may offer its usual standard modes without marking any of them current. Choose
28
+ an advertised mode to switch from this state. AKK verifies the new mode through
29
+ a fresh status and the reopened menu's current marker on the same native thread.
30
+ Other custom or unknown permission states remain unsupported.
31
+
24
32
  The corresponding tools are:
25
33
 
26
34
  ```text
@@ -47,7 +55,7 @@ before permission inspection; AKK does not interrupt its task to open the menu.
47
55
 
48
56
  ## Compatibility and verification
49
57
 
50
- The permission-write profile currently covers Codex 0.159.2 and 0.159.3. It is
58
+ The permission-write profile currently covers Codex 0.159.2, 0.159.3, and 0.160.0. It is
51
59
  independent of native model selection, task observation, and interaction-write
52
60
  profiles. Unsupported versions, named/custom profiles, disabled or incomplete
53
61
  menus, and conflicting native status stop the operation before a permission
@@ -93,3 +101,6 @@ JavaScript files and bundled Skill match the user-tested candidate; only release
93
101
  metadata, verification documentation, and an older action-list test changed
94
102
  after that candidate. The optional general native lifecycle smoke was not rerun;
95
103
  the permission-specific live coverage and remaining limits are listed above.
104
+
105
+ For the 0.160.0 source review, current native verification, and remaining
106
+ boundaries, see [Codex 0.160.0 compatibility](codex-0.160.0-compatibility.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scotthuang/agent-knock-knock",
3
- "version": "0.13.16",
3
+ "version": "0.13.18",
4
4
  "description": "Control local Codex and Claude Code from OpenClaw or compatible controller Hosts through shared terminals.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -92,7 +92,8 @@
92
92
  "docs/codex-0.159.2-compatibility.md",
93
93
  "docs/claude-2.1.285-compatibility.md",
94
94
  "docs/callback-compatibility.md",
95
- "docs/codex-permissions.md"
95
+ "docs/codex-permissions.md",
96
+ "docs/codex-0.160.0-compatibility.md"
96
97
  ],
97
98
  "publishConfig": {
98
99
  "access": "public"
@@ -117,7 +117,7 @@ Approval attention is notification-only for every Watch: never call an approval
117
117
 
118
118
  The current integrations register the complete capability-handshake-verified semantic AKK tool catalog and list action-contract v30. Structured OpenClaw, Pi, and DeepSeek Harness Lists use compact projection v1 and point here for the static contract; the CLI keeps the complete operator/debug action contract. Every structured model action carries semantic IDs only; opaque fences, Composer digests, and draft text are derived or retained privately. Watch uses `agent_knock_knock_watch({terminal_id})`, `agent_knock_knock_status({watch_id})`, and `agent_knock_knock_unwatch({watch_id})`; its internal CLI boundary is `watch-terminal`, `watch-status`, `unwatch-terminal`, and `reconcile-watches`.
119
119
 
120
- For Codex permission changes, first call `agent_knock_knock_permission_options({terminal_id})` from the current row’s advertised action. This sends closed `/status` and `/permissions` inspection input but leaves permissions unchanged; the terminal must be idle, its Composer empty, and its physical and native thread identities verifiable. Use `current`, `scope`, and the returned choice descriptions to select the requested or authorized mode. Then call `agent_knock_knock_set_permissions({terminal_id,mode})` using its exact returned semantic ID in the same controller conversation. Full Access is an ordinary option and needs no additional user confirmation. AKK automatically handles its exact native confirmation inside this permission transaction; do not pause to ask the user to confirm Full Access or call generic `approve` for that dialog. Ordinary Send does not change permissions. Only currently displayed built-in modes are supported: do not invent `read_only` when the picker omits it, supply a named/custom profile, or pass commands, labels, menu indexes, keys, tokens, or scope overrides. Changes affect the current session/thread, may be retained on Resume, and leave global defaults unchanged. Send the intended task only after `outcome="changed"` or `"already_effective"` with matching `effective.mode`; `"uncertain"` means stop and do not retry automatically. Refresh the catalog after any change or consumed attempt.
120
+ For Codex permission changes, first call `agent_knock_knock_permission_options({terminal_id})` from the current row’s advertised action. This sends closed `/status` and `/permissions` inspection input but leaves permissions unchanged; the terminal must be idle, its Composer empty, and its physical and native thread identities verifiable. Use `current`, `scope`, and the returned choice descriptions to select the requested or authorized mode. Then call `agent_knock_knock_set_permissions({terminal_id,mode})` using its exact returned semantic ID in the same controller conversation. Full Access is an ordinary option and needs no additional user confirmation. AKK automatically handles its exact native confirmation inside this permission transaction; do not pause to ask the user to confirm Full Access or call generic `approve` for that dialog. Ordinary Send does not change permissions. Codex 0.160 may report `current="workspace_granular"`; this is a current-only native default, not a selectable mode. Select only an ID actually returned in `choices`. Only currently displayed built-in modes are supported: do not invent `read_only` when the picker omits it, supply a named/custom profile, or pass commands, labels, menu indexes, keys, tokens, or scope overrides. Changes affect the current session/thread, may be retained on Resume, and leave global defaults unchanged. Send the intended task only after `outcome="changed"` or `"already_effective"` with matching `effective.mode`; `"uncertain"` means stop and do not retry automatically. Refresh the catalog after any change or consumed attempt.
121
121
 
122
122
  For native model control, first call `agent_knock_knock_model_options({terminal_id})` only from the current terminal row's advertised action. This is explicit current-snapshot authority for one exact physical pane/process: Profiled Codex 0.154.0/0.155.1 may use either one exact current native Session or a verified-zero-rollout pane, where `identify_foreground` is diagnostic rather than a prerequisite; Claude Code still requires one exact current native Session. The pane must have no active Turn, approval, questionnaire/editor, or read-only viewer. It normally requires an idle empty Composer; when List advertises `model_options` for one exact stable profiled Codex 0.154.0/0.155.1 `/model` residual, AKK may continue only that residual into read-only catalog discovery. Show the returned `scope`, current selection, and semantic model/effort catalog to the user. Then call `agent_knock_knock_set_model({terminal_id,model,reasoning_effort})` with an exact required tuple from that same result in the same controller conversation. Codex scope is always `current_and_new_sessions`: a successful selection persists the model and an ordinary effort (including `max`) for future sessions, but `ultra` is current-session-only and Codex chooses a non-Ultra future fallback. Always read `effective` and `new_session_defaults` separately. Claude Code scope is always `current_session`. There is no caller-selectable scope. Never pass a display label, menu index, slash command, raw key, token, or fingerprint. A stale or consumed catalog must be refreshed, and `outcome="uncertain"` must never be retried automatically.
123
123
 
@@ -134,7 +134,7 @@ success; never retry an uncertain repair automatically.
134
134
  For native status inspection:
135
135
 
136
136
  1. Use only a current `available_actions.native_inspect({terminal_id,inspection:"status"})` entry. Those semantic arguments are complete; never add a command or authority field.
137
- 2. Regression-tested profiles are Codex 0.146.0/0.146.1/0.147.0/0.148.0/0.149.1/0.150.1/0.151.0/0.153.0/0.153.4/0.154.0/0.155.1/0.158.0/0.159.0/0.159.2 and Claude Code 2.1.218/2.1.226/2.1.237/2.1.251/2.1.259/2.1.263/2.1.266/2.1.267/2.1.285 `inspection="status"`. Other complete `x.y.z` versions remain callable through the generic runtime profile and add a compatibility warning; actual incompatible UI or schema evidence fails at runtime and is not automatically retried. Claude success includes parsing and safely dismissing the newly opened Status panel. The inspection tool does not accept `/status` text or any arbitrary command string. `/usage`, `/cost`, `/stats`, `/usage-credits`, raw `/model`, `/compact`, and arbitrary slash commands remain unavailable; model changes use only the typed model-control tools above. Never automate bare Codex `/usage`: it opens an interactive menu whose later Enter can select an account-side usage-limit reset.
137
+ 2. Regression-tested profiles are Codex 0.146.0/0.146.1/0.147.0/0.148.0/0.149.1/0.150.1/0.151.0/0.153.0/0.153.4/0.154.0/0.155.1/0.158.0/0.159.0/0.159.2/0.159.3/0.160.0 and Claude Code 2.1.218/2.1.226/2.1.237/2.1.251/2.1.259/2.1.263/2.1.266/2.1.267/2.1.285 `inspection="status"`. Other complete `x.y.z` versions remain callable through the generic runtime profile and add a compatibility warning; actual incompatible UI or schema evidence fails at runtime and is not automatically retried. Claude success includes parsing and safely dismissing the newly opened Status panel. The inspection tool does not accept `/status` text or any arbitrary command string. `/usage`, `/cost`, `/stats`, `/usage-credits`, raw `/model`, `/compact`, and arbitrary slash commands remain unavailable; model changes use only the typed model-control tools above. Never automate bare Codex `/usage`: it opens an interactive menu whose later Enter can select an account-side usage-limit reset.
138
138
  3. Treat this as terminal input even though the native command is read-only. AKK privately derives a fresh binding fence and requires an idle empty composer, exact PID/process/pane/cwd/version identity, and no conflicting Turn, transition, dispatch, approval, or owner.
139
139
  4. Codex `/status` requires an exact viewport of at least 80 columns so the full Session UUID can be proven. That pre-UUID gate applies to native inspection, lifecycle, and strict Session operations that must know the UUID before terminal input. Legacy terminal-scoped ordinary tasks may send once and bind from exact native acceptance afterward without running `/status` or failing merely because the pane is narrow. Codex paginated read-contract candidates attempt their separate closed `/status` binding before physical Send. If an exact callback Watch cannot be prepared safely, AKK may prepare terminal-activity observation; report the receipt's actual callback mode and limitation.
140
140
  5. The result is valid only when AKK proves one fresh bounded native status result and the pane returns to idle. On an uncertain or unproven submission, do not retry, send Enter, clear the composer, or bypass AKK with raw terminal input.
@@ -236,7 +236,7 @@ Action-name glossary:
236
236
 
237
237
  - `status`: inspect one terminal, Turn, or Watch; it sends no native slash command.
238
238
  - `send`: deliver a new request, or perform the separately advertised immutable `retry_submission` form.
239
- - `watch` / `unwatch`: create or stop durable terminal observation; Codex 0.158.0/0.159.0/0.159.2 exact creation performs the closed `/status` transaction, while subsequent observation is read-only.
239
+ - `watch` / `unwatch`: create or stop durable terminal observation; Codex 0.158.0/0.159.0/0.159.2/0.159.3/0.160.0 exact creation performs the closed `/status` transaction, while subsequent observation is read-only.
240
240
  - `list_resumable_threads`, `new_thread`, and `resume_thread`: inspect or change native thread context through their closed lifecycle protocols.
241
241
  - `native_inspect`: run only an advertised closed native inspection such as `status`.
242
242
  - `model_options`, `repair_model_control`, and `set_model`: discover the current native catalog, clear only a proven model-control residue, or consume one catalog offer.