@openclaw/imessage 2026.8.1-beta.3 → 2026.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{accounts-D00Njxg2.js → accounts-CCirBEIm.js} +4 -5
- package/dist/{actions.runtime-B_xJiBXF.js → actions.runtime-CAl3WcqD.js} +2 -3
- package/dist/api.js +6 -5
- package/dist/{approval-handler.runtime-BKku8aUf.js → approval-handler.runtime-UBd1j2Sg.js} +7 -7
- package/dist/{approval-reactions-BME5eA6T.js → approval-reactions-LL5yn1Rc.js} +5 -9
- package/dist/{channel-BFQTpvrG.js → channel-DNI9DKGN.js} +17 -16
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-BjkXwX9_.js → channel.runtime-HSkrmWfW.js} +58 -11
- package/dist/{config-schema-DV0KP5nC.js → config-schema-DuGbA8Kp.js} +8 -7
- package/dist/contract-api.js +1 -1
- package/dist/doctor-contract-api.js +8 -281
- package/dist/{group-policy-Ca3c5KES.js → group-policy-Dvc-BcWo.js} +12 -17
- package/dist/{media-contract-BEgdvYhW.js → media-contract-D-FhGE98.js} +1 -1
- package/dist/media-contract-api.js +1 -1
- package/dist/{message-tool-api-TZiNYA17.js → message-tool-api-CvIgJpOo.js} +3 -3
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-Uv5RaRTk.js → monitor-BywJn1QW.js} +289 -28
- package/dist/{question-reactions-to0i8vxE.js → question-reactions-viP7ZcyG.js} +1 -1
- package/dist/{reaction-context-DaNrZqYo.js → reaction-context-BAYI7pz0.js} +2 -2
- package/dist/{remote-file-CDuk0joc.js → remote-file-6mCj2ZBy.js} +2 -2
- package/dist/runtime-Cza4CY5T.js +8 -0
- package/dist/runtime-api.js +10 -9
- package/dist/{sanitize-outbound-DaLmdkbf.js → sanitize-outbound-Du-r1lNQ.js} +344 -57
- package/dist/{send-Dake4Awx.js → send-mgWPKqSV.js} +132 -11
- package/dist/state-contract-4TK_cDDb.js +56 -0
- package/dist/state-migrations-SFdKp3GQ.js +277 -0
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/openclaw.plugin.json +0 -6
- package/package.json +5 -5
- package/dist/catchup-Dh-Rv4Ur.js +0 -294
- package/dist/monitor-reply-cache-BdeUQaHO.js +0 -353
- package/dist/persisted-echo-cache-DGxy-J4t.js +0 -143
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
|
@@ -91,7 +91,7 @@ const User = Type.Object({ // const User = {
|
|
|
91
91
|
// type: 'string',
|
|
92
92
|
// format: 'email'
|
|
93
93
|
// }
|
|
94
|
-
// }
|
|
94
|
+
// },
|
|
95
95
|
// required: [
|
|
96
96
|
// 'id',
|
|
97
97
|
// 'name',
|
|
@@ -111,24 +111,28 @@ type User = Type.Static<typeof User> // type User = {
|
|
|
111
111
|
|
|
112
112
|
## Script
|
|
113
113
|
|
|
114
|
-
[Documentation](https://sinclairzx81.github.io/typebox/#/docs/script/overview) | [Example 1](https://www.typescriptlang.org/play/?target=99&module=7#code/
|
|
114
|
+
[Documentation](https://sinclairzx81.github.io/typebox/#/docs/script/overview) | [Example 1](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFkBDGAC0YgBMBXAG1WoBjCADsAzvGZs4AXkREAdAGVBUYGBgAKAAaU4cQmjgA1VIJjQALLLgBvOGQBccEdxDFUUADRwkz1+6ePgBe-m4e3nAA7mGBUHAAvnoGRCZmFlAAzDb2Ti7hQb6xESHFnonJhuim5tAATDkOZZF++XEV2gCU1HRwAOJQTGCswIJiHDz8QqIS-YPDo+NyyGjKqupaUqw+uvpVabCoZDnJ+pBiwDDAos41GZZepy7QIEy8t+nQmY-6+twAbh9alA6skkntUn1UDhUDAoEgTr84P9PFdBKgxB9DmQANoAXR+v2AIk4owxzXxYMqqSknmAb0RvyY7mAqBEMCB90J+lJGAw3DEqE5Vm5cDEaEEfCYUGFUEsVIhRgYGPYclsTwA5tCQLD4c4oTC4UhRa8YHS3s5aWo3lSutR9sqxKr5KslDAWKMADxVCAYOZDEZjHF4R2sPB4gB8+l6DpVjKRCcTSeTKZTvX0WsNerscAUecSotTReLJfTcFN5veObzCgqJfrDeTvQSQA) | [Example 2](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFkBDGAC0YgBMBXAG1WoBjCADsAzvABqqQTGgAWOAF5ERAHQB5YgCsZMABQBvOGQBcqtGoBy3EMVRR9ASgA0cJOeSWbdh87cAXp7qPvaOrnAA7sHetmHOcAC+TpTC4lJ60ADMyhaomjp6RiYx+aF+ER551nEVgaU1vuFJKWkScNKy0ABMuV75WrqyxWbV5eFuVf2N8U4t1HRwAOJQTGCswIJiHDz8QqLt0rCoZH3qg0WGlHBwkGLAMMCi5p1yUPIu13Ai0CBMvC9MlAsp8btwAG6ArpQbqUZKpA7wJaoHCoGBQJBnSwXYZXG7ghyPQSoMQNACCUFWSH0RxgJ1cX2AIk4mxJ5MpTGp03GzhS8La8GYdKgwH+WIGhVxXyYdmAqBEMChbw+XxZGAw3DEqCVClBcDEaEEfCYUB170+-MRjBJ7BU0xxBjxcAA5iiQGiMeZkaj0Ug9X9haKAYwWA4g3CUpRCGhrWJbdUAMowFibAA80ZRGFjrAAfDd8wXC4sM9nck7CxXK1XqzX84sbq6fZ64MY1G2knra13u1363AA2H-uZW+3El8exPJ3X6IkgA)
|
|
115
115
|
|
|
116
|
-
TypeBox includes a
|
|
116
|
+
TypeBox includes a micro TypeScript engine that can transform TypeScript definitions to JSON Schema. The engine is fully type-safe and supports many programmable constructs including Conditional, Mapped, Indexed, Generics, Distributive Generics, and more.
|
|
117
117
|
|
|
118
118
|
### Example
|
|
119
119
|
|
|
120
|
-
Syntax highlighting is available via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=sinclairzx81.typebox-script)
|
|
120
|
+
Syntax highlighting is available via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=sinclairzx81.typebox-script).
|
|
121
121
|
|
|
122
122
|
```typescript
|
|
123
|
-
|
|
123
|
+
import Type from 'typebox'
|
|
124
|
+
|
|
125
|
+
// Math Module
|
|
126
|
+
|
|
124
127
|
const Math = Type.Script(`
|
|
125
|
-
type Vector2 = { x: number, y: number }
|
|
126
|
-
type Vector3 = { x: number, y: number, z: number }
|
|
127
128
|
type Vector4 = { x: number, y: number, z: number, w: number }
|
|
129
|
+
type Vector3 = { x: number, y: number, z: number }
|
|
130
|
+
type Vector2 = { x: number, y: number }
|
|
128
131
|
`)
|
|
129
132
|
|
|
130
|
-
//
|
|
131
|
-
|
|
133
|
+
// Graphics Module
|
|
134
|
+
|
|
135
|
+
const Graphics = Type.Script(Math, `
|
|
132
136
|
type Vertex = {
|
|
133
137
|
position: Vector4,
|
|
134
138
|
normal: Vector3,
|
|
@@ -149,23 +153,10 @@ const { Mesh } = Type.Script(Math, `
|
|
|
149
153
|
}
|
|
150
154
|
`)
|
|
151
155
|
|
|
152
|
-
//
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
Mesh.properties.material.properties.diffuse.properties.x
|
|
157
|
-
Mesh.properties.material.properties.ambient.properties.x
|
|
158
|
-
Mesh.properties.material.properties.specular.properties.x
|
|
159
|
-
|
|
160
|
-
// Static Inference
|
|
161
|
-
function render(mesh: Type.Static<typeof Mesh>) {
|
|
162
|
-
mesh.geometry.vertices[0].position.x
|
|
163
|
-
mesh.geometry.vertices[0].normal.x
|
|
164
|
-
mesh.geometry.vertices[0].uv.x
|
|
165
|
-
mesh.material.diffuse.x
|
|
166
|
-
mesh.material.ambient.x
|
|
167
|
-
mesh.material.specular.x
|
|
168
|
-
}
|
|
156
|
+
type Mesh = Type.Static<typeof Graphics['Mesh']> // type Mesh = {
|
|
157
|
+
// geometry: { ... },
|
|
158
|
+
// material: { ... }
|
|
159
|
+
// }
|
|
169
160
|
```
|
|
170
161
|
|
|
171
162
|
<a name="Schema"></a>
|
|
@@ -184,18 +175,21 @@ import Schema from 'typebox/schema'
|
|
|
184
175
|
|
|
185
176
|
### Compile
|
|
186
177
|
|
|
187
|
-
The compiler accepts
|
|
178
|
+
The compiler accepts either TypeBox types or native JSON Schema.
|
|
188
179
|
|
|
189
180
|
```typescript
|
|
190
|
-
|
|
181
|
+
|
|
182
|
+
// Type
|
|
183
|
+
|
|
184
|
+
const VectorA = Schema.Compile(Type.Object({ // const VectorA: Validator<TObject<{
|
|
191
185
|
x: Type.Number(), // x: TNumber
|
|
192
186
|
y: Type.Number(), // y: TNumber
|
|
193
187
|
z: Type.Number() // z: TNumber
|
|
194
188
|
})) // }>>
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
const
|
|
189
|
+
|
|
190
|
+
// Schema
|
|
191
|
+
|
|
192
|
+
const VectorB = Schema.Compile({ // const VectorB: Validator<{
|
|
199
193
|
type: 'object', // type: "object";
|
|
200
194
|
required: ['x', 'y', 'z'], // required: ["x", "y", "z"];
|
|
201
195
|
properties: { // properties: { ... };
|
|
@@ -208,35 +202,36 @@ const Vector = Schema.Compile({ // const Vector: Validator<{
|
|
|
208
202
|
|
|
209
203
|
### Validate
|
|
210
204
|
|
|
211
|
-
|
|
205
|
+
Compiled validator instances provide functions to Check and Parse values.
|
|
212
206
|
|
|
213
207
|
```typescript
|
|
208
|
+
|
|
209
|
+
// Compile
|
|
210
|
+
|
|
214
211
|
const Vector = Schema.Compile(Type.Script(`{
|
|
215
212
|
x: number
|
|
216
213
|
y: number
|
|
217
214
|
z: number
|
|
218
215
|
}`))
|
|
219
216
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
z: 0
|
|
224
|
-
})
|
|
225
|
-
|
|
226
|
-
const value = Vector.Parse({ // const value: {
|
|
227
|
-
x: 1, // x: number
|
|
228
|
-
y: 0, // y: number
|
|
229
|
-
z: 0 // z: number
|
|
230
|
-
}) // }
|
|
231
|
-
```
|
|
217
|
+
// Check
|
|
218
|
+
|
|
219
|
+
const valid = Vector.Check({ x: 1, y: 0, z: 0 }) // const valid: boolean
|
|
232
220
|
|
|
221
|
+
// Parse
|
|
233
222
|
|
|
223
|
+
const result = Vector.Parse({ x: 1, y: 0, z: 0 }) // const result: {
|
|
224
|
+
// x: number
|
|
225
|
+
// y: number
|
|
226
|
+
// z: number
|
|
227
|
+
// }
|
|
228
|
+
```
|
|
234
229
|
|
|
235
230
|
### Coverage
|
|
236
231
|
|
|
237
|
-
|
|
232
|
+
[JSON Schema Test Suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite) | [JSON Schema Compliance Suite](https://github.com/sinclairzx81/json-schema-compliance-suite)
|
|
238
233
|
|
|
239
|
-
|
|
234
|
+
TypeBox supports all major JSON Schema draft versions and tracks compliance against the official JSON Schema Test Suite. It also maintains a separate JavaScript compliance suite to track ecosystem adoption as JSON Schema moves toward the V1 candidate. The following table shows TypeBox specification coverage.
|
|
240
235
|
|
|
241
236
|
| Spec | 3 | 4 | 6 | 7 | 2019-09 | 2020-12 | v1 |
|
|
242
237
|
|:-----|:--|:--|:--|:--|:--|:--|:--|
|
|
@@ -253,7 +248,7 @@ Ref: [JSON Schema Test Suite](https://github.com/json-schema-org/JSON-Schema-Tes
|
|
|
253
248
|
| dependencies | 17/18 | ✅ | ✅ | ✅ | - | - | - |
|
|
254
249
|
| dependentRequired | - | - | - | - | ✅ | ✅ | ✅ |
|
|
255
250
|
| dependentSchemas | - | - | - | - | ✅ | ✅ | ✅ |
|
|
256
|
-
| dynamicRef | - | - | - | - | - |
|
|
251
|
+
| dynamicRef | - | - | - | - | - | 40/44 | 21/27 |
|
|
257
252
|
| enum | 14/16 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
258
253
|
| exclusiveMaximum | - | - | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
259
254
|
| exclusiveMinimum | - | - | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
@@ -279,50 +274,52 @@ Ref: [JSON Schema Test Suite](https://github.com/json-schema-org/JSON-Schema-Tes
|
|
|
279
274
|
| properties | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
280
275
|
| propertyNames | - | - | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
281
276
|
| recursiveRef | - | - | - | - | ✅ | - | - |
|
|
282
|
-
| ref |
|
|
277
|
+
| ref | 22/27 | 37/45 | 67/70 | 75/78 | 79/81 | 77/79 | 78/79 |
|
|
283
278
|
| required | 3/4 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
284
279
|
| type | 73/80 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
285
|
-
| unevaluatedItems | - | - | - | - | ✅ |
|
|
286
|
-
| unevaluatedProperties | - | - | - | - | ✅ | ✅ |
|
|
280
|
+
| unevaluatedItems | - | - | - | - | ✅ | ✅ | 70/71 |
|
|
281
|
+
| unevaluatedProperties | - | - | - | - | ✅ | ✅ | 128/129 |
|
|
287
282
|
| uniqueItems | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
288
283
|
|
|
289
|
-
|
|
290
284
|
### Performance
|
|
291
285
|
|
|
292
|
-
|
|
286
|
+
TypeBox tracks comparative performance against AJV8 as the de facto performance standard. For broader comparative benchmarks, refer to the community maintained projects below.
|
|
287
|
+
|
|
288
|
+
[Runtime Benchmarks](https://moltar.github.io/typescript-runtime-type-benchmarks/) | [Schema Benchmarks](https://schemabenchmarks.dev/)
|
|
289
|
+
|
|
290
|
+
The following table shows compilation performance for various JSON Schema structures. These benchmarks measure the time required to JIT compile schematics, with faster compilation resulting in faster application startup.
|
|
293
291
|
|
|
294
292
|
```python
|
|
295
|
-
|
|
296
|
-
│ Compile │ TB1X
|
|
297
|
-
|
|
298
|
-
│ Boolean │
|
|
299
|
-
│ Number │
|
|
300
|
-
│ String │
|
|
301
|
-
│ Null │
|
|
302
|
-
│ Literal_String │
|
|
303
|
-
│ Literal_Number │
|
|
304
|
-
│ Literal_Boolean │
|
|
305
|
-
│ Pattern │
|
|
306
|
-
│ Object_Open │
|
|
307
|
-
│ Object_Close │
|
|
308
|
-
│ Object_Vector3 │
|
|
309
|
-
│ Object_Basis3 │
|
|
310
|
-
│ Intersect_And │
|
|
311
|
-
│ Intersect_Structural │
|
|
312
|
-
│ Union_Or │
|
|
313
|
-
│ Union_Structural │
|
|
314
|
-
│ Tuple_Values │
|
|
315
|
-
│ Tuple_Objects │
|
|
316
|
-
│ Array_Numbers_4 │
|
|
317
|
-
│ Array_Numbers_8 │
|
|
318
|
-
│ Array_Numbers_16 │
|
|
319
|
-
│ Array_Objects_Open │
|
|
320
|
-
│ Array_Objects_Close │
|
|
321
|
-
|
|
293
|
+
┌──────────────────────┬──────────────┬──────────────┐
|
|
294
|
+
│ Compile │ TB1X │ AJV8 │
|
|
295
|
+
├──────────────────────┼──────────────┼──────────────┤
|
|
296
|
+
│ Boolean │ 50.4K ops/s │ 7.1K ops/s │
|
|
297
|
+
│ Number │ 129.9K ops/s │ 7.9K ops/s │
|
|
298
|
+
│ String │ 128.9K ops/s │ 9.1K ops/s │
|
|
299
|
+
│ Null │ 91.3K ops/s │ 8.4K ops/s │
|
|
300
|
+
│ Literal_String │ 63.1K ops/s │ 7.4K ops/s │
|
|
301
|
+
│ Literal_Number │ 74.5K ops/s │ 7.6K ops/s │
|
|
302
|
+
│ Literal_Boolean │ 143.3K ops/s │ 7.7K ops/s │
|
|
303
|
+
│ Pattern │ 94.2K ops/s │ 6.4K ops/s │
|
|
304
|
+
│ Object_Open │ 19.4K ops/s │ 1.3K ops/s │
|
|
305
|
+
│ Object_Close │ 17.6K ops/s │ 991 ops/s │
|
|
306
|
+
│ Object_Vector3 │ 46.1K ops/s │ 3.3K ops/s │
|
|
307
|
+
│ Object_Basis3 │ 16K ops/s │ 848 ops/s │
|
|
308
|
+
│ Intersect_And │ 41.3K ops/s │ 4.2K ops/s │
|
|
309
|
+
│ Intersect_Structural │ 25.3K ops/s │ 1.5K ops/s │
|
|
310
|
+
│ Union_Or │ 58.6K ops/s │ 2.4K ops/s │
|
|
311
|
+
│ Union_Structural │ 31.5K ops/s │ 1.8K ops/s │
|
|
312
|
+
│ Tuple_Values │ 18.2K ops/s │ 1.9K ops/s │
|
|
313
|
+
│ Tuple_Objects │ 3.9K ops/s │ 437 ops/s │
|
|
314
|
+
│ Array_Numbers_4 │ 114.5K ops/s │ 4.2K ops/s │
|
|
315
|
+
│ Array_Numbers_8 │ 128.3K ops/s │ 3.9K ops/s │
|
|
316
|
+
│ Array_Numbers_16 │ 128.4K ops/s │ 4K ops/s │
|
|
317
|
+
│ Array_Objects_Open │ 22K ops/s │ 780 ops/s │
|
|
318
|
+
│ Array_Objects_Close │ 22K ops/s │ 1K ops/s │
|
|
319
|
+
└──────────────────────┴──────────────┴──────────────┘
|
|
322
320
|
```
|
|
323
321
|
|
|
324
|
-
|
|
325
|
-
The following tables shows validation performance for various JSON Schema structures using AJV8 as a basis for comparison.
|
|
322
|
+
The following tables shows validation performance for various JSON Schema structures. These benchmarks measure overall validation throughput for JIT compiled schematics.
|
|
326
323
|
|
|
327
324
|
```python
|
|
328
325
|
┌──────────────────────┬──────────────┬──────────────┐
|
package/openclaw.plugin.json
CHANGED
|
@@ -467,7 +467,6 @@
|
|
|
467
467
|
"type": "boolean"
|
|
468
468
|
},
|
|
469
469
|
"dmPolicy": {
|
|
470
|
-
"default": "pairing",
|
|
471
470
|
"type": "string",
|
|
472
471
|
"enum": [
|
|
473
472
|
"pairing",
|
|
@@ -506,7 +505,6 @@
|
|
|
506
505
|
}
|
|
507
506
|
},
|
|
508
507
|
"groupPolicy": {
|
|
509
|
-
"default": "allowlist",
|
|
510
508
|
"type": "string",
|
|
511
509
|
"enum": [
|
|
512
510
|
"open",
|
|
@@ -840,10 +838,6 @@
|
|
|
840
838
|
}
|
|
841
839
|
}
|
|
842
840
|
},
|
|
843
|
-
"required": [
|
|
844
|
-
"dmPolicy",
|
|
845
|
-
"groupPolicy"
|
|
846
|
-
],
|
|
847
841
|
"additionalProperties": false
|
|
848
842
|
}
|
|
849
843
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/imessage",
|
|
3
|
-
"version": "2026.8.1
|
|
3
|
+
"version": "2026.8.1",
|
|
4
4
|
"description": "OpenClaw iMessage channel plugin using imsg on a signed-in Mac",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"typebox": "1.3.
|
|
11
|
+
"typebox": "1.3.16",
|
|
12
12
|
"zod": "4.4.3"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"openclaw": ">=2026.8.1
|
|
15
|
+
"openclaw": ">=2026.8.1"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"openclaw": {
|
|
@@ -92,10 +92,10 @@
|
|
|
92
92
|
"allowInvalidConfigRecovery": true
|
|
93
93
|
},
|
|
94
94
|
"compat": {
|
|
95
|
-
"pluginApi": ">=2026.8.1
|
|
95
|
+
"pluginApi": ">=2026.8.1"
|
|
96
96
|
},
|
|
97
97
|
"build": {
|
|
98
|
-
"openclawVersion": "2026.8.1
|
|
98
|
+
"openclawVersion": "2026.8.1",
|
|
99
99
|
"bundledDist": false
|
|
100
100
|
},
|
|
101
101
|
"release": {
|
package/dist/catchup-Dh-Rv4Ur.js
DELETED
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
import { f as getIMessageRuntime } from "./monitor-reply-cache-BdeUQaHO.js";
|
|
2
|
-
import { resolveIntegerOption } from "openclaw/plugin-sdk/number-runtime";
|
|
3
|
-
import { createHash } from "node:crypto";
|
|
4
|
-
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
5
|
-
//#region extensions/imessage/src/monitor/catchup.ts
|
|
6
|
-
const DEFAULT_MAX_AGE_MINUTES = 120;
|
|
7
|
-
const MAX_MAX_AGE_MINUTES = 720;
|
|
8
|
-
const DEFAULT_PER_RUN_LIMIT = 50;
|
|
9
|
-
const MAX_PER_RUN_LIMIT = 500;
|
|
10
|
-
const DEFAULT_FIRST_RUN_LOOKBACK_MINUTES = 30;
|
|
11
|
-
const DEFAULT_MAX_FAILURE_RETRIES = 10;
|
|
12
|
-
const MAX_MAX_FAILURE_RETRIES = 1e3;
|
|
13
|
-
const MAX_FAILURE_RETRY_MAP_SIZE = 512;
|
|
14
|
-
const MAX_FAILURE_RETRY_MAP_JSON_BYTES = 48e3;
|
|
15
|
-
const textEncoder = new TextEncoder();
|
|
16
|
-
const IMESSAGE_CATCHUP_CURSOR_NAMESPACE = "imessage.catchup-cursors";
|
|
17
|
-
const cursorWriteQueue = new KeyedAsyncQueue();
|
|
18
|
-
function resolveIMessageCatchupCursorKey(accountId) {
|
|
19
|
-
return createHash("sha256").update(accountId, "utf8").digest("hex").slice(0, 32);
|
|
20
|
-
}
|
|
21
|
-
function openCatchupCursorStore() {
|
|
22
|
-
return getIMessageRuntime().state.openSyncKeyedStore({
|
|
23
|
-
namespace: IMESSAGE_CATCHUP_CURSOR_NAMESPACE,
|
|
24
|
-
maxEntries: 256
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
function updateCatchupCursorStore(key, updateValue) {
|
|
28
|
-
const store = openCatchupCursorStore();
|
|
29
|
-
if (!store.update) throw new Error("iMessage catchup cursor persistence requires atomic plugin-state update.");
|
|
30
|
-
return store.update(key, updateValue);
|
|
31
|
-
}
|
|
32
|
-
function enqueueCursorWrite(accountId, fn) {
|
|
33
|
-
const key = resolveIMessageCatchupCursorKey(accountId);
|
|
34
|
-
return cursorWriteQueue.enqueue(key, fn);
|
|
35
|
-
}
|
|
36
|
-
function sanitizeFailureRetriesInput(raw) {
|
|
37
|
-
if (!raw || typeof raw !== "object") return {};
|
|
38
|
-
const out = {};
|
|
39
|
-
for (const [guid, count] of Object.entries(raw)) {
|
|
40
|
-
if (!guid || typeof guid !== "string") continue;
|
|
41
|
-
if (typeof count !== "number" || !Number.isFinite(count) || count <= 0) continue;
|
|
42
|
-
out[guid] = Math.floor(count);
|
|
43
|
-
}
|
|
44
|
-
return out;
|
|
45
|
-
}
|
|
46
|
-
function normalizeIMessageCatchupCursor(value) {
|
|
47
|
-
if (!value || typeof value !== "object") return null;
|
|
48
|
-
const raw = value;
|
|
49
|
-
if (typeof raw.lastSeenMs !== "number" || !Number.isFinite(raw.lastSeenMs)) return null;
|
|
50
|
-
if (typeof raw.lastSeenRowid !== "number" || !Number.isFinite(raw.lastSeenRowid)) return null;
|
|
51
|
-
const failureRetries = sanitizeFailureRetriesInput(raw.failureRetries);
|
|
52
|
-
const hasRetries = Object.keys(failureRetries).length > 0;
|
|
53
|
-
return {
|
|
54
|
-
lastSeenMs: raw.lastSeenMs,
|
|
55
|
-
lastSeenRowid: raw.lastSeenRowid,
|
|
56
|
-
updatedAt: typeof raw.updatedAt === "number" ? raw.updatedAt : 0,
|
|
57
|
-
...hasRetries ? { failureRetries } : {}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function readIMessageCatchupCursor(accountId) {
|
|
61
|
-
return normalizeIMessageCatchupCursor(openCatchupCursorStore().lookup(resolveIMessageCatchupCursorKey(accountId)));
|
|
62
|
-
}
|
|
63
|
-
async function loadIMessageCatchupCursor(accountId) {
|
|
64
|
-
return readIMessageCatchupCursor(accountId);
|
|
65
|
-
}
|
|
66
|
-
function buildIMessageCatchupCursor(next) {
|
|
67
|
-
const sanitized = sanitizeFailureRetriesInput(next.failureRetries);
|
|
68
|
-
const hasRetries = Object.keys(sanitized).length > 0;
|
|
69
|
-
return {
|
|
70
|
-
lastSeenMs: next.lastSeenMs,
|
|
71
|
-
lastSeenRowid: next.lastSeenRowid,
|
|
72
|
-
updatedAt: Date.now(),
|
|
73
|
-
...hasRetries ? { failureRetries: sanitized } : {}
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
async function saveIMessageCatchupCursor(accountId, next, options = {}) {
|
|
77
|
-
const cursor = buildIMessageCatchupCursor(next);
|
|
78
|
-
updateCatchupCursorStore(resolveIMessageCatchupCursorKey(accountId), (existingValue) => {
|
|
79
|
-
const existing = normalizeIMessageCatchupCursor(existingValue);
|
|
80
|
-
if (existing && cursor.lastSeenRowid < existing.lastSeenRowid) {
|
|
81
|
-
if (!options.allowCursorRewindForRetries) return;
|
|
82
|
-
return buildIMessageCatchupCursor({
|
|
83
|
-
lastSeenMs: cursor.lastSeenMs,
|
|
84
|
-
lastSeenRowid: cursor.lastSeenRowid,
|
|
85
|
-
failureRetries: {
|
|
86
|
-
...existing.failureRetries,
|
|
87
|
-
...cursor.failureRetries
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return cursor;
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Bound the retry map so a pathological storm of unique failing GUIDs
|
|
96
|
-
* cannot grow the cursor file without limit. Keeps the `maxSize` entries
|
|
97
|
-
* with the highest counts (closest to give-up) when over the bound.
|
|
98
|
-
*/
|
|
99
|
-
function capFailureRetriesMap(map, maxSize = MAX_FAILURE_RETRY_MAP_SIZE, maxBytes = MAX_FAILURE_RETRY_MAP_JSON_BYTES) {
|
|
100
|
-
const entries = Object.entries(map);
|
|
101
|
-
if (entries.length <= maxSize && textEncoder.encode(JSON.stringify(map)).byteLength <= maxBytes) return map;
|
|
102
|
-
entries.sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));
|
|
103
|
-
const capped = {};
|
|
104
|
-
for (const [guid, count] of entries.slice(0, maxSize)) {
|
|
105
|
-
capped[guid] = count;
|
|
106
|
-
if (textEncoder.encode(JSON.stringify(capped)).byteLength > maxBytes) {
|
|
107
|
-
delete capped[guid];
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return capped;
|
|
112
|
-
}
|
|
113
|
-
function clampInt(value, min, max, fallback) {
|
|
114
|
-
return resolveIntegerOption(value, fallback, {
|
|
115
|
-
min,
|
|
116
|
-
max
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
function resolveCatchupConfig(raw) {
|
|
120
|
-
return {
|
|
121
|
-
enabled: Boolean(raw?.enabled),
|
|
122
|
-
maxAgeMinutes: clampInt(raw?.maxAgeMinutes, 1, MAX_MAX_AGE_MINUTES, DEFAULT_MAX_AGE_MINUTES),
|
|
123
|
-
perRunLimit: clampInt(raw?.perRunLimit, 1, MAX_PER_RUN_LIMIT, DEFAULT_PER_RUN_LIMIT),
|
|
124
|
-
firstRunLookbackMinutes: clampInt(raw?.firstRunLookbackMinutes, 1, MAX_MAX_AGE_MINUTES, DEFAULT_FIRST_RUN_LOOKBACK_MINUTES),
|
|
125
|
-
maxFailureRetries: clampInt(raw?.maxFailureRetries, 1, MAX_MAX_FAILURE_RETRIES, DEFAULT_MAX_FAILURE_RETRIES)
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
async function advanceIMessageCatchupCursor(accountId, next, config) {
|
|
129
|
-
if (!Number.isFinite(next.lastSeenMs) || !Number.isFinite(next.lastSeenRowid)) return false;
|
|
130
|
-
return await enqueueCursorWrite(accountId, async () => {
|
|
131
|
-
let advanced = false;
|
|
132
|
-
updateCatchupCursorStore(resolveIMessageCatchupCursorKey(accountId), (existingValue) => {
|
|
133
|
-
const cursor = normalizeIMessageCatchupCursor(existingValue);
|
|
134
|
-
if (cursor && next.lastSeenRowid <= cursor.lastSeenRowid) return;
|
|
135
|
-
if (Object.values(cursor?.failureRetries ?? {}).some((count) => count < config.maxFailureRetries)) return;
|
|
136
|
-
advanced = true;
|
|
137
|
-
return buildIMessageCatchupCursor({
|
|
138
|
-
lastSeenMs: Math.max(cursor?.lastSeenMs ?? next.lastSeenMs, next.lastSeenMs),
|
|
139
|
-
lastSeenRowid: next.lastSeenRowid,
|
|
140
|
-
failureRetries: cursor?.failureRetries
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
return advanced;
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* One catchup pass. Loads the cursor, fetches `messages.history`, replays
|
|
148
|
-
* each row through `dispatch`, advances the cursor on success / give-up,
|
|
149
|
-
* persists the cursor, returns a summary.
|
|
150
|
-
*
|
|
151
|
-
* The fetch and dispatch functions are injected so this loop is unit-testable
|
|
152
|
-
* without standing up an `imsg` daemon. The wiring in `monitor-provider.ts`
|
|
153
|
-
* passes the live `client.request("messages.history", ...)` adapter as
|
|
154
|
-
* `fetch` and the `evaluateIMessageInbound` + `runChannelInboundEvent`
|
|
155
|
-
* pipeline as `dispatch`.
|
|
156
|
-
*/
|
|
157
|
-
async function performIMessageCatchup(params) {
|
|
158
|
-
const now = params.now ?? Date.now();
|
|
159
|
-
const cfg = params.config;
|
|
160
|
-
const cursor = await loadIMessageCatchupCursor(params.accountId);
|
|
161
|
-
const lookbackMs = cursor === null ? cfg.firstRunLookbackMinutes * 6e4 : cfg.maxAgeMinutes * 6e4;
|
|
162
|
-
const ageBoundMs = now - cfg.maxAgeMinutes * 6e4;
|
|
163
|
-
const windowStartMs = Math.max(cursor?.lastSeenMs ?? now - lookbackMs, ageBoundMs);
|
|
164
|
-
const windowEndMs = now;
|
|
165
|
-
const sinceRowid = cursor?.lastSeenRowid ?? 0;
|
|
166
|
-
const summary = {
|
|
167
|
-
querySucceeded: false,
|
|
168
|
-
fullyCaughtUp: false,
|
|
169
|
-
fetchedCount: 0,
|
|
170
|
-
replayed: 0,
|
|
171
|
-
skippedFromMe: 0,
|
|
172
|
-
skippedPreCursor: 0,
|
|
173
|
-
skippedGivenUp: 0,
|
|
174
|
-
failed: 0,
|
|
175
|
-
givenUp: 0,
|
|
176
|
-
cursorBefore: cursor ? {
|
|
177
|
-
lastSeenMs: cursor.lastSeenMs,
|
|
178
|
-
lastSeenRowid: cursor.lastSeenRowid
|
|
179
|
-
} : null,
|
|
180
|
-
cursorAfter: {
|
|
181
|
-
lastSeenMs: cursor?.lastSeenMs ?? windowStartMs,
|
|
182
|
-
lastSeenRowid: cursor?.lastSeenRowid ?? 0
|
|
183
|
-
},
|
|
184
|
-
windowStartMs,
|
|
185
|
-
windowEndMs
|
|
186
|
-
};
|
|
187
|
-
let fetchResult;
|
|
188
|
-
try {
|
|
189
|
-
fetchResult = await params.fetch({
|
|
190
|
-
sinceMs: windowStartMs,
|
|
191
|
-
sinceRowid,
|
|
192
|
-
limit: cfg.perRunLimit
|
|
193
|
-
});
|
|
194
|
-
} catch (err) {
|
|
195
|
-
params.warn?.(`imessage catchup: fetch failed: ${String(err)}`);
|
|
196
|
-
return summary;
|
|
197
|
-
}
|
|
198
|
-
if (!fetchResult.resolved) {
|
|
199
|
-
params.warn?.(`imessage catchup: fetch returned unresolved result`);
|
|
200
|
-
return summary;
|
|
201
|
-
}
|
|
202
|
-
summary.querySucceeded = true;
|
|
203
|
-
summary.fullyCaughtUp = fetchResult.fullyCaughtUp !== false;
|
|
204
|
-
summary.fetchedCount = fetchResult.rows.length;
|
|
205
|
-
const rows = fetchResult.rows.toSorted((a, b) => a.rowid - b.rowid);
|
|
206
|
-
const failureRetries = { ...cursor?.failureRetries };
|
|
207
|
-
const cursorBeforeMs = cursor?.lastSeenMs ?? windowStartMs;
|
|
208
|
-
const cursorBeforeRowid = cursor?.lastSeenRowid ?? 0;
|
|
209
|
-
let highWatermarkMs = cursorBeforeMs;
|
|
210
|
-
let highWatermarkRowid = cursorBeforeRowid;
|
|
211
|
-
let earliestHeldFailureRow = null;
|
|
212
|
-
for (const row of rows) {
|
|
213
|
-
if (row.rowid <= sinceRowid) {
|
|
214
|
-
summary.skippedPreCursor += 1;
|
|
215
|
-
continue;
|
|
216
|
-
}
|
|
217
|
-
if (row.date < ageBoundMs) {
|
|
218
|
-
summary.skippedPreCursor += 1;
|
|
219
|
-
highWatermarkMs = Math.max(highWatermarkMs, row.date);
|
|
220
|
-
highWatermarkRowid = Math.max(highWatermarkRowid, row.rowid);
|
|
221
|
-
continue;
|
|
222
|
-
}
|
|
223
|
-
if (row.isFromMe) {
|
|
224
|
-
try {
|
|
225
|
-
await params.observeSkippedFromMe?.(row);
|
|
226
|
-
} catch (err) {
|
|
227
|
-
params.warn?.(`imessage catchup: from-me observer failed for guid=${row.guid}: ${String(err)}`);
|
|
228
|
-
}
|
|
229
|
-
summary.skippedFromMe += 1;
|
|
230
|
-
highWatermarkMs = Math.max(highWatermarkMs, row.date);
|
|
231
|
-
highWatermarkRowid = Math.max(highWatermarkRowid, row.rowid);
|
|
232
|
-
continue;
|
|
233
|
-
}
|
|
234
|
-
const priorCount = failureRetries[row.guid] ?? 0;
|
|
235
|
-
if (priorCount >= cfg.maxFailureRetries) {
|
|
236
|
-
summary.skippedGivenUp += 1;
|
|
237
|
-
highWatermarkMs = Math.max(highWatermarkMs, row.date);
|
|
238
|
-
highWatermarkRowid = Math.max(highWatermarkRowid, row.rowid);
|
|
239
|
-
continue;
|
|
240
|
-
}
|
|
241
|
-
let dispatched;
|
|
242
|
-
try {
|
|
243
|
-
dispatched = await params.dispatch(row);
|
|
244
|
-
} catch (err) {
|
|
245
|
-
params.warn?.(`imessage catchup: dispatch threw for guid=${row.guid}: ${String(err)}`);
|
|
246
|
-
dispatched = { ok: false };
|
|
247
|
-
}
|
|
248
|
-
if (dispatched.ok) {
|
|
249
|
-
summary.replayed += 1;
|
|
250
|
-
delete failureRetries[row.guid];
|
|
251
|
-
highWatermarkMs = Math.max(highWatermarkMs, row.date);
|
|
252
|
-
highWatermarkRowid = Math.max(highWatermarkRowid, row.rowid);
|
|
253
|
-
continue;
|
|
254
|
-
}
|
|
255
|
-
const nextCount = priorCount + 1;
|
|
256
|
-
failureRetries[row.guid] = nextCount;
|
|
257
|
-
summary.failed += 1;
|
|
258
|
-
if (nextCount >= cfg.maxFailureRetries) {
|
|
259
|
-
summary.givenUp += 1;
|
|
260
|
-
params.warn?.(`imessage catchup: giving up on guid=${row.guid} after ${nextCount} failures; advancing cursor past it`);
|
|
261
|
-
highWatermarkMs = Math.max(highWatermarkMs, row.date);
|
|
262
|
-
highWatermarkRowid = Math.max(highWatermarkRowid, row.rowid);
|
|
263
|
-
continue;
|
|
264
|
-
}
|
|
265
|
-
if (earliestHeldFailureRow === null || row.rowid < earliestHeldFailureRow.rowid) earliestHeldFailureRow = row;
|
|
266
|
-
}
|
|
267
|
-
if (earliestHeldFailureRow === null) {
|
|
268
|
-
if (typeof fetchResult.highWatermarkMs === "number") highWatermarkMs = Math.max(highWatermarkMs, fetchResult.highWatermarkMs);
|
|
269
|
-
if (typeof fetchResult.highWatermarkRowid === "number") highWatermarkRowid = Math.max(highWatermarkRowid, fetchResult.highWatermarkRowid);
|
|
270
|
-
}
|
|
271
|
-
let lastSeenMs;
|
|
272
|
-
let lastSeenRowid;
|
|
273
|
-
if (earliestHeldFailureRow !== null) {
|
|
274
|
-
lastSeenMs = Math.max(cursorBeforeMs, earliestHeldFailureRow.date - 1);
|
|
275
|
-
lastSeenRowid = Math.max(cursorBeforeRowid, earliestHeldFailureRow.rowid - 1);
|
|
276
|
-
} else {
|
|
277
|
-
lastSeenMs = highWatermarkMs;
|
|
278
|
-
lastSeenRowid = highWatermarkRowid;
|
|
279
|
-
}
|
|
280
|
-
const capped = capFailureRetriesMap(failureRetries);
|
|
281
|
-
summary.cursorAfter = {
|
|
282
|
-
lastSeenMs,
|
|
283
|
-
lastSeenRowid
|
|
284
|
-
};
|
|
285
|
-
await saveIMessageCatchupCursor(params.accountId, {
|
|
286
|
-
lastSeenMs,
|
|
287
|
-
lastSeenRowid,
|
|
288
|
-
failureRetries: capped
|
|
289
|
-
}, { allowCursorRewindForRetries: earliestHeldFailureRow !== null });
|
|
290
|
-
if (summary.replayed > 0 || summary.failed > 0 || summary.givenUp > 0) params.log?.(`imessage catchup: replayed=${summary.replayed} skippedFromMe=${summary.skippedFromMe} skippedGivenUp=${summary.skippedGivenUp} failed=${summary.failed} givenUp=${summary.givenUp} fetchedCount=${summary.fetchedCount}`);
|
|
291
|
-
return summary;
|
|
292
|
-
}
|
|
293
|
-
//#endregion
|
|
294
|
-
export { resolveCatchupConfig as a, performIMessageCatchup as i, advanceIMessageCatchupCursor as n, resolveIMessageCatchupCursorKey as o, capFailureRetriesMap as r, IMESSAGE_CATCHUP_CURSOR_NAMESPACE as t };
|