@hyperscale0/hsx 1.0.0-alpha.4 → 1.0.0-alpha.6

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/model.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { Span } from "./ast.ts";
9
+ import type { ArchetypeName } from "./archetypes.ts";
9
10
 
10
11
  export const PARTY_KINDS = ["business", "person"] as const;
11
12
  export type PartyKind = (typeof PARTY_KINDS)[number];
@@ -76,6 +77,14 @@ export interface ScheduleTerms {
76
77
  readonly origin: Span;
77
78
  }
78
79
 
80
+ /** One checked reference to an exit that the target archetype exposes. */
81
+ export interface CheckedSettlementReference {
82
+ readonly exit: string;
83
+ readonly origin: Span;
84
+ readonly settlement: string;
85
+ readonly targetArchetype: ArchetypeName;
86
+ }
87
+
79
88
  /**
80
89
  * The checked `held_payment` instantiation: payer funds `amount` into the
81
90
  * settlement's own custody; a decision port releases it to the payee; fees
@@ -105,6 +114,136 @@ interface FixedWindow {
105
114
  readonly raw: string;
106
115
  }
107
116
 
117
+ /**
118
+ * A payer reservation that the payee captures in strict partial slices before
119
+ * posting the remainder. A full payee correction and a full externally decided
120
+ * reversal are separate post-settlement exits. The checked policies refuse
121
+ * partial corrections, negative positions, and timeout-driven movement.
122
+ */
123
+ export interface CheckedCaptureReservation {
124
+ readonly amount: MoneyField;
125
+ readonly archetype: "captured_payment";
126
+ readonly correction: PortRelease;
127
+ readonly externalReversal: PortRelease & { readonly window: FixedWindow };
128
+ readonly name: string;
129
+ readonly origin: Span;
130
+ readonly payee: string;
131
+ readonly payer: string;
132
+ /** Camel-case date field passed to the reservation as its expiry. */
133
+ readonly reserveUntilField: string;
134
+ }
135
+
136
+ /**
137
+ * A payout batch whose capture entries and signed adjustments freeze at close.
138
+ * The checked field names become lineage columns on generated child nouns.
139
+ */
140
+ export interface CheckedSettlementBatch {
141
+ readonly archetype: "settlement_batch";
142
+ readonly closeTriggerField: string;
143
+ readonly externalReversalReferenceField: string;
144
+ readonly feeReferenceField: string;
145
+ readonly name: string;
146
+ readonly origin: Span;
147
+ readonly payoutDestination: string;
148
+ readonly payoutAcknowledgement: PortRelease;
149
+ /** Camel-case field carrying the external payout beneficiary reference. */
150
+ readonly payoutBeneficiaryReferenceField: string;
151
+ readonly settlementAccount: string;
152
+ readonly sourceCaptureReferenceField: string;
153
+ }
154
+
155
+ /** HSX authoring for the existing all-or-nothing round and commitment pair. */
156
+ export interface CheckedFundingRound {
157
+ readonly archetype: "funding_round";
158
+ readonly beneficiary: string;
159
+ readonly cancelPolicy: "before_close";
160
+ readonly closeByField: string;
161
+ readonly closePolicy: "threshold";
162
+ readonly commitment: MoneyField;
163
+ readonly contributor: string;
164
+ readonly failPolicy: "whole_commitment_refund";
165
+ readonly maxContributors: number;
166
+ readonly name: string;
167
+ readonly origin: Span;
168
+ readonly overfundPolicy: "reject";
169
+ readonly target: MoneyField;
170
+ }
171
+
172
+ /** A frozen claimant set distributed by deterministic largest remainder. */
173
+ export interface CheckedWeightedDistribution {
174
+ readonly amount: MoneyField;
175
+ readonly archetype: "weighted_distribution";
176
+ readonly correctionPolicy: "new_distribution";
177
+ readonly maxRecipients: number;
178
+ readonly name: string;
179
+ readonly origin: Span;
180
+ readonly recipient: string;
181
+ readonly recordAtField: string;
182
+ readonly roundingPolicy: "largest_remainder";
183
+ readonly snapshot: PortRelease;
184
+ readonly source: string;
185
+ readonly weight: MoneyField;
186
+ readonly withholdingPolicy: "refuse";
187
+ }
188
+
189
+ /** A reusable draw cap whose linked scheduled obligation owns repayment. */
190
+ export interface CheckedCreditFacility {
191
+ readonly archetype: "credit_facility";
192
+ readonly availabilityPolicy: "revolving" | "non_revolving";
193
+ readonly borrower: string;
194
+ readonly closePolicy: "no_open_draws";
195
+ readonly drawDestination: string;
196
+ readonly expiresAtField: string;
197
+ readonly expiryPolicy: "freeze_draws";
198
+ readonly lender: string;
199
+ readonly limit: MoneyField;
200
+ readonly name: string;
201
+ readonly obligation: CheckedSettlementReference;
202
+ readonly origin: Span;
203
+ }
204
+
205
+ /** A mandate and explicit-attempt policy layered onto scheduled obligation payments. */
206
+ export interface CheckedRecurringCollection {
207
+ readonly archetype: "recurring_collection";
208
+ readonly attemptPolicy: "explicit";
209
+ readonly failurePolicy: "parent_delinquency";
210
+ readonly mandate: PortRelease;
211
+ readonly name: string;
212
+ readonly obligation: CheckedSettlementReference;
213
+ readonly origin: Span;
214
+ readonly periodIdempotency: "obligation_and_anchor";
215
+ readonly retryPolicy: "explicit_attempt";
216
+ }
217
+
218
+ /** A capped payout decided through stored evidence, with no premium inflow. */
219
+ export interface CheckedConditionalDisbursement {
220
+ readonly amount: MoneyField;
221
+ readonly archetype: "conditional_disbursement";
222
+ readonly cap: MoneyField;
223
+ readonly decision: PortRelease;
224
+ readonly destination: string;
225
+ readonly name: string;
226
+ readonly origin: Span;
227
+ readonly recoveryPolicy: "separate_transfer";
228
+ readonly reopenPolicy: "refuse";
229
+ readonly source: string;
230
+ }
231
+
232
+ /** A fixed roster whose stored order rotates one exact shared pot per cycle. */
233
+ export interface CheckedRotatingPool {
234
+ readonly archetype: "rotating_pool";
235
+ readonly contribution: MoneyField;
236
+ readonly defaultPolicy: "due_condition";
237
+ readonly exitPolicy: "before_activation_only";
238
+ readonly guaranteePolicy: "funded_only";
239
+ readonly guarantor?: string;
240
+ readonly members: readonly string[];
241
+ readonly name: string;
242
+ readonly origin: Span;
243
+ readonly payoutOrder: readonly string[];
244
+ readonly schedule: ScheduleTerms;
245
+ }
246
+
108
247
  /** An exact on-top service fee declared as money, never a caller-computed rate. */
109
248
  export interface SwapFee {
110
249
  readonly amount: MoneyField;
@@ -161,10 +300,16 @@ export interface CheckedPremiumForward {
161
300
  readonly carrier: string;
162
301
  /** Platform commission carved from the premium at forwarding, in bps. */
163
302
  readonly commissionBps: number;
303
+ readonly endorsement?: PortRelease;
304
+ readonly endorsementPolicy?: "non_money_only";
305
+ readonly lapsePolicy?: "due_condition";
164
306
  readonly name: string;
165
307
  readonly onCancel?: CancelPolicy;
166
308
  readonly origin: Span;
167
309
  readonly payer: string;
310
+ readonly policyReferenceField?: string;
311
+ readonly renewalDueField?: string;
312
+ readonly renewalPolicy?: "explicit_new_forward";
168
313
  }
169
314
 
170
315
  /**
@@ -191,7 +336,7 @@ export interface CheckedDeposit {
191
336
  * each collected on its own stored-date anchor. The schedule is finite by
192
337
  * construction and every anchor is its own idempotent verb.
193
338
  */
194
- export interface CheckedScheduled {
339
+ interface CheckedScheduledBase {
195
340
  readonly amount: MoneyField;
196
341
  readonly archetype: "scheduled";
197
342
  readonly name: string;
@@ -201,6 +346,26 @@ export interface CheckedScheduled {
201
346
  readonly schedule: ScheduleTerms;
202
347
  }
203
348
 
349
+ /** The original fixed transfer schedule. */
350
+ export interface CheckedScheduledTransfer extends CheckedScheduledBase {
351
+ readonly mode: "transfer";
352
+ }
353
+
354
+ /**
355
+ * The obligation mode of `scheduled`. Each payment names one generated anchor.
356
+ * Refunds reverse one stored payment whole. The checker refuses rescheduling
357
+ * until the runtime can prove an outstanding-balance carry into a new version.
358
+ */
359
+ export interface CheckedScheduledObligation extends CheckedScheduledBase {
360
+ readonly advanceTo?: string;
361
+ readonly debtor: string;
362
+ readonly mode: "obligation";
363
+ }
364
+
365
+ export type CheckedScheduled =
366
+ | CheckedScheduledObligation
367
+ | CheckedScheduledTransfer;
368
+
204
369
  /**
205
370
  * Where an advance's repayment comes from. `schedule` collects it from the
206
371
  * advanced party over finite anchors; `carve` takes it out of the release of a
@@ -209,12 +374,7 @@ export interface CheckedScheduled {
209
374
  */
210
375
  export type AdvanceSource =
211
376
  | { readonly kind: "schedule"; readonly schedule: ScheduleTerms }
212
- | {
213
- readonly kind: "carve";
214
- readonly origin: Span;
215
- /** The held_payment settlement whose release repays this advance. */
216
- readonly settlement: string;
217
- };
377
+ | ({ readonly kind: "carve" } & CheckedSettlementReference);
218
378
 
219
379
  /**
220
380
  * The checked `advance`: the funder disburses the advance to the advanced
@@ -285,14 +445,22 @@ interface PortRelease {
285
445
 
286
446
  export type CheckedSettlement =
287
447
  | CheckedAdvance
448
+ | CheckedCaptureReservation
449
+ | CheckedConditionalDisbursement
450
+ | CheckedCreditFacility
288
451
  | CheckedDeposit
452
+ | CheckedFundingRound
289
453
  | CheckedHeldPayment
290
454
  | CheckedInstantTransfer
291
455
  | CheckedMetered
292
456
  | CheckedPooledSplit
293
457
  | CheckedPremiumForward
458
+ | CheckedRecurringCollection
459
+ | CheckedRotatingPool
294
460
  | CheckedScheduled
295
- | CheckedSwap;
461
+ | CheckedSettlementBatch
462
+ | CheckedSwap
463
+ | CheckedWeightedDistribution;
296
464
 
297
465
  export type PortFieldType =
298
466
  | { readonly asset: string; readonly kind: "asset_id" }
@@ -315,6 +483,7 @@ export interface CheckedPort {
315
483
  }
316
484
 
317
485
  export interface CheckedProgram {
486
+ readonly derivedAmounts: readonly CheckedDerivedAmount[];
318
487
  readonly assets: readonly CheckedAsset[];
319
488
  readonly name: string;
320
489
  readonly parties: readonly CheckedParty[];
@@ -323,6 +492,16 @@ export interface CheckedProgram {
323
492
  readonly title: string;
324
493
  }
325
494
 
495
+ /** One machine-computed percentage of a stored money field. */
496
+ export interface CheckedDerivedAmount {
497
+ readonly baseField: string;
498
+ readonly bearer: string;
499
+ readonly bps: number;
500
+ readonly field: string;
501
+ readonly origin: Span;
502
+ readonly settlement: string;
503
+ }
504
+
326
505
  /**
327
506
  * A semantic problem. `error` blocks lowering; `warning` is the compiler's
328
507
  * lint voice, the program is legal but the author should look.
package/src/version.ts CHANGED
@@ -14,4 +14,4 @@
14
14
  export const HSX_IR_VERSION = 1;
15
15
 
16
16
  /** Kept equal to the package.json version by `test/spec.spec.ts`. */
17
- export const HSX_VERSION = "1.0.0-alpha.4";
17
+ export const HSX_VERSION = "1.0.0-alpha.6";