@lifi/compose-spec 0.7.0 → 0.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/src/descriptor.ts CHANGED
@@ -29,8 +29,8 @@ import { BYTES32_LOWER_HEX } from './hexPatterns.js';
29
29
 
30
30
  // `ChainIdSchema`, `EVMAddressString` and `IntegerString` (from
31
31
  // `flowSchema.ts`) are reused directly, so the widened members below differ
32
- // from their readiness counterparts in exactly one field (`owner`) with no
33
- // risk of a drifting re-declaration.
32
+ // from their `AssertionSpec` counterparts in exactly one field (`owner`) with
33
+ // no risk of a drifting re-declaration.
34
34
 
35
35
  // The `validationProgramHash` (GD-2, seam C1): `keccak256` over the canonical
36
36
  // program body. Strict 32-byte lowercase hex (`BYTES32_LOWER_HEX`) — see the
@@ -39,13 +39,13 @@ export const Bytes32HexSchema = Schema.String.pipe(
39
39
  Schema.pattern(BYTES32_LOWER_HEX),
40
40
  );
41
41
 
42
- // The disclosure-path widening of the two balance-`Gte` readiness members: same
42
+ // The disclosure-path widening of the two balance-`Gte` assertion members: same
43
43
  // fields as their `continuation.ts` counterparts, but `owner` accepts a symbolic
44
44
  // `"escrow"`/`"delivery"` too. The derivation genuinely produces such values —
45
45
  // a captured invariant can carry a symbolic owner, which `resolveOwner` maps to
46
46
  // a validator-injected slot at settlement (see the `uc1` invariant). The
47
- // readiness `CheckSchema` stays hex-only on purpose (a polled `Check` has no
48
- // injected slot), so this widening lives in the descriptor union only.
47
+ // `AssertionSpec` members stay hex-only, so this widening lives in the
48
+ // descriptor union only.
49
49
  export const AssertedErc20BalanceGteSpecSchema = Schema.Struct({
50
50
  kind: Schema.Literal('erc20BalanceGte'),
51
51
  chainId: ChainIdSchema,
@@ -73,10 +73,10 @@ const RawAssertedPredicateSchema = Schema.Union(
73
73
  NativeBalanceDeltaGteSpecSchema,
74
74
  );
75
75
 
76
- // Same `nativeBalanceGte` handling as `CheckSchema`, applied to the
76
+ // `nativeBalanceGte` handling via `decodeNativeBalanceGte`, applied to the
77
77
  // disclosed/committed predicate so settlement derives the identical program.
78
- // Idempotent on actions authored through `CheckSchema`; normalizes or refuses
79
- // a hand-forged committed action that embeds a raw native check. The delta
78
+ // Idempotent on already-normalized predicates; normalizes or refuses a
79
+ // hand-forged committed action that embeds a raw native check. The delta
80
80
  // members are untouched — they derive from already-normalized outcomes.
81
81
  export const AssertedPredicateSchema = Schema.transformOrFail(
82
82
  RawAssertedPredicateSchema,
package/src/flowSchema.ts CHANGED
@@ -162,7 +162,7 @@ export const AppliedGuardSchema = Schema.Struct(
162
162
  // plain objects, and `__proto__` there sets the prototype instead of adding a
163
163
  // key; the response serializer's `z.record` also drops a `__proto__` key. So
164
164
  // the id can never round-trip, and the one flow schema rejects it for every
165
- // flow it decodes, including an embedded manual-relay `continuationFlow`.
165
+ // flow it decodes, including an embedded `continuationFlow`.
166
166
  const NodeIdSchema = Schema.String.pipe(
167
167
  Schema.filter((id) => id !== '__proto__', {
168
168
  message: () => 'node id "__proto__" is reserved; choose another node id',
@@ -190,9 +190,9 @@ export const UuidSchema = Schema.String.pipe(
190
190
  );
191
191
 
192
192
  // Journey lineage of a non-atomic flow (COM-1253). The server writes it into
193
- // every flow it hands out for a later compile — a manual-relay `nextFlow`, an
194
- // intent-factory committed action — so a journey's legs share one id without
195
- // the caller carrying anything. A root flow has no `lineage`.
193
+ // every flow it hands out for a later compile — today an intent-factory
194
+ // committed action — so a journey's legs share one id without the caller
195
+ // carrying anything. A root flow has no `lineage`.
196
196
  //
197
197
  // It has no program semantics: nothing lowers it and nothing executes it. Only
198
198
  // the compile pipeline (which turns it into the on-chain `ProgramExecution`
@@ -200,8 +200,8 @@ export const UuidSchema = Schema.String.pipe(
200
200
  //
201
201
  // Trust: a caller may hand-write or copy a stamp and the system accepts it.
202
202
  // The link is server-asserted where the flow is committed (intent-factory
203
- // registers the stamped blob) and telemetry-grade where the caller can edit
204
- // the flow (manual-relay).
203
+ // registers the stamped blob) and telemetry-grade on any flow the caller
204
+ // posts with a stamp it wrote itself.
205
205
  export const LineageSchema = Schema.Struct({
206
206
  journeyId: UuidSchema,
207
207
  parentRequestId: UuidSchema,
package/src/index.ts CHANGED
@@ -33,11 +33,8 @@ export type {
33
33
  ContinuationOutcome,
34
34
  ContinuationIntent,
35
35
  Phase1Artifact,
36
- Check,
37
- CheckComparator,
38
36
  AssertionOwner,
39
37
  AssertionSpec,
40
- ContinuationPlan,
41
38
  } from './continuation.js';
42
39
  export {
43
40
  CONTINUATION_COMMITMENT_OP_ID,
@@ -45,7 +42,6 @@ export {
45
42
  ContinuationOutcomeSchema,
46
43
  ContinuationIntentSchema,
47
44
  Phase1ArtifactSchema,
48
- CheckSchema,
49
45
  AssertionOwnerSchema,
50
46
  Erc20BalanceGteSpecSchema,
51
47
  NativeBalanceGteSpecSchema,
@@ -53,10 +49,6 @@ export {
53
49
  Erc20BalanceDeltaGteSpecSchema,
54
50
  NativeBalanceDeltaGteSpecSchema,
55
51
  AssertionSpecSchema,
56
- ContinuationPlanSchema,
57
- isGTECheck,
58
- isLTECheck,
59
- isEQCheck,
60
52
  settledOutcome,
61
53
  } from './continuation.js';
62
54
 
@@ -306,11 +298,9 @@ export {
306
298
  GuardSelectorZod,
307
299
  GuardCompatibilityZod,
308
300
  SettlementZod,
309
- CheckZod,
310
301
  AssertionSpecZod,
311
302
  AssertedPredicateZod,
312
303
  VerificationDescriptorZod,
313
- ContinuationPlanZod,
314
304
  } from './zodSchemas.js';
315
305
  export type {
316
306
  HandleUnits,
@@ -320,5 +310,4 @@ export type {
320
310
  AssertionSpecWire,
321
311
  AssertedPredicateWire,
322
312
  VerificationDescriptorWire,
323
- ContinuationPlanWire,
324
313
  } from './zodSchemas.js';
package/src/zodSchemas.ts CHANGED
@@ -5,7 +5,6 @@ import {
5
5
  DECIMAL_UINT,
6
6
  EVM_ADDRESS_HEX,
7
7
  HEX_BYTES,
8
- MAX_DATE_MS,
9
8
  MAX_UINT256,
10
9
  } from './hexPatterns.js';
11
10
 
@@ -13,9 +12,9 @@ import {
13
12
  // `flowSchema.ts`, single-sourced so the wire schemas stay consistent.
14
13
  export const chainIdZod = z.number().int().positive();
15
14
 
16
- // Zod mirrors of `EVMAddressString`, `HexBytesString`, `IntegerString` and
17
- // `EpochMsSchema` in `flowSchema.ts`, built from the same `hexPatterns.ts`
18
- // constants. `continuationParity.spec.ts` holds the two sides in lockstep.
15
+ // Zod mirrors of `EVMAddressString`, `HexBytesString` and `IntegerString` in
16
+ // `flowSchema.ts`, built from the same `hexPatterns.ts` constants.
17
+ // `continuationParity.spec.ts` holds the two sides in lockstep.
19
18
  const evmAddressZod = z.string().regex(EVM_ADDRESS_HEX);
20
19
  const hexBytesZod = z.string().regex(HEX_BYTES);
21
20
  // One refinement, like `IntegerString`'s filter: Zod runs later checks after
@@ -26,7 +25,6 @@ const uintStringZod = z
26
25
  .refine((value) => DECIMAL_UINT.test(value) && BigInt(value) <= MAX_UINT256, {
27
26
  message: 'expected a uint256 decimal integer string',
28
27
  });
29
- const epochMsZod = z.number().int().min(-MAX_DATE_MS).max(MAX_DATE_MS);
30
28
 
31
29
  const SolTypeZod = z.enum([
32
30
  'uint8',
@@ -216,17 +214,17 @@ export const SettlementEscrowZod = z.object({
216
214
 
217
215
  // Mirror of `AssertionOwnerSchema` (continuation.ts): a concrete address or
218
216
  // one of the two symbolic owners resolved at settlement. Applies ONLY to the
219
- // derivation-only delta members — the wire `Check` members keep address-only
220
- // owners (see the note in continuation.ts).
217
+ // derivation-only delta members — the three absolute members keep
218
+ // address-only owners (see the note in continuation.ts).
221
219
  const assertionOwnerZod = z.union([
222
220
  evmAddressZod,
223
221
  z.enum(['escrow', 'delivery']),
224
222
  ]);
225
223
 
226
- // HTTP-layer mirror of `CheckSchema` (the Effect schema in `continuation.ts`).
227
- // A readiness predicate the client can poll and that is also embedded into
228
- // `nextFlow` as an on-chain assertion. Amounts are decimal strings on the wire.
229
- export const CheckZod = z.discriminatedUnion('kind', [
224
+ // HTTP-layer mirror of `AssertionSpecSchema` (continuation.ts): the three
225
+ // absolute members plus the two derivation-only members. Amounts are decimal
226
+ // strings on the wire.
227
+ export const AssertionSpecZod = z.discriminatedUnion('kind', [
230
228
  z.object({
231
229
  kind: z.literal('erc20BalanceGte'),
232
230
  chainId: chainIdZod,
@@ -248,13 +246,6 @@ export const CheckZod = z.discriminatedUnion('kind', [
248
246
  comparator: z.enum(['gte', 'eq', 'lte']),
249
247
  value: uintStringZod,
250
248
  }),
251
- ]);
252
-
253
- // HTTP-layer mirror of `AssertionSpecSchema` (continuation.ts): the three
254
- // `Check` members plus the two derivation-only members. Reuses `CheckZod`'s
255
- // options so the shared members cannot drift from `Check`.
256
- export const AssertionSpecZod = z.discriminatedUnion('kind', [
257
- ...CheckZod.options,
258
249
  z.object({
259
250
  kind: z.literal('erc20BalanceDeltaGte'),
260
251
  chainId: z.number().int().positive(),
@@ -276,11 +267,11 @@ export type AssertionSpecWire = z.infer<typeof AssertionSpecZod>;
276
267
  // (descriptor.ts, seam C4). It is the disclosure-path widening of
277
268
  // `AssertionSpecZod`: the two balance-`Gte` members accept a symbolic owner
278
269
  // (`assertionOwnerZod`) as well as hex, because the derivation resolves symbolic
279
- // owners to validator-injected slots at settlement. The wire `Check` members
280
- // stay hex-only (`CheckZod`); this widening is confined to the descriptor. The
281
- // `call` member and the two derivation-only delta members are reused verbatim by
282
- // selecting them from `AssertionSpecZod.options` by their `kind` literal, so
283
- // they cannot drift from the source union.
270
+ // owners to validator-injected slots at settlement. The `AssertionSpecZod`
271
+ // balance members stay hex-only; this widening is confined to the descriptor.
272
+ // The `call` member and the two derivation-only delta members are reused
273
+ // verbatim by selecting them from `AssertionSpecZod.options` by their `kind`
274
+ // literal, so they cannot drift from the source union.
284
275
  const assertionSpecOptionByKind = (kind: string) => {
285
276
  const option = AssertionSpecZod.options.find(
286
277
  (o) => o.shape.kind.value === kind,
@@ -324,27 +315,12 @@ export type VerificationDescriptorWire = z.infer<
324
315
  typeof VerificationDescriptorZod
325
316
  >;
326
317
 
327
- // HTTP-layer mirror of `ContinuationPlanSchema`. `nextFlow` is typed
328
- // `z.unknown()` rather than mirroring the full Flow schema in Zod: the client
329
- // treats it as an opaque, re-submittable document and POSTs it back to
330
- // `/compose`, where the Effect `FlowSchema` validates it. The internal
331
- // `ContinuationPlan` type keeps `nextFlow: Flow` precisely typed.
332
- export const ContinuationPlanZod = z.object({
333
- chainId: chainIdZod,
334
- nextFlow: z.unknown(),
335
- check: CheckZod,
336
- validity: z.object({ expiresAtMs: epochMsZod }),
337
- correlationId: z.string().optional(),
338
- });
339
-
340
318
  // What the response says about how one `continuation.settle` node settles.
341
- // `escrow` is present when the provider registered an escrow; `continuation`
342
- // when it handed the next leg back to the caller. A settle node that
343
- // discloses neither is an empty entry. Carries no calldata and no typed data:
344
- // what to submit or sign lives in `actions`.
319
+ // `escrow` is present when the provider registered an escrow; a settle node
320
+ // that discloses none is an empty entry. Carries no calldata and no typed
321
+ // data: what to submit or sign lives in `actions`.
345
322
  export const SettlementZod = z.object({
346
323
  escrow: SettlementEscrowZod.optional(),
347
- continuation: ContinuationPlanZod.optional(),
348
324
  });
349
325
 
350
326
  export type ResourcePort = z.infer<typeof ResourcePortZod>;
@@ -363,4 +339,3 @@ export type ManifestPrecondition = z.infer<typeof ManifestPreconditionZod>;
363
339
  export type ComposeManifest = z.infer<typeof ComposeManifestZod>;
364
340
  export type SettlementEscrowWire = z.infer<typeof SettlementEscrowZod>;
365
341
  export type SettlementWire = z.infer<typeof SettlementZod>;
366
- export type ContinuationPlanWire = z.infer<typeof ContinuationPlanZod>;