codex-chatgpt-control 0.5.1-alpha.2 → 0.5.1-alpha.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 (231) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +43 -0
  3. package/contracts/v1/fixtures/backend-capabilities.json +40 -1
  4. package/contracts/v1/fixtures/backend-compatibility.json +21 -0
  5. package/contracts/v1/fixtures/backend-version.json +6 -1
  6. package/contracts/v1/fixtures/download-blocked-by-browser.json +22 -0
  7. package/contracts/v1/fixtures/download-receipt-failed.json +22 -0
  8. package/contracts/v1/fixtures/download-receipt-timeout.json +22 -0
  9. package/contracts/v1/fixtures/journal-rpc-indeterminate.json +32 -0
  10. package/contracts/v1/fixtures/journal-rpc-unsupported-platform.json +32 -0
  11. package/contracts/v1/fixtures/journal-runtime-unavailable.json +32 -0
  12. package/contracts/v1/fixtures/operation-action-prepared-event.json +42 -0
  13. package/contracts/v1/fixtures/operation-action.json +13 -0
  14. package/contracts/v1/fixtures/operation-artifact-receipt.json +14 -0
  15. package/contracts/v1/fixtures/operation-artifact-transfer-intent-event.json +24 -0
  16. package/contracts/v1/fixtures/operation-artifact-transfer-receipt-event.json +26 -0
  17. package/contracts/v1/fixtures/operation-artifact-transfer-state.json +178 -0
  18. package/contracts/v1/fixtures/operation-blocker.json +10 -0
  19. package/contracts/v1/fixtures/operation-collect-request.json +17 -0
  20. package/contracts/v1/fixtures/operation-collect-result.json +42 -0
  21. package/contracts/v1/fixtures/operation-control-receipt.json +13 -0
  22. package/contracts/v1/fixtures/operation-control-request.json +18 -0
  23. package/contracts/v1/fixtures/operation-control-result.json +31 -0
  24. package/contracts/v1/fixtures/operation-event.json +18 -0
  25. package/contracts/v1/fixtures/operation-handle.json +10 -0
  26. package/contracts/v1/fixtures/operation-inspect-request.json +13 -0
  27. package/contracts/v1/fixtures/operation-inspect-result.json +205 -0
  28. package/contracts/v1/fixtures/operation-ownership-baseline-event.json +34 -0
  29. package/contracts/v1/fixtures/operation-receipt.json +32 -0
  30. package/contracts/v1/fixtures/operation-recovery-decision.json +7 -0
  31. package/contracts/v1/fixtures/operation-recovery-observation.json +12 -0
  32. package/contracts/v1/fixtures/operation-request.json +33 -0
  33. package/contracts/v1/fixtures/operation-state.json +144 -0
  34. package/contracts/v1/fixtures/operation-submission-witness-event.json +20 -0
  35. package/contracts/v1/fixtures/operation-submission-witness.json +11 -0
  36. package/contracts/v1/fixtures/operation-submit-result.json +16 -0
  37. package/contracts/v1/fixtures/operation-target-established-event.json +21 -0
  38. package/contracts/v1/manifest.json +185 -1
  39. package/contracts/v1/parity-suite.json +106 -8
  40. package/contracts/v1/schemas/backend-compatibility.schema.json +65 -0
  41. package/contracts/v1/schemas/backend-request.schema.json +8 -2
  42. package/contracts/v1/schemas/capabilities.schema.json +81 -1
  43. package/contracts/v1/schemas/manifest.schema.json +57 -0
  44. package/contracts/v1/schemas/operation-action.schema.json +155 -0
  45. package/contracts/v1/schemas/operation-artifact-receipt.schema.json +89 -0
  46. package/contracts/v1/schemas/operation-blocker.schema.json +70 -0
  47. package/contracts/v1/schemas/operation-collect-request.schema.json +46 -0
  48. package/contracts/v1/schemas/operation-collect-result.schema.json +74 -0
  49. package/contracts/v1/schemas/operation-control-receipt.schema.json +108 -0
  50. package/contracts/v1/schemas/operation-control-request.schema.json +111 -0
  51. package/contracts/v1/schemas/operation-control-result.schema.json +112 -0
  52. package/contracts/v1/schemas/operation-event.schema.json +756 -0
  53. package/contracts/v1/schemas/operation-handle.schema.json +55 -0
  54. package/contracts/v1/schemas/operation-inspect-request.schema.json +42 -0
  55. package/contracts/v1/schemas/operation-inspect-result.schema.json +1662 -0
  56. package/contracts/v1/schemas/operation-receipt.schema.json +153 -0
  57. package/contracts/v1/schemas/operation-recovery.schema.json +314 -0
  58. package/contracts/v1/schemas/operation-request.schema.json +158 -0
  59. package/contracts/v1/schemas/operation-state.schema.json +691 -0
  60. package/contracts/v1/schemas/operation-submission-witness.schema.json +48 -0
  61. package/contracts/v1/schemas/operation-submit-result.schema.json +94 -0
  62. package/contracts/v1/surface-drift-policy.json +50 -0
  63. package/contracts/v1/vectors/operation-request-digest-v1.json +43 -0
  64. package/dist/codex-chatgpt-control-backend.mjs +45882 -9361
  65. package/dist/codex-chatgpt-control-journal.mjs +5547 -0
  66. package/dist/codex-chatgpt-control-live-smoke.bundle.mjs +51677 -0
  67. package/dist/codex-chatgpt-control-release-canary.bundle.mjs +52104 -0
  68. package/dist/codex-chatgpt-control.bundle.mjs +48392 -10260
  69. package/dist/src/backend/client.d.ts +103 -2
  70. package/dist/src/backend/client.js +1436 -97
  71. package/dist/src/backend/compatibility.d.ts +12 -0
  72. package/dist/src/backend/compatibility.js +208 -0
  73. package/dist/src/backend/protocol.d.ts +84 -1
  74. package/dist/src/backend/protocol.js +31 -5
  75. package/dist/src/backend/runtime-identity.d.ts +10 -0
  76. package/dist/src/backend/runtime-identity.js +141 -0
  77. package/dist/src/backend/session.d.ts +10 -2
  78. package/dist/src/backend/session.js +478 -7
  79. package/dist/src/backend/stdio-server.d.ts +4 -1
  80. package/dist/src/backend/stdio-server.js +240 -28
  81. package/dist/src/browser/active-composer-file-input.d.ts +9 -0
  82. package/dist/src/browser/active-composer-file-input.js +33 -0
  83. package/dist/src/browser/attach.d.ts +4 -1
  84. package/dist/src/browser/attach.js +136 -28
  85. package/dist/src/browser/chatgpt-url.d.ts +2 -0
  86. package/dist/src/browser/chatgpt-url.js +9 -0
  87. package/dist/src/browser/downloads.d.ts +17 -1
  88. package/dist/src/browser/downloads.js +150 -28
  89. package/dist/src/browser/page-state.js +6 -0
  90. package/dist/src/client.d.ts +43 -0
  91. package/dist/src/client.js +1279 -59
  92. package/dist/src/commands/artifacts.js +6 -4
  93. package/dist/src/commands/chat-popover.d.ts +37 -0
  94. package/dist/src/commands/chat-popover.js +537 -0
  95. package/dist/src/commands/configuration.d.ts +5 -0
  96. package/dist/src/commands/configuration.js +134 -21
  97. package/dist/src/commands/context.js +10 -3
  98. package/dist/src/commands/doctor.d.ts +1 -1
  99. package/dist/src/commands/doctor.js +27 -4
  100. package/dist/src/commands/experience.d.ts +5 -0
  101. package/dist/src/commands/experience.js +104 -21
  102. package/dist/src/commands/files.js +14 -33
  103. package/dist/src/commands/modes.js +85 -21
  104. package/dist/src/commands/power-discovery.d.ts +130 -0
  105. package/dist/src/commands/power-discovery.js +669 -0
  106. package/dist/src/commands/project-sources.js +325 -31
  107. package/dist/src/commands/sequence.js +59 -32
  108. package/dist/src/commands/session.js +19 -6
  109. package/dist/src/commands/work.js +31 -0
  110. package/dist/src/dom/composer-text.d.ts +6 -0
  111. package/dist/src/dom/composer-text.js +85 -0
  112. package/dist/src/errors.d.ts +9 -0
  113. package/dist/src/errors.js +22 -0
  114. package/dist/src/index.d.ts +6 -0
  115. package/dist/src/index.js +9 -0
  116. package/dist/src/operations/artifact-output.d.ts +69 -0
  117. package/dist/src/operations/artifact-output.js +1748 -0
  118. package/dist/src/operations/artifact-stream.d.ts +19 -0
  119. package/dist/src/operations/artifact-stream.js +35 -0
  120. package/dist/src/operations/artifact-transfer.d.ts +149 -0
  121. package/dist/src/operations/artifact-transfer.js +1312 -0
  122. package/dist/src/operations/browser-adapter.d.ts +167 -0
  123. package/dist/src/operations/browser-adapter.js +2103 -0
  124. package/dist/src/operations/browser-observation.d.ts +110 -0
  125. package/dist/src/operations/browser-observation.js +1256 -0
  126. package/dist/src/operations/browser-target.d.ts +105 -0
  127. package/dist/src/operations/browser-target.js +531 -0
  128. package/dist/src/operations/canonical.d.ts +4 -0
  129. package/dist/src/operations/canonical.js +412 -0
  130. package/dist/src/operations/chatgpt-runtime.d.ts +72 -0
  131. package/dist/src/operations/chatgpt-runtime.js +1232 -0
  132. package/dist/src/operations/client.d.ts +138 -0
  133. package/dist/src/operations/client.js +1145 -0
  134. package/dist/src/operations/collector.d.ts +195 -0
  135. package/dist/src/operations/collector.js +1039 -0
  136. package/dist/src/operations/configuration-routing.d.ts +4 -0
  137. package/dist/src/operations/configuration-routing.js +14 -0
  138. package/dist/src/operations/control.d.ts +372 -0
  139. package/dist/src/operations/control.js +1498 -0
  140. package/dist/src/operations/file-identity.d.ts +33 -0
  141. package/dist/src/operations/file-identity.js +153 -0
  142. package/dist/src/operations/handle.d.ts +19 -0
  143. package/dist/src/operations/handle.js +727 -0
  144. package/dist/src/operations/index.d.ts +25 -0
  145. package/dist/src/operations/index.js +25 -0
  146. package/dist/src/operations/journal-authority.d.ts +12 -0
  147. package/dist/src/operations/journal-authority.js +1 -0
  148. package/dist/src/operations/journal-rpc-client.d.ts +12 -0
  149. package/dist/src/operations/journal-rpc-client.js +225 -0
  150. package/dist/src/operations/journal-rpc-protocol.d.ts +32 -0
  151. package/dist/src/operations/journal-rpc-protocol.js +214 -0
  152. package/dist/src/operations/journal-rpc-server.d.ts +15 -0
  153. package/dist/src/operations/journal-rpc-server.js +272 -0
  154. package/dist/src/operations/journal.d.ts +143 -0
  155. package/dist/src/operations/journal.js +1957 -0
  156. package/dist/src/operations/production-attachments.d.ts +118 -0
  157. package/dist/src/operations/production-attachments.js +1035 -0
  158. package/dist/src/operations/production-chatgpt-artifacts.d.ts +74 -0
  159. package/dist/src/operations/production-chatgpt-artifacts.js +1146 -0
  160. package/dist/src/operations/production-chatgpt-attachments.d.ts +80 -0
  161. package/dist/src/operations/production-chatgpt-attachments.js +1639 -0
  162. package/dist/src/operations/production-configuration.d.ts +42 -0
  163. package/dist/src/operations/production-configuration.js +1544 -0
  164. package/dist/src/operations/production-primitives.d.ts +53 -0
  165. package/dist/src/operations/production-primitives.js +856 -0
  166. package/dist/src/operations/production-work-steer.d.ts +203 -0
  167. package/dist/src/operations/production-work-steer.js +1218 -0
  168. package/dist/src/operations/recovery.d.ts +80 -0
  169. package/dist/src/operations/recovery.js +174 -0
  170. package/dist/src/operations/runtime-adapter.d.ts +126 -0
  171. package/dist/src/operations/runtime-adapter.js +802 -0
  172. package/dist/src/operations/send-once.d.ts +224 -0
  173. package/dist/src/operations/send-once.js +1081 -0
  174. package/dist/src/operations/service.d.ts +286 -0
  175. package/dist/src/operations/service.js +2831 -0
  176. package/dist/src/operations/staging.d.ts +136 -0
  177. package/dist/src/operations/staging.js +630 -0
  178. package/dist/src/operations/state-machine.d.ts +29 -0
  179. package/dist/src/operations/state-machine.js +2047 -0
  180. package/dist/src/operations/submission.d.ts +423 -0
  181. package/dist/src/operations/submission.js +1676 -0
  182. package/dist/src/operations/transactional-chat-power.d.ts +17 -0
  183. package/dist/src/operations/transactional-chat-power.js +212 -0
  184. package/dist/src/operations/turn-ownership.d.ts +202 -0
  185. package/dist/src/operations/turn-ownership.js +700 -0
  186. package/dist/src/operations/types.d.ts +454 -0
  187. package/dist/src/operations/types.js +20 -0
  188. package/dist/src/operations/wire-requests.d.ts +21 -0
  189. package/dist/src/operations/wire-requests.js +396 -0
  190. package/dist/src/operations/wire-results.d.ts +97 -0
  191. package/dist/src/operations/wire-results.js +818 -0
  192. package/dist/src/runner/responses.d.ts +3 -1
  193. package/dist/src/runner/responses.js +19 -1
  194. package/dist/src/runner/result.js +227 -55
  195. package/dist/src/runner/types.d.ts +12 -0
  196. package/dist/src/runtime/command-routing.d.ts +149 -0
  197. package/dist/src/runtime/command-routing.js +431 -0
  198. package/dist/src/runtime/coordinated-browser.d.ts +24 -0
  199. package/dist/src/runtime/coordinated-browser.js +315 -0
  200. package/dist/src/runtime/coordinated-page.d.ts +41 -0
  201. package/dist/src/runtime/coordinated-page.js +651 -0
  202. package/dist/src/runtime/operation-context.d.ts +142 -0
  203. package/dist/src/runtime/operation-context.js +410 -0
  204. package/dist/src/runtime/runtime-session.d.ts +95 -0
  205. package/dist/src/runtime/runtime-session.js +314 -0
  206. package/dist/src/runtime/tab-coordinator.d.ts +200 -0
  207. package/dist/src/runtime/tab-coordinator.js +1200 -0
  208. package/dist/src/runtime/value-boundaries.d.ts +18 -0
  209. package/dist/src/runtime/value-boundaries.js +49 -0
  210. package/dist/src/safety/blockers.js +8 -1
  211. package/dist/src/safety/untrusted-output.js +2 -1
  212. package/dist/src/scripts/backend-server.js +4 -1
  213. package/dist/src/scripts/capture-surface-profile.js +7 -2
  214. package/dist/src/scripts/journal-server.d.ts +2 -0
  215. package/dist/src/scripts/journal-server.js +37 -0
  216. package/dist/src/scripts/live-smoke/harness.js +79 -7
  217. package/dist/src/scripts/live-smoke/scenarios.d.ts +42 -1
  218. package/dist/src/scripts/live-smoke/scenarios.js +147 -30
  219. package/dist/src/scripts/live-smoke/transactional.d.ts +17 -0
  220. package/dist/src/scripts/live-smoke/transactional.js +254 -0
  221. package/dist/src/scripts/live-smoke/types.d.ts +3 -0
  222. package/dist/src/scripts/release-canary-module.js +17 -4
  223. package/dist/src/types.d.ts +38 -1
  224. package/package.json +8 -3
  225. package/references/2026-08-16-transactional-operations.md +459 -0
  226. package/references/2026-09-06-journal-service.md +140 -0
  227. package/references/agents-runner.md +34 -0
  228. package/references/backend-protocol.md +176 -0
  229. package/references/python-parity.md +137 -0
  230. package/references/responses-adapter.md +19 -0
  231. package/references/streaming.md +6 -0
@@ -0,0 +1,153 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://local.codex-chatgpt-control/contracts/v1/schemas/operation-receipt.schema.json",
4
+ "title": "Transactional browser operation receipt",
5
+ "description": "A durable terminal receipt containing ownership digests and transfer metadata, never raw response or file content.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schemaVersion",
10
+ "operationId",
11
+ "requestDigest",
12
+ "targetBindingDigest",
13
+ "userTurnId",
14
+ "userTurnEvidenceDigest",
15
+ "assistantTurnId",
16
+ "ownershipEvidenceDigest",
17
+ "finishReason",
18
+ "contentAvailable",
19
+ "artifacts",
20
+ "completedAt"
21
+ ],
22
+ "properties": {
23
+ "schemaVersion": { "const": "chatgpt.browser_control.operation_receipt.v1" },
24
+ "operationId": { "$ref": "#/$defs/uuid" },
25
+ "requestDigest": { "$ref": "#/$defs/digest" },
26
+ "targetBindingDigest": { "$ref": "#/$defs/digest" },
27
+ "userTurnId": { "$ref": "#/$defs/opaqueId" },
28
+ "userTurnEvidenceDigest": { "$ref": "#/$defs/digest" },
29
+ "assistantTurnId": { "$ref": "#/$defs/opaqueId" },
30
+ "ownershipEvidenceDigest": { "$ref": "#/$defs/digest" },
31
+ "responseDigest": { "$ref": "#/$defs/digest" },
32
+ "responseBytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
33
+ "responseFormat": { "enum": ["markdown", "text"] },
34
+ "finishReason": {
35
+ "type": "string",
36
+ "minLength": 1,
37
+ "maxLength": 128,
38
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
39
+ },
40
+ "contentAvailable": { "type": "boolean" },
41
+ "artifacts": {
42
+ "type": "array",
43
+ "items": { "$ref": "#/$defs/artifact" },
44
+ "maxItems": 32
45
+ },
46
+ "completedAt": { "$ref": "#/$defs/instant" }
47
+ },
48
+ "dependentRequired": {
49
+ "responseDigest": ["responseBytes"],
50
+ "responseBytes": ["responseDigest"]
51
+ },
52
+ "allOf": [
53
+ {
54
+ "if": { "properties": { "contentAvailable": { "const": true } }, "required": ["contentAvailable"] },
55
+ "then": {
56
+ "required": ["responseDigest", "responseBytes"],
57
+ "properties": {
58
+ "responseDigest": { "$ref": "#/$defs/digest" },
59
+ "responseBytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }
60
+ }
61
+ }
62
+ }
63
+ ],
64
+ "$defs": {
65
+ "uuid": {
66
+ "type": "string",
67
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
68
+ },
69
+ "digest": {
70
+ "type": "string",
71
+ "pattern": "^hmac-sha256:[0-9a-f]{64}$"
72
+ },
73
+ "instant": {
74
+ "type": "string",
75
+ "pattern": "^(?!\\d{4}-02-(?:30|31)T)(?!\\d{4}-(?:04|06|09|11)-31T)\\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\\d|3[01])T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}Z$"
76
+ },
77
+ "opaqueId": {
78
+ "type": "string",
79
+ "minLength": 1,
80
+ "maxLength": 512,
81
+ "pattern": "^(?=.*\\S)[^\\u0000-\\u001f\\u007f]{1,512}$"
82
+ },
83
+ "artifact": {
84
+ "type": "object",
85
+ "additionalProperties": false,
86
+ "required": ["schemaVersion", "operationId", "artifactKey", "assistantTurnId", "sourceIdentityDigest", "kind", "ordinal", "status"],
87
+ "properties": {
88
+ "schemaVersion": { "const": "chatgpt.browser_control.operation_artifact_receipt.v1" },
89
+ "operationId": { "$ref": "#/$defs/uuid" },
90
+ "artifactKey": { "$ref": "#/$defs/opaqueKey" },
91
+ "assistantTurnId": { "$ref": "#/$defs/opaqueId" },
92
+ "sourceIdentityDigest": { "$ref": "#/$defs/digest" },
93
+ "kind": { "enum": ["file", "image", "other"] },
94
+ "ordinal": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
95
+ "outputKey": { "$ref": "#/$defs/outputKey" },
96
+ "mimeType": {
97
+ "type": "string",
98
+ "minLength": 1,
99
+ "maxLength": 127,
100
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9!#$&^_.+/-]{0,126}$"
101
+ },
102
+ "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
103
+ "sha256": { "$ref": "#/$defs/sha256" },
104
+ "status": { "enum": ["available", "transferred", "partial", "blocked"] },
105
+ "blockerCode": { "$ref": "#/$defs/code" }
106
+ },
107
+ "allOf": [
108
+ {
109
+ "if": { "properties": { "status": { "const": "transferred" } }, "required": ["status"] },
110
+ "then": {
111
+ "required": ["outputKey", "bytes", "sha256"],
112
+ "properties": {
113
+ "outputKey": { "$ref": "#/$defs/outputKey" },
114
+ "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
115
+ "sha256": { "$ref": "#/$defs/sha256" }
116
+ }
117
+ }
118
+ },
119
+ {
120
+ "if": { "properties": { "status": { "enum": ["partial", "blocked"] } }, "required": ["status"] },
121
+ "then": {
122
+ "required": ["blockerCode"],
123
+ "properties": { "blockerCode": { "$ref": "#/$defs/code" } }
124
+ }
125
+ },
126
+ {
127
+ "if": { "properties": { "status": { "enum": ["available", "transferred"] } }, "required": ["status"] },
128
+ "then": { "not": { "required": ["blockerCode"] } }
129
+ }
130
+ ]
131
+ },
132
+ "opaqueKey": {
133
+ "type": "string",
134
+ "minLength": 1,
135
+ "maxLength": 128,
136
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
137
+ },
138
+ "outputKey": {
139
+ "type": "string",
140
+ "minLength": 1,
141
+ "maxLength": 128,
142
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$"
143
+ },
144
+ "sha256": {
145
+ "type": "string",
146
+ "pattern": "^[0-9a-f]{64}$"
147
+ },
148
+ "code": {
149
+ "type": "string",
150
+ "pattern": "^[a-z][a-z0-9_]{0,63}$"
151
+ }
152
+ }
153
+ }
@@ -0,0 +1,314 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://local.codex-chatgpt-control/contracts/v1/schemas/operation-recovery.schema.json",
4
+ "title": "Transactional browser operation recovery observation or decision",
5
+ "description": "Collect-only recovery is represented as an observation or an explicit non-repeating decision. No branch authorizes replay after a durable mutation intent.",
6
+ "oneOf": [
7
+ { "$ref": "#/$defs/observation" },
8
+ { "$ref": "#/$defs/decision" }
9
+ ],
10
+ "$defs": {
11
+ "uuid": {
12
+ "type": "string",
13
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
14
+ },
15
+ "digest": {
16
+ "type": "string",
17
+ "pattern": "^hmac-sha256:[0-9a-f]{64}$"
18
+ },
19
+ "opaqueId": {
20
+ "type": "string",
21
+ "minLength": 1,
22
+ "maxLength": 512,
23
+ "pattern": "^(?=.*\\S)[^\\u0000-\\u001f\\u007f]{1,512}$"
24
+ },
25
+ "actionKind": {
26
+ "enum": [
27
+ "status_read",
28
+ "configuration_set",
29
+ "tool_set",
30
+ "composer_set",
31
+ "power_discovery",
32
+ "power_select",
33
+ "file_handoff",
34
+ "send",
35
+ "work_steer",
36
+ "stop",
37
+ "download",
38
+ "local_output_commit",
39
+ "clipboard_capture_restore"
40
+ ]
41
+ },
42
+ "observation": {
43
+ "type": "object",
44
+ "additionalProperties": false,
45
+ "required": ["schemaVersion", "target", "turn"],
46
+ "properties": {
47
+ "schemaVersion": { "const": "chatgpt.browser_control.operation_recovery_observation.v1" },
48
+ "target": { "$ref": "#/$defs/targetObservation" },
49
+ "turn": { "$ref": "#/$defs/turnObservation" }
50
+ }
51
+ },
52
+ "targetObservation": {
53
+ "oneOf": [
54
+ {
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "required": ["status"],
58
+ "properties": { "status": { "const": "matches" } }
59
+ },
60
+ {
61
+ "type": "object",
62
+ "additionalProperties": false,
63
+ "required": ["status"],
64
+ "properties": {
65
+ "status": { "const": "mismatch" },
66
+ "evidenceDigest": { "$ref": "#/$defs/digest" }
67
+ }
68
+ },
69
+ {
70
+ "type": "object",
71
+ "additionalProperties": false,
72
+ "required": ["status"],
73
+ "properties": {
74
+ "status": { "const": "unavailable" },
75
+ "evidenceDigest": { "$ref": "#/$defs/digest" }
76
+ }
77
+ }
78
+ ]
79
+ },
80
+ "turnObservation": {
81
+ "oneOf": [
82
+ {
83
+ "type": "object",
84
+ "additionalProperties": false,
85
+ "required": ["status"],
86
+ "properties": { "status": { "const": "not_observed" } }
87
+ },
88
+ {
89
+ "type": "object",
90
+ "additionalProperties": false,
91
+ "required": ["status", "userTurnId", "evidenceDigest"],
92
+ "properties": {
93
+ "status": { "const": "owned_user_turn" },
94
+ "userTurnId": { "$ref": "#/$defs/opaqueId" },
95
+ "evidenceDigest": { "$ref": "#/$defs/digest" }
96
+ }
97
+ },
98
+ {
99
+ "type": "object",
100
+ "additionalProperties": false,
101
+ "required": ["status", "userTurnId", "assistantTurnId", "evidenceDigest"],
102
+ "properties": {
103
+ "status": { "const": "owned_assistant_generating" },
104
+ "userTurnId": { "$ref": "#/$defs/opaqueId" },
105
+ "assistantTurnId": { "$ref": "#/$defs/opaqueId" },
106
+ "evidenceDigest": { "$ref": "#/$defs/digest" }
107
+ }
108
+ },
109
+ {
110
+ "type": "object",
111
+ "additionalProperties": false,
112
+ "required": ["status", "userTurnId", "assistantTurnId", "evidenceDigest"],
113
+ "properties": {
114
+ "status": { "const": "owned_assistant_terminal" },
115
+ "userTurnId": { "$ref": "#/$defs/opaqueId" },
116
+ "assistantTurnId": { "$ref": "#/$defs/opaqueId" },
117
+ "evidenceDigest": { "$ref": "#/$defs/digest" }
118
+ }
119
+ },
120
+ {
121
+ "type": "object",
122
+ "additionalProperties": false,
123
+ "required": ["status"],
124
+ "properties": {
125
+ "status": { "const": "ambiguous" },
126
+ "evidenceDigest": { "$ref": "#/$defs/digest" }
127
+ }
128
+ }
129
+ ]
130
+ },
131
+ "decision": {
132
+ "oneOf": [
133
+ {
134
+ "type": "object",
135
+ "additionalProperties": false,
136
+ "required": ["schemaVersion", "kind", "receipt"],
137
+ "properties": {
138
+ "schemaVersion": { "const": "chatgpt.browser_control.operation_recovery_decision.v1" },
139
+ "kind": { "const": "return_completed_receipt" },
140
+ "receipt": { "$ref": "#/$defs/receipt" }
141
+ }
142
+ },
143
+ {
144
+ "type": "object",
145
+ "additionalProperties": false,
146
+ "required": ["schemaVersion", "kind", "phase", "nonRepeatableActionMayStart"],
147
+ "properties": {
148
+ "schemaVersion": { "const": "chatgpt.browser_control.operation_recovery_decision.v1" },
149
+ "kind": { "const": "continue_preparation" },
150
+ "phase": { "enum": ["prepared", "ready"] },
151
+ "nonRepeatableActionMayStart": { "const": true }
152
+ }
153
+ },
154
+ {
155
+ "type": "object",
156
+ "additionalProperties": false,
157
+ "required": ["schemaVersion", "kind", "actionId", "actionKind", "mayRepeatAction"],
158
+ "properties": {
159
+ "schemaVersion": { "const": "chatgpt.browser_control.operation_recovery_decision.v1" },
160
+ "kind": { "const": "observe_action_postcondition" },
161
+ "actionId": { "$ref": "#/$defs/uuid" },
162
+ "actionKind": { "$ref": "#/$defs/actionKind" },
163
+ "mayRepeatAction": { "const": false }
164
+ }
165
+ },
166
+ {
167
+ "type": "object",
168
+ "additionalProperties": false,
169
+ "required": ["schemaVersion", "kind", "phase"],
170
+ "properties": {
171
+ "schemaVersion": { "const": "chatgpt.browser_control.operation_recovery_decision.v1" },
172
+ "kind": { "const": "continue_owned_turn_observation" },
173
+ "phase": { "enum": ["submitted", "generating"] },
174
+ "userTurnId": { "$ref": "#/$defs/opaqueId" },
175
+ "assistantTurnId": { "$ref": "#/$defs/opaqueId" },
176
+ "evidenceDigest": { "$ref": "#/$defs/digest" }
177
+ }
178
+ },
179
+ {
180
+ "type": "object",
181
+ "additionalProperties": false,
182
+ "required": ["schemaVersion", "kind", "assistantTurnId", "evidenceDigest"],
183
+ "properties": {
184
+ "schemaVersion": { "const": "chatgpt.browser_control.operation_recovery_decision.v1" },
185
+ "kind": { "const": "capture_owned_turn" },
186
+ "assistantTurnId": { "$ref": "#/$defs/opaqueId" },
187
+ "evidenceDigest": { "$ref": "#/$defs/digest" }
188
+ }
189
+ },
190
+ {
191
+ "type": "object",
192
+ "additionalProperties": false,
193
+ "required": ["schemaVersion", "kind", "code", "mayRepeatAction"],
194
+ "properties": {
195
+ "schemaVersion": { "const": "chatgpt.browser_control.operation_recovery_decision.v1" },
196
+ "kind": { "const": "enter_uncertain" },
197
+ "code": { "enum": ["target_evidence_unavailable", "turn_ownership_ambiguous", "capture_ownership_lost"] },
198
+ "mayRepeatAction": { "const": false }
199
+ }
200
+ },
201
+ {
202
+ "type": "object",
203
+ "additionalProperties": false,
204
+ "required": ["schemaVersion", "kind", "code", "mayRepeatAction"],
205
+ "properties": {
206
+ "schemaVersion": { "const": "chatgpt.browser_control.operation_recovery_decision.v1" },
207
+ "kind": { "const": "block" },
208
+ "code": { "enum": ["target_binding_mismatch", "target_evidence_unavailable", "operation_state_inconsistent"] },
209
+ "mayRepeatAction": { "const": false }
210
+ }
211
+ }
212
+ ]
213
+ },
214
+ "receipt": {
215
+ "type": "object",
216
+ "additionalProperties": false,
217
+ "required": [
218
+ "schemaVersion",
219
+ "operationId",
220
+ "requestDigest",
221
+ "targetBindingDigest",
222
+ "userTurnId",
223
+ "userTurnEvidenceDigest",
224
+ "assistantTurnId",
225
+ "ownershipEvidenceDigest",
226
+ "finishReason",
227
+ "contentAvailable",
228
+ "artifacts",
229
+ "completedAt"
230
+ ],
231
+ "properties": {
232
+ "schemaVersion": { "const": "chatgpt.browser_control.operation_receipt.v1" },
233
+ "operationId": { "$ref": "#/$defs/uuid" },
234
+ "requestDigest": { "$ref": "#/$defs/digest" },
235
+ "targetBindingDigest": { "$ref": "#/$defs/digest" },
236
+ "userTurnId": { "$ref": "#/$defs/opaqueId" },
237
+ "userTurnEvidenceDigest": { "$ref": "#/$defs/digest" },
238
+ "assistantTurnId": { "$ref": "#/$defs/opaqueId" },
239
+ "ownershipEvidenceDigest": { "$ref": "#/$defs/digest" },
240
+ "responseDigest": { "$ref": "#/$defs/digest" },
241
+ "responseBytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
242
+ "responseFormat": { "enum": ["markdown", "text"] },
243
+ "finishReason": { "type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$" },
244
+ "contentAvailable": { "type": "boolean" },
245
+ "artifacts": { "type": "array", "items": { "$ref": "#/$defs/artifact" }, "maxItems": 32 },
246
+ "completedAt": { "$ref": "#/$defs/instant" }
247
+ },
248
+ "dependentRequired": {
249
+ "responseDigest": ["responseBytes"],
250
+ "responseBytes": ["responseDigest"]
251
+ },
252
+ "allOf": [
253
+ {
254
+ "if": { "properties": { "contentAvailable": { "const": true } }, "required": ["contentAvailable"] },
255
+ "then": {
256
+ "required": ["responseDigest", "responseBytes"],
257
+ "properties": {
258
+ "responseDigest": { "$ref": "#/$defs/digest" },
259
+ "responseBytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }
260
+ }
261
+ }
262
+ }
263
+ ]
264
+ },
265
+ "artifact": {
266
+ "type": "object",
267
+ "additionalProperties": false,
268
+ "required": ["schemaVersion", "operationId", "artifactKey", "assistantTurnId", "sourceIdentityDigest", "kind", "ordinal", "status"],
269
+ "properties": {
270
+ "schemaVersion": { "const": "chatgpt.browser_control.operation_artifact_receipt.v1" },
271
+ "operationId": { "$ref": "#/$defs/uuid" },
272
+ "artifactKey": { "type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$" },
273
+ "assistantTurnId": { "$ref": "#/$defs/opaqueId" },
274
+ "sourceIdentityDigest": { "$ref": "#/$defs/digest" },
275
+ "kind": { "enum": ["file", "image", "other"] },
276
+ "ordinal": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
277
+ "outputKey": { "type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$" },
278
+ "mimeType": { "type": "string", "minLength": 1, "maxLength": 127, "pattern": "^[A-Za-z0-9][A-Za-z0-9!#$&^_.+/-]{0,126}$" },
279
+ "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
280
+ "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
281
+ "status": { "enum": ["available", "transferred", "partial", "blocked"] },
282
+ "blockerCode": { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,63}$" }
283
+ },
284
+ "allOf": [
285
+ {
286
+ "if": { "properties": { "status": { "const": "transferred" } }, "required": ["status"] },
287
+ "then": {
288
+ "required": ["outputKey", "bytes", "sha256"],
289
+ "properties": {
290
+ "outputKey": { "type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$" },
291
+ "bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
292
+ "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
293
+ }
294
+ }
295
+ },
296
+ {
297
+ "if": { "properties": { "status": { "enum": ["partial", "blocked"] } }, "required": ["status"] },
298
+ "then": {
299
+ "required": ["blockerCode"],
300
+ "properties": { "blockerCode": { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,63}$" } }
301
+ }
302
+ },
303
+ {
304
+ "if": { "properties": { "status": { "enum": ["available", "transferred"] } }, "required": ["status"] },
305
+ "then": { "not": { "required": ["blockerCode"] } }
306
+ }
307
+ ]
308
+ },
309
+ "instant": {
310
+ "type": "string",
311
+ "pattern": "^(?!\\d{4}-02-(?:30|31)T)(?!\\d{4}-(?:04|06|09|11)-31T)\\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\\d|3[01])T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}Z$"
312
+ }
313
+ }
314
+ }
@@ -0,0 +1,158 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://local.codex-chatgpt-control/contracts/v1/schemas/operation-request.schema.json",
4
+ "title": "Transactional browser operation submit request",
5
+ "description": "The request-only submit shape. prompt, input file paths, display names, and outputDirectory are accepted transient inputs and must not be copied into durable operation state.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schemaVersion", "operationId", "surface", "prompt", "target"],
9
+ "properties": {
10
+ "schemaVersion": { "const": "chatgpt.browser_control.operation_request.v1" },
11
+ "operationId": { "$ref": "#/$defs/uuid" },
12
+ "surface": { "enum": ["chat", "work"] },
13
+ "prompt": { "type": "string", "maxLength": 8388608 },
14
+ "target": { "$ref": "#/$defs/targetRequest" },
15
+ "configuration": { "$ref": "#/$defs/configuration" },
16
+ "files": {
17
+ "type": "array",
18
+ "items": { "$ref": "#/$defs/inputFile" },
19
+ "maxItems": 256
20
+ },
21
+ "capture": { "$ref": "#/$defs/capture" },
22
+ "timeoutMs": { "$ref": "#/$defs/timeoutMs" }
23
+ },
24
+ "$defs": {
25
+ "uuid": {
26
+ "type": "string",
27
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
28
+ },
29
+ "targetRequest": {
30
+ "oneOf": [
31
+ {
32
+ "type": "object",
33
+ "additionalProperties": false,
34
+ "required": ["type"],
35
+ "properties": { "type": { "const": "new" } }
36
+ },
37
+ {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "required": ["type"],
41
+ "properties": { "type": { "const": "selected_tab" } }
42
+ },
43
+ {
44
+ "type": "object",
45
+ "additionalProperties": false,
46
+ "required": ["type", "tabId"],
47
+ "properties": {
48
+ "type": { "const": "tab_id" },
49
+ "tabId": { "$ref": "#/$defs/opaqueId" }
50
+ }
51
+ },
52
+ {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "required": ["type", "conversationId"],
56
+ "properties": {
57
+ "type": { "const": "conversation_id" },
58
+ "conversationId": { "$ref": "#/$defs/opaqueId" }
59
+ }
60
+ },
61
+ {
62
+ "type": "object",
63
+ "additionalProperties": false,
64
+ "required": ["type", "url"],
65
+ "properties": {
66
+ "type": { "const": "url" },
67
+ "url": {
68
+ "type": "string",
69
+ "minLength": 1,
70
+ "maxLength": 4096,
71
+ "pattern": "^https?://[^\\u0000-\\u001f\\u007f]+$"
72
+ }
73
+ }
74
+ }
75
+ ]
76
+ },
77
+ "configuration": {
78
+ "type": "object",
79
+ "additionalProperties": false,
80
+ "properties": {
81
+ "experience": { "enum": ["chat", "work"] },
82
+ "model": { "type": "string", "minLength": 1, "maxLength": 256 },
83
+ "modelVersion": { "type": "string", "minLength": 1, "maxLength": 256 },
84
+ "reasoning": { "type": "string", "minLength": 1, "maxLength": 256 },
85
+ "mode": { "type": "string", "minLength": 1, "maxLength": 256 },
86
+ "tools": {
87
+ "type": "array",
88
+ "items": { "type": "string", "minLength": 1, "maxLength": 256 },
89
+ "maxItems": 256
90
+ },
91
+ "additional": {
92
+ "type": "object",
93
+ "additionalProperties": { "$ref": "#/$defs/jsonValue" }
94
+ }
95
+ }
96
+ },
97
+ "inputFile": {
98
+ "type": "object",
99
+ "additionalProperties": false,
100
+ "required": ["path"],
101
+ "properties": {
102
+ "path": { "type": "string", "minLength": 1, "maxLength": 4096 },
103
+ "displayName": { "type": "string", "minLength": 1, "maxLength": 512 }
104
+ }
105
+ },
106
+ "capture": {
107
+ "type": "object",
108
+ "additionalProperties": false,
109
+ "required": ["responseContent", "artifacts"],
110
+ "properties": {
111
+ "responseContent": { "enum": ["include", "metadata"] },
112
+ "responseFormat": { "enum": ["markdown", "text"] },
113
+ "artifacts": { "enum": ["receipt_only", "transfer"] },
114
+ "outputDirectory": { "type": "string", "minLength": 1, "maxLength": 4096 }
115
+ },
116
+ "allOf": [
117
+ {
118
+ "if": { "properties": { "artifacts": { "const": "transfer" } }, "required": ["artifacts"] },
119
+ "then": {
120
+ "required": ["outputDirectory"],
121
+ "properties": { "outputDirectory": { "type": "string", "minLength": 1, "maxLength": 4096 } }
122
+ }
123
+ },
124
+ {
125
+ "if": { "properties": { "artifacts": { "const": "receipt_only" } }, "required": ["artifacts"] },
126
+ "then": { "properties": { "outputDirectory": false } }
127
+ }
128
+ ]
129
+ },
130
+ "timeoutMs": {
131
+ "type": "integer",
132
+ "minimum": 0,
133
+ "maximum": 9007199254740991
134
+ },
135
+ "opaqueId": {
136
+ "type": "string",
137
+ "minLength": 1,
138
+ "maxLength": 512,
139
+ "pattern": "^(?=.*\\S)[^\\u0000-\\u001f\\u007f]{1,512}$"
140
+ },
141
+ "jsonValue": {
142
+ "oneOf": [
143
+ { "type": "null" },
144
+ { "type": "boolean" },
145
+ { "type": "number" },
146
+ { "type": "string" },
147
+ {
148
+ "type": "array",
149
+ "items": { "$ref": "#/$defs/jsonValue" }
150
+ },
151
+ {
152
+ "type": "object",
153
+ "additionalProperties": { "$ref": "#/$defs/jsonValue" }
154
+ }
155
+ ]
156
+ }
157
+ }
158
+ }