@amalgm/live 0.2.81-preview.45708334404 → 0.2.81-preview.46146788616
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/apply/contracts.d.ts +17 -348
- package/dist/apply/contracts.js +1 -108
- package/dist/apply/fetch-ahead.d.ts +0 -45
- package/dist/apply/fetch-ahead.js +1 -169
- package/dist/apply/index.d.ts +0 -2
- package/dist/apply/index.js +1 -10
- package/dist/apply/journey.d.ts +0 -35
- package/dist/apply/journey.js +1 -403
- package/dist/apply/lane.d.ts +0 -34
- package/dist/apply/lane.js +1 -72
- package/dist/apply/line.d.ts +0 -28
- package/dist/apply/line.js +1 -81
- package/dist/apply/plans.d.ts +0 -14
- package/dist/apply/plans.js +1 -182
- package/dist/apply/rail.d.ts +0 -60
- package/dist/apply/rail.js +1 -776
- package/dist/apply/selection.d.ts +0 -15
- package/dist/apply/selection.js +1 -111
- package/dist/apply/settling.d.ts +0 -57
- package/dist/apply/settling.js +1 -63
- package/dist/apply/showing.d.ts +1 -95
- package/dist/apply/showing.js +1 -203
- package/dist/apply/type-adapters.d.ts +0 -8
- package/dist/apply/type-adapters.js +1 -39
- package/dist/apply/window.d.ts +0 -109
- package/dist/apply/window.js +1 -323
- package/dist/clash/bodmas.d.ts +1 -51
- package/dist/clash/bodmas.js +1 -130
- package/dist/clash/echo.d.ts +0 -27
- package/dist/clash/echo.js +1 -35
- package/dist/clash/index.d.ts +0 -1
- package/dist/clash/index.js +1 -6
- package/dist/clash/local-work.d.ts +0 -36
- package/dist/clash/local-work.js +1 -51
- package/dist/clash/resolution.d.ts +0 -13
- package/dist/clash/resolution.js +1 -15
- package/dist/clash/tetris.d.ts +0 -18
- package/dist/clash/tetris.js +1 -26
- package/dist/{sharing/command-input.d.ts → commands/input.d.ts} +5 -9
- package/dist/commands/input.js +1 -0
- package/dist/commands/mcp.d.ts +23 -0
- package/dist/commands/mcp.js +1 -0
- package/dist/contracts/content.d.ts +0 -78
- package/dist/contracts/content.js +1 -251
- package/dist/contracts/index.d.ts +0 -6
- package/dist/contracts/index.js +1 -9
- package/dist/contracts/protection.d.ts +16 -22
- package/dist/contracts/protection.js +1 -53
- package/dist/contracts/validate.d.ts +0 -18
- package/dist/contracts/validate.js +1 -23
- package/dist/detection/adapter-contract.d.ts +0 -75
- package/dist/detection/adapter-contract.js +1 -130
- package/dist/detection/batch.d.ts +1 -14
- package/dist/detection/batch.js +1 -75
- package/dist/detection/classify.d.ts +6 -40
- package/dist/detection/classify.js +1 -45
- package/dist/detection/content.d.ts +0 -17
- package/dist/detection/content.js +1 -76
- package/dist/detection/dispositions.d.ts +3 -82
- package/dist/detection/dispositions.js +0 -20
- package/dist/detection/echo.d.ts +0 -20
- package/dist/detection/echo.js +1 -33
- package/dist/detection/identity.d.ts +0 -56
- package/dist/detection/identity.js +1 -229
- package/dist/detection/ignore-lines.d.ts +0 -15
- package/dist/detection/ignore-lines.js +2 -212
- package/dist/detection/index.d.ts +0 -31
- package/dist/detection/index.js +1 -48
- package/dist/detection/package-proposal.d.ts +0 -24
- package/dist/detection/package-proposal.js +1 -114
- package/dist/detection/record-order.d.ts +5 -19
- package/dist/detection/record-order.js +1 -311
- package/dist/detection/record-proposal.d.ts +0 -98
- package/dist/detection/record-proposal.js +1 -384
- package/dist/detection/refusal.d.ts +0 -69
- package/dist/detection/refusal.js +1 -78
- package/dist/detection/removals.d.ts +0 -8
- package/dist/detection/removals.js +1 -51
- package/dist/detection/scoped-identity.d.ts +1 -61
- package/dist/detection/scoped-identity.js +1 -189
- package/dist/detection/skip-defaults.d.ts +0 -16
- package/dist/detection/skip-defaults.js +3 -20
- package/dist/detection/skip-policy.d.ts +0 -58
- package/dist/detection/skip-policy.js +1 -203
- package/dist/detection/watch-boundary.d.ts +0 -16
- package/dist/detection/watch-boundary.js +1 -47
- package/dist/drive/contracts.d.ts +0 -182
- package/dist/drive/contracts.js +1 -30
- package/dist/drive/drive.d.ts +0 -147
- package/dist/drive/drive.js +1 -414
- package/dist/drive/held-removals.d.ts +0 -49
- package/dist/drive/held-removals.js +1 -136
- package/dist/drive/index.d.ts +0 -7
- package/dist/drive/index.js +1 -16
- package/dist/drive/kept.d.ts +0 -10
- package/dist/drive/kept.js +1 -33
- package/dist/drive/listing.d.ts +2 -13
- package/dist/drive/listing.js +1 -84
- package/dist/drive/map-index.d.ts +0 -59
- package/dist/drive/map-index.js +1 -240
- package/dist/drive/placements.d.ts +0 -71
- package/dist/drive/placements.js +1 -164
- package/dist/drive/records.d.ts +0 -43
- package/dist/drive/records.js +1 -85
- package/dist/drive/where.d.ts +7 -94
- package/dist/drive/where.js +2 -378
- package/dist/entities/accepted-view.d.ts +0 -47
- package/dist/entities/accepted-view.js +1 -260
- package/dist/entities/bytes.d.ts +0 -16
- package/dist/entities/bytes.js +1 -112
- package/dist/entities/cloud.d.ts +0 -125
- package/dist/entities/cloud.js +1 -430
- package/dist/entities/graph-head.d.ts +0 -32
- package/dist/entities/graph-head.js +1 -114
- package/dist/entities/graph-pages.d.ts +0 -75
- package/dist/entities/graph-pages.js +1 -239
- package/dist/entities/index.d.ts +0 -28
- package/dist/entities/index.js +1 -40
- package/dist/entities/package-pages.d.ts +0 -28
- package/dist/entities/package-pages.js +1 -91
- package/dist/entities/placement-owed.d.ts +0 -27
- package/dist/entities/placement-owed.js +1 -86
- package/dist/entities/reducer.d.ts +0 -30
- package/dist/entities/reducer.js +1 -130
- package/dist/entities/registry-graph.d.ts +0 -80
- package/dist/entities/registry-graph.js +1 -478
- package/dist/entities/rules.d.ts +7 -72
- package/dist/entities/rules.js +1 -230
- package/dist/entities/types.d.ts +0 -71
- package/dist/entities/types.js +1 -55
- package/dist/entities/units.d.ts +0 -25
- package/dist/entities/units.js +1 -27
- package/dist/faults/classify.d.ts +0 -24
- package/dist/faults/classify.js +1 -77
- package/dist/faults/index.d.ts +0 -8
- package/dist/faults/index.js +1 -13
- package/dist/faults/need.d.ts +0 -24
- package/dist/faults/need.js +1 -76
- package/dist/faults/recover.d.ts +0 -18
- package/dist/faults/recover.js +1 -44
- package/dist/faults/report.d.ts +0 -23
- package/dist/faults/report.js +1 -130
- package/dist/faults/scrub.d.ts +0 -27
- package/dist/faults/scrub.js +3 -159
- package/dist/faults/wire.d.ts +0 -13
- package/dist/faults/wire.js +1 -42
- package/dist/files/accepted-files.d.ts +0 -37
- package/dist/files/accepted-files.js +1 -129
- package/dist/files/api.d.ts +0 -1
- package/dist/files/api.js +1 -83
- package/dist/files/browse-types.d.ts +7 -7
- package/dist/files/browse-types.js +1 -46
- package/dist/files/browser.d.ts +4 -2
- package/dist/files/browser.js +1 -100
- package/dist/files/cloud-files.d.ts +6 -5
- package/dist/files/cloud-files.js +1 -153
- package/dist/files/commands.d.ts +0 -54
- package/dist/files/commands.js +1 -140
- package/dist/files/computer-address.d.ts +0 -10
- package/dist/files/computer-address.js +1 -48
- package/dist/files/index.d.ts +1 -3
- package/dist/files/index.js +1 -18
- package/dist/files/local-files.d.ts +0 -2
- package/dist/files/local-files.js +1 -104
- package/dist/files/media-type.d.ts +0 -1
- package/dist/files/media-type.js +1 -50
- package/dist/files/own-folders.d.ts +0 -29
- package/dist/files/own-folders.js +1 -50
- package/dist/files/plans.d.ts +1 -16
- package/dist/files/plans.js +1 -36
- package/dist/files/trash.d.ts +0 -97
- package/dist/files/trash.js +1 -287
- package/dist/files/usage-categories.d.ts +0 -13
- package/dist/files/usage-categories.js +1 -33
- package/dist/files/usage-chain.d.ts +0 -27
- package/dist/files/usage-chain.js +1 -44
- package/dist/files/usage-effect.d.ts +0 -34
- package/dist/files/usage-effect.js +1 -29
- package/dist/files/usage.d.ts +3 -47
- package/dist/files/usage.js +1 -132
- package/dist/git/alternates.d.ts +0 -21
- package/dist/git/alternates.js +1 -79
- package/dist/git/artifact.d.ts +0 -69
- package/dist/git/artifact.js +1 -190
- package/dist/git/chain.d.ts +0 -32
- package/dist/git/chain.js +1 -55
- package/dist/git/holds.d.ts +30 -0
- package/dist/git/holds.js +1 -0
- package/dist/git/index.d.ts +4 -2
- package/dist/git/index.js +1 -11
- package/dist/git/parts.d.ts +10 -0
- package/dist/git/parts.js +7 -0
- package/dist/git/places.d.ts +6 -0
- package/dist/git/places.js +1 -0
- package/dist/git/plan.d.ts +0 -40
- package/dist/git/plan.js +1 -97
- package/dist/git/play.d.ts +11 -72
- package/dist/git/play.js +4 -318
- package/dist/git/refs.d.ts +0 -18
- package/dist/git/refs.js +8 -63
- package/dist/git/restore.d.ts +8 -0
- package/dist/git/restore.js +2 -0
- package/dist/git/state.d.ts +0 -103
- package/dist/git/state.js +3 -209
- package/dist/git/tag.d.ts +5 -51
- package/dist/git/tag.js +3 -68
- package/dist/git/text.d.ts +0 -3
- package/dist/git/text.js +1 -4
- package/dist/git/turns.d.ts +0 -104
- package/dist/git/turns.js +1 -153
- package/dist/history/history.d.ts +2 -14
- package/dist/history/history.js +1 -51
- package/dist/history/identity.d.ts +11 -0
- package/dist/history/identity.js +1 -0
- package/dist/history/index.d.ts +6 -9
- package/dist/history/index.js +1 -10
- package/dist/history/rule.d.ts +3 -38
- package/dist/history/rule.js +1 -78
- package/dist/history/runs.d.ts +17 -0
- package/dist/history/runs.js +1 -0
- package/dist/history/types.d.ts +6 -64
- package/dist/history/types.js +0 -9
- package/dist/history/version.d.ts +2 -8
- package/dist/history/version.js +1 -32
- package/dist/index.d.ts +0 -15
- package/dist/index.js +1 -32
- package/dist/records/authority.d.ts +0 -7
- package/dist/records/authority.js +1 -28
- package/dist/records/codec.d.ts +0 -2
- package/dist/records/codec.js +1 -43
- package/dist/records/contracts.d.ts +0 -20
- package/dist/records/contracts.js +1 -190
- package/dist/records/inbox.d.ts +0 -3
- package/dist/records/inbox.js +1 -40
- package/dist/records/index.d.ts +0 -2
- package/dist/records/index.js +1 -18
- package/dist/records/intentional.d.ts +0 -24
- package/dist/records/intentional.js +1 -58
- package/dist/records/outbox.d.ts +0 -10
- package/dist/records/outbox.js +1 -46
- package/dist/records/owned-effects.d.ts +0 -8
- package/dist/records/owned-effects.js +1 -37
- package/dist/records/publication.d.ts +1 -67
- package/dist/records/publication.js +1 -583
- package/dist/records/rail-ports.d.ts +2 -81
- package/dist/records/rail-ports.js +0 -3
- package/dist/records/rail.d.ts +1 -42
- package/dist/records/rail.js +1 -195
- package/dist/records/receive-channel.d.ts +0 -42
- package/dist/records/receive-channel.js +1 -131
- package/dist/records/receive-loop.d.ts +0 -48
- package/dist/records/receive-loop.js +1 -278
- package/dist/records/receive-pages.d.ts +0 -23
- package/dist/records/receive-pages.js +1 -98
- package/dist/records/retry-clock.d.ts +0 -3
- package/dist/records/retry-clock.js +1 -35
- package/dist/records/send-batch.d.ts +0 -45
- package/dist/records/send-batch.js +1 -119
- package/dist/records/send-freeing.d.ts +4 -42
- package/dist/records/send-freeing.js +1 -124
- package/dist/records/send-line.d.ts +1 -82
- package/dist/records/send-line.js +1 -411
- package/dist/records/send-preparation.d.ts +0 -39
- package/dist/records/send-preparation.js +1 -226
- package/dist/records/submit-frame.d.ts +0 -28
- package/dist/records/submit-frame.js +1 -161
- package/dist/records/unsent-count.d.ts +0 -24
- package/dist/records/unsent-count.js +1 -91
- package/dist/records/wire.d.ts +0 -10
- package/dist/records/wire.js +1 -121
- package/dist/registration/home-layout.d.ts +0 -18
- package/dist/registration/home-layout.js +1 -34
- package/dist/registration/index.d.ts +0 -3
- package/dist/registration/index.js +1 -5
- package/dist/registration/user-ground.d.ts +0 -165
- package/dist/registration/user-ground.js +1 -399
- package/dist/sharing/access.d.ts +0 -8
- package/dist/sharing/access.js +1 -51
- package/dist/sharing/cli.d.ts +0 -7
- package/dist/sharing/cli.js +8 -88
- package/dist/sharing/commands.d.ts +3 -16
- package/dist/sharing/commands.js +1 -164
- package/dist/sharing/construct.d.ts +0 -10
- package/dist/sharing/construct.js +1 -47
- package/dist/sharing/download.d.ts +0 -12
- package/dist/sharing/download.js +1 -45
- package/dist/sharing/entity.d.ts +0 -11
- package/dist/sharing/entity.js +1 -53
- package/dist/sharing/errors.d.ts +0 -2
- package/dist/sharing/errors.js +1 -11
- package/dist/sharing/grants.d.ts +0 -15
- package/dist/sharing/grants.js +1 -103
- package/dist/sharing/index.d.ts +3 -9
- package/dist/sharing/index.js +1 -16
- package/dist/sharing/mcp.d.ts +2 -25
- package/dist/sharing/mcp.js +1 -31
- package/dist/sharing/permissions.d.ts +0 -8
- package/dist/sharing/permissions.js +1 -45
- package/dist/sharing/publish.d.ts +0 -8
- package/dist/sharing/publish.js +1 -42
- package/dist/sharing/share.d.ts +0 -10
- package/dist/sharing/share.js +1 -31
- package/dist/sharing/sharing.d.ts +0 -5
- package/dist/sharing/sharing.js +1 -22
- package/dist/sharing/types.d.ts +0 -47
- package/dist/sharing/types.js +1 -15
- package/dist/steps.d.ts +0 -18
- package/dist/steps.js +1 -58
- package/dist/transfer/artifacts.d.ts +0 -19
- package/dist/transfer/artifacts.js +1 -89
- package/dist/transfer/batches.d.ts +0 -11
- package/dist/transfer/batches.js +1 -40
- package/dist/transfer/cargo-pack.d.ts +39 -0
- package/dist/transfer/cargo-pack.js +1 -0
- package/dist/transfer/cargo.d.ts +0 -39
- package/dist/transfer/cargo.js +1 -130
- package/dist/transfer/dispute.d.ts +9 -0
- package/dist/transfer/dispute.js +1 -0
- package/dist/transfer/download.d.ts +0 -97
- package/dist/transfer/download.js +1 -627
- package/dist/transfer/index.d.ts +2 -3
- package/dist/transfer/index.js +1 -10
- package/dist/transfer/parallel.d.ts +0 -19
- package/dist/transfer/parallel.js +1 -136
- package/dist/transfer/ranges.d.ts +0 -22
- package/dist/transfer/ranges.js +1 -59
- package/dist/transfer/refs.d.ts +0 -22
- package/dist/transfer/refs.js +1 -41
- package/dist/transfer/upload.d.ts +0 -49
- package/dist/transfer/upload.js +1 -248
- package/dist/versions/admit.d.ts +8 -0
- package/dist/versions/admit.js +1 -0
- package/dist/versions/api.d.ts +3 -0
- package/dist/versions/api.js +1 -0
- package/dist/versions/cli-text.d.ts +3 -0
- package/dist/versions/cli-text.js +5 -0
- package/dist/versions/cli.d.ts +12 -0
- package/dist/versions/cli.js +19 -0
- package/dist/versions/commands.d.ts +31 -0
- package/dist/versions/commands.js +1 -0
- package/dist/versions/content.d.ts +4 -0
- package/dist/versions/content.js +1 -0
- package/dist/versions/dates.d.ts +15 -0
- package/dist/versions/dates.js +1 -0
- package/dist/versions/deliver.d.ts +25 -0
- package/dist/versions/deliver.js +2 -0
- package/dist/versions/errors.d.ts +10 -0
- package/dist/versions/errors.js +1 -0
- package/dist/versions/index.d.ts +18 -0
- package/dist/versions/index.js +1 -0
- package/dist/versions/line.d.ts +8 -0
- package/dist/versions/line.js +1 -0
- package/dist/versions/list.d.ts +5 -0
- package/dist/versions/list.js +1 -0
- package/dist/versions/mcp.d.ts +3 -0
- package/dist/versions/mcp.js +1 -0
- package/dist/versions/ports.d.ts +46 -0
- package/dist/versions/ports.js +0 -0
- package/dist/versions/read.d.ts +12 -0
- package/dist/versions/read.js +1 -0
- package/dist/versions/restore.d.ts +5 -0
- package/dist/versions/restore.js +1 -0
- package/dist/versions/services.d.ts +4 -0
- package/dist/versions/services.js +1 -0
- package/dist/versions/show.d.ts +5 -0
- package/dist/versions/show.js +1 -0
- package/dist/versions/types.d.ts +64 -0
- package/dist/versions/types.js +0 -0
- package/dist/versions/versions.d.ts +10 -0
- package/dist/versions/versions.js +1 -0
- package/dist/watching/coverage.d.ts +0 -23
- package/dist/watching/coverage.js +1 -44
- package/dist/watching/index.d.ts +0 -6
- package/dist/watching/index.js +1 -9
- package/dist/watching/maintenance.d.ts +0 -66
- package/dist/watching/maintenance.js +1 -204
- package/dist/watching/suspicion.d.ts +0 -59
- package/dist/watching/suspicion.js +1 -513
- package/dist/workspace/api.d.ts +0 -1
- package/dist/workspace/api.js +1 -108
- package/dist/workspace/entries.d.ts +0 -3
- package/dist/workspace/entries.js +1 -77
- package/dist/workspace/identity.d.ts +0 -2
- package/dist/workspace/identity.js +1 -27
- package/dist/workspace/index.d.ts +0 -1
- package/dist/workspace/index.js +1 -5
- package/dist/workspace/registry.d.ts +0 -12
- package/dist/workspace/registry.js +1 -255
- package/dist/workspace/types.d.ts +0 -19
- package/dist/workspace/types.js +0 -2
- package/dist-cjs/apply/contracts.js +1 -115
- package/dist-cjs/apply/fetch-ahead.js +1 -174
- package/dist-cjs/apply/index.js +1 -26
- package/dist-cjs/apply/journey.js +1 -408
- package/dist-cjs/apply/lane.js +1 -76
- package/dist-cjs/apply/line.js +1 -91
- package/dist-cjs/apply/plans.js +1 -185
- package/dist-cjs/apply/rail.js +1 -780
- package/dist-cjs/apply/selection.js +1 -117
- package/dist-cjs/apply/settling.js +1 -67
- package/dist-cjs/apply/showing.js +1 -211
- package/dist-cjs/apply/type-adapters.js +1 -43
- package/dist-cjs/apply/window.js +1 -331
- package/dist-cjs/clash/bodmas.js +1 -133
- package/dist-cjs/clash/echo.js +1 -38
- package/dist-cjs/clash/index.js +1 -22
- package/dist-cjs/clash/local-work.js +1 -57
- package/dist-cjs/clash/resolution.js +1 -19
- package/dist-cjs/clash/tetris.js +1 -29
- package/dist-cjs/commands/input.js +1 -0
- package/dist-cjs/commands/mcp.js +1 -0
- package/dist-cjs/contracts/content.js +1 -267
- package/dist-cjs/contracts/index.js +1 -25
- package/dist-cjs/contracts/protection.js +1 -58
- package/dist-cjs/contracts/validate.js +1 -31
- package/dist-cjs/detection/adapter-contract.js +1 -135
- package/dist-cjs/detection/batch.js +1 -78
- package/dist-cjs/detection/classify.js +1 -52
- package/dist-cjs/detection/content.js +1 -82
- package/dist-cjs/detection/dispositions.js +1 -21
- package/dist-cjs/detection/echo.js +1 -36
- package/dist-cjs/detection/identity.js +1 -239
- package/dist-cjs/detection/ignore-lines.js +2 -216
- package/dist-cjs/detection/index.js +1 -64
- package/dist-cjs/detection/package-proposal.js +1 -120
- package/dist-cjs/detection/record-order.js +1 -314
- package/dist-cjs/detection/record-proposal.js +1 -398
- package/dist-cjs/detection/refusal.js +1 -88
- package/dist-cjs/detection/removals.js +1 -54
- package/dist-cjs/detection/scoped-identity.js +1 -192
- package/dist-cjs/detection/skip-defaults.js +2 -22
- package/dist-cjs/detection/skip-policy.js +1 -208
- package/dist-cjs/detection/watch-boundary.js +1 -51
- package/dist-cjs/drive/contracts.js +1 -34
- package/dist-cjs/drive/drive.js +1 -418
- package/dist-cjs/drive/held-removals.js +1 -140
- package/dist-cjs/drive/index.js +1 -32
- package/dist-cjs/drive/kept.js +1 -36
- package/dist-cjs/drive/listing.js +1 -87
- package/dist-cjs/drive/map-index.js +1 -245
- package/dist-cjs/drive/placements.js +1 -168
- package/dist-cjs/drive/records.js +1 -93
- package/dist-cjs/drive/where.js +2 -394
- package/dist-cjs/entities/accepted-view.js +1 -264
- package/dist-cjs/entities/bytes.js +1 -124
- package/dist-cjs/entities/cloud.js +1 -451
- package/dist-cjs/entities/graph-head.js +1 -121
- package/dist-cjs/entities/graph-pages.js +1 -257
- package/dist-cjs/entities/index.js +1 -56
- package/dist-cjs/entities/package-pages.js +1 -99
- package/dist-cjs/entities/placement-owed.js +1 -91
- package/dist-cjs/entities/reducer.js +1 -136
- package/dist-cjs/entities/registry-graph.js +1 -483
- package/dist-cjs/entities/rules.js +1 -251
- package/dist-cjs/entities/types.js +1 -61
- package/dist-cjs/entities/units.js +1 -30
- package/dist-cjs/faults/classify.js +1 -83
- package/dist-cjs/faults/index.js +1 -32
- package/dist-cjs/faults/need.js +1 -84
- package/dist-cjs/faults/recover.js +1 -49
- package/dist-cjs/faults/report.js +1 -135
- package/dist-cjs/faults/scrub.js +3 -169
- package/dist-cjs/faults/wire.js +1 -47
- package/dist-cjs/files/accepted-files.js +1 -135
- package/dist-cjs/files/api.js +1 -85
- package/dist-cjs/files/browse-types.js +1 -54
- package/dist-cjs/files/browser.js +1 -104
- package/dist-cjs/files/cloud-files.js +1 -159
- package/dist-cjs/files/commands.js +1 -145
- package/dist-cjs/files/computer-address.js +1 -52
- package/dist-cjs/files/index.js +1 -65
- package/dist-cjs/files/local-files.js +1 -108
- package/dist-cjs/files/media-type.js +1 -53
- package/dist-cjs/files/own-folders.js +1 -53
- package/dist-cjs/files/plans.js +1 -40
- package/dist-cjs/files/trash.js +1 -299
- package/dist-cjs/files/usage-categories.js +1 -37
- package/dist-cjs/files/usage-chain.js +1 -49
- package/dist-cjs/files/usage-effect.js +1 -34
- package/dist-cjs/files/usage.js +1 -140
- package/dist-cjs/git/alternates.js +1 -84
- package/dist-cjs/git/artifact.js +1 -202
- package/dist-cjs/git/chain.js +1 -59
- package/dist-cjs/git/holds.js +1 -0
- package/dist-cjs/git/index.js +1 -29
- package/dist-cjs/git/parts.js +7 -0
- package/dist-cjs/git/places.js +1 -0
- package/dist-cjs/git/plan.js +1 -100
- package/dist-cjs/git/play.js +4 -323
- package/dist-cjs/git/refs.js +8 -72
- package/dist-cjs/git/restore.js +2 -0
- package/dist-cjs/git/state.js +3 -230
- package/dist-cjs/git/tag.js +3 -72
- package/dist-cjs/git/text.js +1 -8
- package/dist-cjs/git/turns.js +1 -162
- package/dist-cjs/history/history.js +1 -53
- package/dist-cjs/history/identity.js +1 -0
- package/dist-cjs/history/index.js +1 -21
- package/dist-cjs/history/rule.js +1 -83
- package/dist-cjs/history/runs.js +1 -0
- package/dist-cjs/history/types.js +1 -10
- package/dist-cjs/history/version.js +1 -36
- package/dist-cjs/index.js +1 -48
- package/dist-cjs/records/authority.js +1 -31
- package/dist-cjs/records/codec.js +1 -49
- package/dist-cjs/records/contracts.js +1 -196
- package/dist-cjs/records/inbox.js +1 -43
- package/dist-cjs/records/index.js +1 -47
- package/dist-cjs/records/intentional.js +1 -61
- package/dist-cjs/records/outbox.js +1 -50
- package/dist-cjs/records/owned-effects.js +1 -41
- package/dist-cjs/records/publication.js +1 -593
- package/dist-cjs/records/rail-ports.js +1 -4
- package/dist-cjs/records/rail.js +1 -199
- package/dist-cjs/records/receive-channel.js +1 -136
- package/dist-cjs/records/receive-loop.js +1 -282
- package/dist-cjs/records/receive-pages.js +1 -103
- package/dist-cjs/records/retry-clock.js +1 -39
- package/dist-cjs/records/send-batch.js +1 -126
- package/dist-cjs/records/send-freeing.js +1 -128
- package/dist-cjs/records/send-line.js +1 -415
- package/dist-cjs/records/send-preparation.js +1 -230
- package/dist-cjs/records/submit-frame.js +1 -167
- package/dist-cjs/records/unsent-count.js +1 -95
- package/dist-cjs/records/wire.js +1 -127
- package/dist-cjs/registration/home-layout.js +1 -38
- package/dist-cjs/registration/index.js +1 -21
- package/dist-cjs/registration/user-ground.js +1 -407
- package/dist-cjs/sharing/access.js +1 -56
- package/dist-cjs/sharing/cli.js +8 -93
- package/dist-cjs/sharing/commands.js +1 -169
- package/dist-cjs/sharing/construct.js +1 -53
- package/dist-cjs/sharing/download.js +1 -48
- package/dist-cjs/sharing/entity.js +1 -59
- package/dist-cjs/sharing/errors.js +1 -14
- package/dist-cjs/sharing/grants.js +1 -108
- package/dist-cjs/sharing/index.js +1 -36
- package/dist-cjs/sharing/mcp.js +1 -33
- package/dist-cjs/sharing/permissions.js +1 -47
- package/dist-cjs/sharing/publish.js +1 -45
- package/dist-cjs/sharing/share.js +1 -36
- package/dist-cjs/sharing/sharing.js +1 -24
- package/dist-cjs/sharing/types.js +1 -19
- package/dist-cjs/steps.js +1 -64
- package/dist-cjs/transfer/artifacts.js +1 -95
- package/dist-cjs/transfer/batches.js +1 -44
- package/dist-cjs/transfer/cargo-pack.js +1 -0
- package/dist-cjs/transfer/cargo.js +1 -135
- package/dist-cjs/transfer/dispute.js +1 -0
- package/dist-cjs/transfer/download.js +1 -634
- package/dist-cjs/transfer/index.js +1 -30
- package/dist-cjs/transfer/parallel.js +1 -143
- package/dist-cjs/transfer/ranges.js +1 -63
- package/dist-cjs/transfer/refs.js +1 -45
- package/dist-cjs/transfer/upload.js +1 -256
- package/dist-cjs/versions/admit.js +1 -0
- package/dist-cjs/versions/api.js +1 -0
- package/dist-cjs/versions/cli-text.js +5 -0
- package/dist-cjs/versions/cli.js +19 -0
- package/dist-cjs/versions/commands.js +1 -0
- package/dist-cjs/versions/content.js +1 -0
- package/dist-cjs/versions/dates.js +1 -0
- package/dist-cjs/versions/deliver.js +2 -0
- package/dist-cjs/versions/errors.js +1 -0
- package/dist-cjs/versions/index.js +1 -0
- package/dist-cjs/versions/line.js +1 -0
- package/dist-cjs/versions/list.js +1 -0
- package/dist-cjs/versions/mcp.js +1 -0
- package/dist-cjs/versions/ports.js +1 -0
- package/dist-cjs/versions/read.js +1 -0
- package/dist-cjs/versions/restore.js +1 -0
- package/dist-cjs/versions/services.js +1 -0
- package/dist-cjs/versions/show.js +1 -0
- package/dist-cjs/versions/types.js +1 -0
- package/dist-cjs/versions/versions.js +1 -0
- package/dist-cjs/watching/coverage.js +1 -48
- package/dist-cjs/watching/index.js +1 -25
- package/dist-cjs/watching/maintenance.js +1 -208
- package/dist-cjs/watching/suspicion.js +1 -517
- package/dist-cjs/workspace/api.js +1 -110
- package/dist-cjs/workspace/entries.js +1 -82
- package/dist-cjs/workspace/identity.js +1 -32
- package/dist-cjs/workspace/index.js +1 -15
- package/dist-cjs/workspace/registry.js +1 -259
- package/dist-cjs/workspace/types.js +1 -3
- package/package.json +22 -7
- package/PURPOSE.md +0 -697
- package/dist/apply/contracts.d.ts.map +0 -1
- package/dist/apply/contracts.js.map +0 -1
- package/dist/apply/fetch-ahead.d.ts.map +0 -1
- package/dist/apply/fetch-ahead.js.map +0 -1
- package/dist/apply/index.d.ts.map +0 -1
- package/dist/apply/index.js.map +0 -1
- package/dist/apply/journey.d.ts.map +0 -1
- package/dist/apply/journey.js.map +0 -1
- package/dist/apply/lane.d.ts.map +0 -1
- package/dist/apply/lane.js.map +0 -1
- package/dist/apply/line.d.ts.map +0 -1
- package/dist/apply/line.js.map +0 -1
- package/dist/apply/plans.d.ts.map +0 -1
- package/dist/apply/plans.js.map +0 -1
- package/dist/apply/rail.d.ts.map +0 -1
- package/dist/apply/rail.js.map +0 -1
- package/dist/apply/selection.d.ts.map +0 -1
- package/dist/apply/selection.js.map +0 -1
- package/dist/apply/settling.d.ts.map +0 -1
- package/dist/apply/settling.js.map +0 -1
- package/dist/apply/showing.d.ts.map +0 -1
- package/dist/apply/showing.js.map +0 -1
- package/dist/apply/type-adapters.d.ts.map +0 -1
- package/dist/apply/type-adapters.js.map +0 -1
- package/dist/apply/window.d.ts.map +0 -1
- package/dist/apply/window.js.map +0 -1
- package/dist/clash/bodmas.d.ts.map +0 -1
- package/dist/clash/bodmas.js.map +0 -1
- package/dist/clash/echo.d.ts.map +0 -1
- package/dist/clash/echo.js.map +0 -1
- package/dist/clash/index.d.ts.map +0 -1
- package/dist/clash/index.js.map +0 -1
- package/dist/clash/local-work.d.ts.map +0 -1
- package/dist/clash/local-work.js.map +0 -1
- package/dist/clash/resolution.d.ts.map +0 -1
- package/dist/clash/resolution.js.map +0 -1
- package/dist/clash/tetris.d.ts.map +0 -1
- package/dist/clash/tetris.js.map +0 -1
- package/dist/contracts/content.d.ts.map +0 -1
- package/dist/contracts/content.js.map +0 -1
- package/dist/contracts/index.d.ts.map +0 -1
- package/dist/contracts/index.js.map +0 -1
- package/dist/contracts/protection.d.ts.map +0 -1
- package/dist/contracts/protection.js.map +0 -1
- package/dist/contracts/validate.d.ts.map +0 -1
- package/dist/contracts/validate.js.map +0 -1
- package/dist/detection/adapter-contract.d.ts.map +0 -1
- package/dist/detection/adapter-contract.js.map +0 -1
- package/dist/detection/batch.d.ts.map +0 -1
- package/dist/detection/batch.js.map +0 -1
- package/dist/detection/classify.d.ts.map +0 -1
- package/dist/detection/classify.js.map +0 -1
- package/dist/detection/content.d.ts.map +0 -1
- package/dist/detection/content.js.map +0 -1
- package/dist/detection/dispositions.d.ts.map +0 -1
- package/dist/detection/dispositions.js.map +0 -1
- package/dist/detection/echo.d.ts.map +0 -1
- package/dist/detection/echo.js.map +0 -1
- package/dist/detection/identity.d.ts.map +0 -1
- package/dist/detection/identity.js.map +0 -1
- package/dist/detection/ignore-lines.d.ts.map +0 -1
- package/dist/detection/ignore-lines.js.map +0 -1
- package/dist/detection/index.d.ts.map +0 -1
- package/dist/detection/index.js.map +0 -1
- package/dist/detection/package-proposal.d.ts.map +0 -1
- package/dist/detection/package-proposal.js.map +0 -1
- package/dist/detection/record-order.d.ts.map +0 -1
- package/dist/detection/record-order.js.map +0 -1
- package/dist/detection/record-proposal.d.ts.map +0 -1
- package/dist/detection/record-proposal.js.map +0 -1
- package/dist/detection/refusal.d.ts.map +0 -1
- package/dist/detection/refusal.js.map +0 -1
- package/dist/detection/removals.d.ts.map +0 -1
- package/dist/detection/removals.js.map +0 -1
- package/dist/detection/scoped-identity.d.ts.map +0 -1
- package/dist/detection/scoped-identity.js.map +0 -1
- package/dist/detection/skip-defaults.d.ts.map +0 -1
- package/dist/detection/skip-defaults.js.map +0 -1
- package/dist/detection/skip-policy.d.ts.map +0 -1
- package/dist/detection/skip-policy.js.map +0 -1
- package/dist/detection/watch-boundary.d.ts.map +0 -1
- package/dist/detection/watch-boundary.js.map +0 -1
- package/dist/drive/contracts.d.ts.map +0 -1
- package/dist/drive/contracts.js.map +0 -1
- package/dist/drive/drive.d.ts.map +0 -1
- package/dist/drive/drive.js.map +0 -1
- package/dist/drive/held-removals.d.ts.map +0 -1
- package/dist/drive/held-removals.js.map +0 -1
- package/dist/drive/index.d.ts.map +0 -1
- package/dist/drive/index.js.map +0 -1
- package/dist/drive/kept.d.ts.map +0 -1
- package/dist/drive/kept.js.map +0 -1
- package/dist/drive/listing.d.ts.map +0 -1
- package/dist/drive/listing.js.map +0 -1
- package/dist/drive/map-index.d.ts.map +0 -1
- package/dist/drive/map-index.js.map +0 -1
- package/dist/drive/placements.d.ts.map +0 -1
- package/dist/drive/placements.js.map +0 -1
- package/dist/drive/records.d.ts.map +0 -1
- package/dist/drive/records.js.map +0 -1
- package/dist/drive/where.d.ts.map +0 -1
- package/dist/drive/where.js.map +0 -1
- package/dist/entities/accepted-view.d.ts.map +0 -1
- package/dist/entities/accepted-view.js.map +0 -1
- package/dist/entities/bytes.d.ts.map +0 -1
- package/dist/entities/bytes.js.map +0 -1
- package/dist/entities/cloud.d.ts.map +0 -1
- package/dist/entities/cloud.js.map +0 -1
- package/dist/entities/graph-head.d.ts.map +0 -1
- package/dist/entities/graph-head.js.map +0 -1
- package/dist/entities/graph-pages.d.ts.map +0 -1
- package/dist/entities/graph-pages.js.map +0 -1
- package/dist/entities/index.d.ts.map +0 -1
- package/dist/entities/index.js.map +0 -1
- package/dist/entities/package-pages.d.ts.map +0 -1
- package/dist/entities/package-pages.js.map +0 -1
- package/dist/entities/placement-owed.d.ts.map +0 -1
- package/dist/entities/placement-owed.js.map +0 -1
- package/dist/entities/reducer.d.ts.map +0 -1
- package/dist/entities/reducer.js.map +0 -1
- package/dist/entities/registry-graph.d.ts.map +0 -1
- package/dist/entities/registry-graph.js.map +0 -1
- package/dist/entities/rules.d.ts.map +0 -1
- package/dist/entities/rules.js.map +0 -1
- package/dist/entities/types.d.ts.map +0 -1
- package/dist/entities/types.js.map +0 -1
- package/dist/entities/units.d.ts.map +0 -1
- package/dist/entities/units.js.map +0 -1
- package/dist/faults/classify.d.ts.map +0 -1
- package/dist/faults/classify.js.map +0 -1
- package/dist/faults/index.d.ts.map +0 -1
- package/dist/faults/index.js.map +0 -1
- package/dist/faults/need.d.ts.map +0 -1
- package/dist/faults/need.js.map +0 -1
- package/dist/faults/recover.d.ts.map +0 -1
- package/dist/faults/recover.js.map +0 -1
- package/dist/faults/report.d.ts.map +0 -1
- package/dist/faults/report.js.map +0 -1
- package/dist/faults/scrub.d.ts.map +0 -1
- package/dist/faults/scrub.js.map +0 -1
- package/dist/faults/wire.d.ts.map +0 -1
- package/dist/faults/wire.js.map +0 -1
- package/dist/files/accepted-files.d.ts.map +0 -1
- package/dist/files/accepted-files.js.map +0 -1
- package/dist/files/api.d.ts.map +0 -1
- package/dist/files/api.js.map +0 -1
- package/dist/files/browse-types.d.ts.map +0 -1
- package/dist/files/browse-types.js.map +0 -1
- package/dist/files/browser.d.ts.map +0 -1
- package/dist/files/browser.js.map +0 -1
- package/dist/files/cloud-files.d.ts.map +0 -1
- package/dist/files/cloud-files.js.map +0 -1
- package/dist/files/commands.d.ts.map +0 -1
- package/dist/files/commands.js.map +0 -1
- package/dist/files/computer-address.d.ts.map +0 -1
- package/dist/files/computer-address.js.map +0 -1
- package/dist/files/index.d.ts.map +0 -1
- package/dist/files/index.js.map +0 -1
- package/dist/files/local-files.d.ts.map +0 -1
- package/dist/files/local-files.js.map +0 -1
- package/dist/files/media-type.d.ts.map +0 -1
- package/dist/files/media-type.js.map +0 -1
- package/dist/files/own-folders.d.ts.map +0 -1
- package/dist/files/own-folders.js.map +0 -1
- package/dist/files/plans.d.ts.map +0 -1
- package/dist/files/plans.js.map +0 -1
- package/dist/files/trash.d.ts.map +0 -1
- package/dist/files/trash.js.map +0 -1
- package/dist/files/usage-categories.d.ts.map +0 -1
- package/dist/files/usage-categories.js.map +0 -1
- package/dist/files/usage-chain.d.ts.map +0 -1
- package/dist/files/usage-chain.js.map +0 -1
- package/dist/files/usage-effect.d.ts.map +0 -1
- package/dist/files/usage-effect.js.map +0 -1
- package/dist/files/usage.d.ts.map +0 -1
- package/dist/files/usage.js.map +0 -1
- package/dist/git/alternates.d.ts.map +0 -1
- package/dist/git/alternates.js.map +0 -1
- package/dist/git/artifact.d.ts.map +0 -1
- package/dist/git/artifact.js.map +0 -1
- package/dist/git/chain.d.ts.map +0 -1
- package/dist/git/chain.js.map +0 -1
- package/dist/git/commands.d.ts +0 -3
- package/dist/git/commands.d.ts.map +0 -1
- package/dist/git/commands.js +0 -35
- package/dist/git/commands.js.map +0 -1
- package/dist/git/index.d.ts.map +0 -1
- package/dist/git/index.js.map +0 -1
- package/dist/git/plan.d.ts.map +0 -1
- package/dist/git/plan.js.map +0 -1
- package/dist/git/play.d.ts.map +0 -1
- package/dist/git/play.js.map +0 -1
- package/dist/git/refs.d.ts.map +0 -1
- package/dist/git/refs.js.map +0 -1
- package/dist/git/state.d.ts.map +0 -1
- package/dist/git/state.js.map +0 -1
- package/dist/git/tag.d.ts.map +0 -1
- package/dist/git/tag.js.map +0 -1
- package/dist/git/text.d.ts.map +0 -1
- package/dist/git/text.js.map +0 -1
- package/dist/git/turns.d.ts.map +0 -1
- package/dist/git/turns.js.map +0 -1
- package/dist/history/history.d.ts.map +0 -1
- package/dist/history/history.js.map +0 -1
- package/dist/history/index.d.ts.map +0 -1
- package/dist/history/index.js.map +0 -1
- package/dist/history/rule.d.ts.map +0 -1
- package/dist/history/rule.js.map +0 -1
- package/dist/history/types.d.ts.map +0 -1
- package/dist/history/types.js.map +0 -1
- package/dist/history/version.d.ts.map +0 -1
- package/dist/history/version.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/records/authority.d.ts.map +0 -1
- package/dist/records/authority.js.map +0 -1
- package/dist/records/codec.d.ts.map +0 -1
- package/dist/records/codec.js.map +0 -1
- package/dist/records/contracts.d.ts.map +0 -1
- package/dist/records/contracts.js.map +0 -1
- package/dist/records/inbox.d.ts.map +0 -1
- package/dist/records/inbox.js.map +0 -1
- package/dist/records/index.d.ts.map +0 -1
- package/dist/records/index.js.map +0 -1
- package/dist/records/intentional.d.ts.map +0 -1
- package/dist/records/intentional.js.map +0 -1
- package/dist/records/outbox.d.ts.map +0 -1
- package/dist/records/outbox.js.map +0 -1
- package/dist/records/owned-effects.d.ts.map +0 -1
- package/dist/records/owned-effects.js.map +0 -1
- package/dist/records/publication.d.ts.map +0 -1
- package/dist/records/publication.js.map +0 -1
- package/dist/records/rail-ports.d.ts.map +0 -1
- package/dist/records/rail-ports.js.map +0 -1
- package/dist/records/rail.d.ts.map +0 -1
- package/dist/records/rail.js.map +0 -1
- package/dist/records/receive-channel.d.ts.map +0 -1
- package/dist/records/receive-channel.js.map +0 -1
- package/dist/records/receive-loop.d.ts.map +0 -1
- package/dist/records/receive-loop.js.map +0 -1
- package/dist/records/receive-pages.d.ts.map +0 -1
- package/dist/records/receive-pages.js.map +0 -1
- package/dist/records/retry-clock.d.ts.map +0 -1
- package/dist/records/retry-clock.js.map +0 -1
- package/dist/records/send-batch.d.ts.map +0 -1
- package/dist/records/send-batch.js.map +0 -1
- package/dist/records/send-freeing.d.ts.map +0 -1
- package/dist/records/send-freeing.js.map +0 -1
- package/dist/records/send-line.d.ts.map +0 -1
- package/dist/records/send-line.js.map +0 -1
- package/dist/records/send-preparation.d.ts.map +0 -1
- package/dist/records/send-preparation.js.map +0 -1
- package/dist/records/submit-frame.d.ts.map +0 -1
- package/dist/records/submit-frame.js.map +0 -1
- package/dist/records/unsent-count.d.ts.map +0 -1
- package/dist/records/unsent-count.js.map +0 -1
- package/dist/records/wire.d.ts.map +0 -1
- package/dist/records/wire.js.map +0 -1
- package/dist/registration/home-layout.d.ts.map +0 -1
- package/dist/registration/home-layout.js.map +0 -1
- package/dist/registration/index.d.ts.map +0 -1
- package/dist/registration/index.js.map +0 -1
- package/dist/registration/user-ground.d.ts.map +0 -1
- package/dist/registration/user-ground.js.map +0 -1
- package/dist/sharing/access.d.ts.map +0 -1
- package/dist/sharing/access.js.map +0 -1
- package/dist/sharing/cli.d.ts.map +0 -1
- package/dist/sharing/cli.js.map +0 -1
- package/dist/sharing/command-input.d.ts.map +0 -1
- package/dist/sharing/command-input.js +0 -63
- package/dist/sharing/command-input.js.map +0 -1
- package/dist/sharing/commands.d.ts.map +0 -1
- package/dist/sharing/commands.js.map +0 -1
- package/dist/sharing/construct.d.ts.map +0 -1
- package/dist/sharing/construct.js.map +0 -1
- package/dist/sharing/download.d.ts.map +0 -1
- package/dist/sharing/download.js.map +0 -1
- package/dist/sharing/entity.d.ts.map +0 -1
- package/dist/sharing/entity.js.map +0 -1
- package/dist/sharing/errors.d.ts.map +0 -1
- package/dist/sharing/errors.js.map +0 -1
- package/dist/sharing/grants.d.ts.map +0 -1
- package/dist/sharing/grants.js.map +0 -1
- package/dist/sharing/index.d.ts.map +0 -1
- package/dist/sharing/index.js.map +0 -1
- package/dist/sharing/mcp.d.ts.map +0 -1
- package/dist/sharing/mcp.js.map +0 -1
- package/dist/sharing/permissions.d.ts.map +0 -1
- package/dist/sharing/permissions.js.map +0 -1
- package/dist/sharing/publish.d.ts.map +0 -1
- package/dist/sharing/publish.js.map +0 -1
- package/dist/sharing/share.d.ts.map +0 -1
- package/dist/sharing/share.js.map +0 -1
- package/dist/sharing/sharing.d.ts.map +0 -1
- package/dist/sharing/sharing.js.map +0 -1
- package/dist/sharing/types.d.ts.map +0 -1
- package/dist/sharing/types.js.map +0 -1
- package/dist/steps.d.ts.map +0 -1
- package/dist/steps.js.map +0 -1
- package/dist/transfer/artifacts.d.ts.map +0 -1
- package/dist/transfer/artifacts.js.map +0 -1
- package/dist/transfer/batches.d.ts.map +0 -1
- package/dist/transfer/batches.js.map +0 -1
- package/dist/transfer/cargo-frame.d.ts +0 -42
- package/dist/transfer/cargo-frame.d.ts.map +0 -1
- package/dist/transfer/cargo-frame.js +0 -98
- package/dist/transfer/cargo-frame.js.map +0 -1
- package/dist/transfer/cargo.d.ts.map +0 -1
- package/dist/transfer/cargo.js.map +0 -1
- package/dist/transfer/download.d.ts.map +0 -1
- package/dist/transfer/download.js.map +0 -1
- package/dist/transfer/index.d.ts.map +0 -1
- package/dist/transfer/index.js.map +0 -1
- package/dist/transfer/parallel.d.ts.map +0 -1
- package/dist/transfer/parallel.js.map +0 -1
- package/dist/transfer/ranges.d.ts.map +0 -1
- package/dist/transfer/ranges.js.map +0 -1
- package/dist/transfer/refs.d.ts.map +0 -1
- package/dist/transfer/refs.js.map +0 -1
- package/dist/transfer/upload.d.ts.map +0 -1
- package/dist/transfer/upload.js.map +0 -1
- package/dist/watching/coverage.d.ts.map +0 -1
- package/dist/watching/coverage.js.map +0 -1
- package/dist/watching/index.d.ts.map +0 -1
- package/dist/watching/index.js.map +0 -1
- package/dist/watching/maintenance.d.ts.map +0 -1
- package/dist/watching/maintenance.js.map +0 -1
- package/dist/watching/suspicion.d.ts.map +0 -1
- package/dist/watching/suspicion.js.map +0 -1
- package/dist/workspace/api.d.ts.map +0 -1
- package/dist/workspace/api.js.map +0 -1
- package/dist/workspace/entries.d.ts.map +0 -1
- package/dist/workspace/entries.js.map +0 -1
- package/dist/workspace/identity.d.ts.map +0 -1
- package/dist/workspace/identity.js.map +0 -1
- package/dist/workspace/index.d.ts.map +0 -1
- package/dist/workspace/index.js.map +0 -1
- package/dist/workspace/registry.d.ts.map +0 -1
- package/dist/workspace/registry.js.map +0 -1
- package/dist/workspace/types.d.ts.map +0 -1
- package/dist/workspace/types.js.map +0 -1
- package/dist-cjs/apply/contracts.js.map +0 -1
- package/dist-cjs/apply/fetch-ahead.js.map +0 -1
- package/dist-cjs/apply/index.js.map +0 -1
- package/dist-cjs/apply/journey.js.map +0 -1
- package/dist-cjs/apply/lane.js.map +0 -1
- package/dist-cjs/apply/line.js.map +0 -1
- package/dist-cjs/apply/plans.js.map +0 -1
- package/dist-cjs/apply/rail.js.map +0 -1
- package/dist-cjs/apply/selection.js.map +0 -1
- package/dist-cjs/apply/settling.js.map +0 -1
- package/dist-cjs/apply/showing.js.map +0 -1
- package/dist-cjs/apply/type-adapters.js.map +0 -1
- package/dist-cjs/apply/window.js.map +0 -1
- package/dist-cjs/clash/bodmas.js.map +0 -1
- package/dist-cjs/clash/echo.js.map +0 -1
- package/dist-cjs/clash/index.js.map +0 -1
- package/dist-cjs/clash/local-work.js.map +0 -1
- package/dist-cjs/clash/resolution.js.map +0 -1
- package/dist-cjs/clash/tetris.js.map +0 -1
- package/dist-cjs/contracts/content.js.map +0 -1
- package/dist-cjs/contracts/index.js.map +0 -1
- package/dist-cjs/contracts/protection.js.map +0 -1
- package/dist-cjs/contracts/validate.js.map +0 -1
- package/dist-cjs/detection/adapter-contract.js.map +0 -1
- package/dist-cjs/detection/batch.js.map +0 -1
- package/dist-cjs/detection/classify.js.map +0 -1
- package/dist-cjs/detection/content.js.map +0 -1
- package/dist-cjs/detection/dispositions.js.map +0 -1
- package/dist-cjs/detection/echo.js.map +0 -1
- package/dist-cjs/detection/identity.js.map +0 -1
- package/dist-cjs/detection/ignore-lines.js.map +0 -1
- package/dist-cjs/detection/index.js.map +0 -1
- package/dist-cjs/detection/package-proposal.js.map +0 -1
- package/dist-cjs/detection/record-order.js.map +0 -1
- package/dist-cjs/detection/record-proposal.js.map +0 -1
- package/dist-cjs/detection/refusal.js.map +0 -1
- package/dist-cjs/detection/removals.js.map +0 -1
- package/dist-cjs/detection/scoped-identity.js.map +0 -1
- package/dist-cjs/detection/skip-defaults.js.map +0 -1
- package/dist-cjs/detection/skip-policy.js.map +0 -1
- package/dist-cjs/detection/watch-boundary.js.map +0 -1
- package/dist-cjs/drive/contracts.js.map +0 -1
- package/dist-cjs/drive/drive.js.map +0 -1
- package/dist-cjs/drive/held-removals.js.map +0 -1
- package/dist-cjs/drive/index.js.map +0 -1
- package/dist-cjs/drive/kept.js.map +0 -1
- package/dist-cjs/drive/listing.js.map +0 -1
- package/dist-cjs/drive/map-index.js.map +0 -1
- package/dist-cjs/drive/placements.js.map +0 -1
- package/dist-cjs/drive/records.js.map +0 -1
- package/dist-cjs/drive/where.js.map +0 -1
- package/dist-cjs/entities/accepted-view.js.map +0 -1
- package/dist-cjs/entities/bytes.js.map +0 -1
- package/dist-cjs/entities/cloud.js.map +0 -1
- package/dist-cjs/entities/graph-head.js.map +0 -1
- package/dist-cjs/entities/graph-pages.js.map +0 -1
- package/dist-cjs/entities/index.js.map +0 -1
- package/dist-cjs/entities/package-pages.js.map +0 -1
- package/dist-cjs/entities/placement-owed.js.map +0 -1
- package/dist-cjs/entities/reducer.js.map +0 -1
- package/dist-cjs/entities/registry-graph.js.map +0 -1
- package/dist-cjs/entities/rules.js.map +0 -1
- package/dist-cjs/entities/types.js.map +0 -1
- package/dist-cjs/entities/units.js.map +0 -1
- package/dist-cjs/faults/classify.js.map +0 -1
- package/dist-cjs/faults/index.js.map +0 -1
- package/dist-cjs/faults/need.js.map +0 -1
- package/dist-cjs/faults/recover.js.map +0 -1
- package/dist-cjs/faults/report.js.map +0 -1
- package/dist-cjs/faults/scrub.js.map +0 -1
- package/dist-cjs/faults/wire.js.map +0 -1
- package/dist-cjs/files/accepted-files.js.map +0 -1
- package/dist-cjs/files/api.js.map +0 -1
- package/dist-cjs/files/browse-types.js.map +0 -1
- package/dist-cjs/files/browser.js.map +0 -1
- package/dist-cjs/files/cloud-files.js.map +0 -1
- package/dist-cjs/files/commands.js.map +0 -1
- package/dist-cjs/files/computer-address.js.map +0 -1
- package/dist-cjs/files/index.js.map +0 -1
- package/dist-cjs/files/local-files.js.map +0 -1
- package/dist-cjs/files/media-type.js.map +0 -1
- package/dist-cjs/files/own-folders.js.map +0 -1
- package/dist-cjs/files/plans.js.map +0 -1
- package/dist-cjs/files/trash.js.map +0 -1
- package/dist-cjs/files/usage-categories.js.map +0 -1
- package/dist-cjs/files/usage-chain.js.map +0 -1
- package/dist-cjs/files/usage-effect.js.map +0 -1
- package/dist-cjs/files/usage.js.map +0 -1
- package/dist-cjs/git/alternates.js.map +0 -1
- package/dist-cjs/git/artifact.js.map +0 -1
- package/dist-cjs/git/chain.js.map +0 -1
- package/dist-cjs/git/commands.js +0 -39
- package/dist-cjs/git/commands.js.map +0 -1
- package/dist-cjs/git/index.js.map +0 -1
- package/dist-cjs/git/plan.js.map +0 -1
- package/dist-cjs/git/play.js.map +0 -1
- package/dist-cjs/git/refs.js.map +0 -1
- package/dist-cjs/git/state.js.map +0 -1
- package/dist-cjs/git/tag.js.map +0 -1
- package/dist-cjs/git/text.js.map +0 -1
- package/dist-cjs/git/turns.js.map +0 -1
- package/dist-cjs/history/history.js.map +0 -1
- package/dist-cjs/history/index.js.map +0 -1
- package/dist-cjs/history/rule.js.map +0 -1
- package/dist-cjs/history/types.js.map +0 -1
- package/dist-cjs/history/version.js.map +0 -1
- package/dist-cjs/index.js.map +0 -1
- package/dist-cjs/records/authority.js.map +0 -1
- package/dist-cjs/records/codec.js.map +0 -1
- package/dist-cjs/records/contracts.js.map +0 -1
- package/dist-cjs/records/inbox.js.map +0 -1
- package/dist-cjs/records/index.js.map +0 -1
- package/dist-cjs/records/intentional.js.map +0 -1
- package/dist-cjs/records/outbox.js.map +0 -1
- package/dist-cjs/records/owned-effects.js.map +0 -1
- package/dist-cjs/records/publication.js.map +0 -1
- package/dist-cjs/records/rail-ports.js.map +0 -1
- package/dist-cjs/records/rail.js.map +0 -1
- package/dist-cjs/records/receive-channel.js.map +0 -1
- package/dist-cjs/records/receive-loop.js.map +0 -1
- package/dist-cjs/records/receive-pages.js.map +0 -1
- package/dist-cjs/records/retry-clock.js.map +0 -1
- package/dist-cjs/records/send-batch.js.map +0 -1
- package/dist-cjs/records/send-freeing.js.map +0 -1
- package/dist-cjs/records/send-line.js.map +0 -1
- package/dist-cjs/records/send-preparation.js.map +0 -1
- package/dist-cjs/records/submit-frame.js.map +0 -1
- package/dist-cjs/records/unsent-count.js.map +0 -1
- package/dist-cjs/records/wire.js.map +0 -1
- package/dist-cjs/registration/home-layout.js.map +0 -1
- package/dist-cjs/registration/index.js.map +0 -1
- package/dist-cjs/registration/user-ground.js.map +0 -1
- package/dist-cjs/sharing/access.js.map +0 -1
- package/dist-cjs/sharing/cli.js.map +0 -1
- package/dist-cjs/sharing/command-input.js +0 -69
- package/dist-cjs/sharing/command-input.js.map +0 -1
- package/dist-cjs/sharing/commands.js.map +0 -1
- package/dist-cjs/sharing/construct.js.map +0 -1
- package/dist-cjs/sharing/download.js.map +0 -1
- package/dist-cjs/sharing/entity.js.map +0 -1
- package/dist-cjs/sharing/errors.js.map +0 -1
- package/dist-cjs/sharing/grants.js.map +0 -1
- package/dist-cjs/sharing/index.js.map +0 -1
- package/dist-cjs/sharing/mcp.js.map +0 -1
- package/dist-cjs/sharing/permissions.js.map +0 -1
- package/dist-cjs/sharing/publish.js.map +0 -1
- package/dist-cjs/sharing/share.js.map +0 -1
- package/dist-cjs/sharing/sharing.js.map +0 -1
- package/dist-cjs/sharing/types.js.map +0 -1
- package/dist-cjs/steps.js.map +0 -1
- package/dist-cjs/transfer/artifacts.js.map +0 -1
- package/dist-cjs/transfer/batches.js.map +0 -1
- package/dist-cjs/transfer/cargo-frame.js +0 -104
- package/dist-cjs/transfer/cargo-frame.js.map +0 -1
- package/dist-cjs/transfer/cargo.js.map +0 -1
- package/dist-cjs/transfer/download.js.map +0 -1
- package/dist-cjs/transfer/index.js.map +0 -1
- package/dist-cjs/transfer/parallel.js.map +0 -1
- package/dist-cjs/transfer/ranges.js.map +0 -1
- package/dist-cjs/transfer/refs.js.map +0 -1
- package/dist-cjs/transfer/upload.js.map +0 -1
- package/dist-cjs/watching/coverage.js.map +0 -1
- package/dist-cjs/watching/index.js.map +0 -1
- package/dist-cjs/watching/maintenance.js.map +0 -1
- package/dist-cjs/watching/suspicion.js.map +0 -1
- package/dist-cjs/workspace/api.js.map +0 -1
- package/dist-cjs/workspace/entries.js.map +0 -1
- package/dist-cjs/workspace/identity.js.map +0 -1
- package/dist-cjs/workspace/index.js.map +0 -1
- package/dist-cjs/workspace/registry.js.map +0 -1
- package/dist-cjs/workspace/types.js.map +0 -1
package/dist/apply/rail.js
CHANGED
|
@@ -1,776 +1 @@
|
|
|
1
|
-
/** Event-driven Apply/Verify scheduling: one strict line per authority and
|
|
2
|
-
* one fetch lane per unit being placed, each run one step at a time by its
|
|
3
|
-
* own bounded pool. */
|
|
4
|
-
import { UUID_PATTERN } from '../entities/types.js';
|
|
5
|
-
import { FetchAhead } from './fetch-ahead.js';
|
|
6
|
-
import { EntityApplyJourney, outcomeOf } from './journey.js';
|
|
7
|
-
import { assertApplyLaneStep, createApplyLane } from './lane.js';
|
|
8
|
-
import { assertApplyDependency, assertApplyLineStep, createApplyLine, heldWait, releaseApplyLine, } from './line.js';
|
|
9
|
-
import { windowEndForWait } from './window.js';
|
|
10
|
-
export const ENTITY_APPLY_DEFAULT_CONCURRENCY = 8;
|
|
11
|
-
export const ENTITY_APPLY_RETRY_BASE_MS = 1_000;
|
|
12
|
-
export const ENTITY_APPLY_RETRY_MAX_MS = 30_000;
|
|
13
|
-
/** Ground a person moves holds a line quietly while it settles; ground still
|
|
14
|
-
* moving at this attempt is reported, so no line stalls unseen. */
|
|
15
|
-
export const ENTITY_APPLY_QUIET_ATTEMPTS = 8;
|
|
16
|
-
/**
|
|
17
|
-
* Each authority's received records change ground in delivery order. A line
|
|
18
|
-
* reads its window (window.ts): an open one, else the fold of its unresolved
|
|
19
|
-
* rows from its first, each member judged at its position (settling.ts). The
|
|
20
|
-
* window runs its journey; its first member that cannot finish holds the
|
|
21
|
-
* line until what it names changes, and nothing after it plays first. A head
|
|
22
|
-
* that waits on a member behind it ends the window before that member
|
|
23
|
-
* (`windowEndForWait`). While a line steps, the cargo of the records ahead of
|
|
24
|
-
* it is fetched off the line (fetch-ahead.ts).
|
|
25
|
-
*
|
|
26
|
-
* One pool runs every line's steps, at most `concurrency` at once, in turn.
|
|
27
|
-
* A line never runs two steps at once, and a fault holds only its own line.
|
|
28
|
-
*
|
|
29
|
-
* A fetch places one unit through its own lane (lane.ts), in a second pool
|
|
30
|
-
* of `laneConcurrency` (by default `concurrency`), so no line step, settle
|
|
31
|
-
* batch or held line head stands in front of it. A lane steps through the
|
|
32
|
-
* same journey and the same park/backoff/wake clock as a line, and ends only
|
|
33
|
-
* when its unit is placed, is nowhere, or its prerequisite failed. A lane whose unit is a root a held
|
|
34
|
-
* reference leads to asks the host to enter it first (`enterRoot`).
|
|
35
|
-
*
|
|
36
|
-
* Apply has only two wake sources: Receive committed new Inbox work, or local
|
|
37
|
-
* state changed in a way that may release a wait. A wake steps every line. A
|
|
38
|
-
* held line runs again on its backoff, its head changing, newer local work,
|
|
39
|
-
* its named producer, or, for a conflict, another line's progress. An idle
|
|
40
|
-
* rail never polls.
|
|
41
|
-
*/
|
|
42
|
-
export class EntityApplyRail {
|
|
43
|
-
#options;
|
|
44
|
-
#concurrency;
|
|
45
|
-
#laneConcurrency;
|
|
46
|
-
#onBackgroundError;
|
|
47
|
-
#onIdle;
|
|
48
|
-
#journey;
|
|
49
|
-
#fetchAhead;
|
|
50
|
-
#started = false;
|
|
51
|
-
#stopped = false;
|
|
52
|
-
#lines = new Map();
|
|
53
|
-
#lanes = new Map();
|
|
54
|
-
#linePool = { queue: [], steps: new Set() };
|
|
55
|
-
#lanePool = { queue: [], steps: new Set() };
|
|
56
|
-
#rescan = false;
|
|
57
|
-
#scan = null;
|
|
58
|
-
#scanRetryAt = Infinity;
|
|
59
|
-
#idle = [];
|
|
60
|
-
#wakeVersion = 0;
|
|
61
|
-
#dependencyWakes = new Map();
|
|
62
|
-
#retry = null;
|
|
63
|
-
constructor(options) {
|
|
64
|
-
this.#options = options;
|
|
65
|
-
this.#concurrency = options.concurrency ?? ENTITY_APPLY_DEFAULT_CONCURRENCY;
|
|
66
|
-
this.#laneConcurrency = options.laneConcurrency ?? this.#concurrency;
|
|
67
|
-
this.#onBackgroundError = options.onBackgroundError ?? (() => undefined);
|
|
68
|
-
this.#onIdle = options.onIdle ?? (() => undefined);
|
|
69
|
-
for (const [name, size] of [['concurrency', this.#concurrency], ['lane concurrency', this.#laneConcurrency]]) {
|
|
70
|
-
if (!Number.isSafeInteger(size) || size < 1)
|
|
71
|
-
throw new Error(`entity Apply ${name} must be a positive integer`);
|
|
72
|
-
}
|
|
73
|
-
this.#journey = new EntityApplyJourney(options, () => this.#wakeVersion, () => this.#stopped);
|
|
74
|
-
this.#fetchAhead = new FetchAhead(options.cargo, { sha256Hex: options.sha256Hex, loops: options.loops });
|
|
75
|
-
}
|
|
76
|
-
/** Resume durable intents and then consume already-received Inbox work.
|
|
77
|
-
* Every unit an earlier lifetime was placing gets its lane back first. */
|
|
78
|
-
async start() {
|
|
79
|
-
if (this.#started)
|
|
80
|
-
throw new Error('entity Apply rail already started');
|
|
81
|
-
if (this.#stopped)
|
|
82
|
-
throw new Error('entity Apply rail is stopped');
|
|
83
|
-
this.#started = true;
|
|
84
|
-
const units = await this.#options.store.readOpenUnits();
|
|
85
|
-
if (!Array.isArray(units) || new Set(units).size !== units.length || units.some(unit => !UUID_PATTERN.test(unit))) {
|
|
86
|
-
throw new Error('entity Apply store returned an invalid open unit list');
|
|
87
|
-
}
|
|
88
|
-
for (const unit of units)
|
|
89
|
-
this.#ensureLane(unit, null);
|
|
90
|
-
await this.#untilIdle();
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Place one unit this computer lists at the newest version received now,
|
|
94
|
-
* with every unit it needs placed first. It answers once: placed, nowhere,
|
|
95
|
-
* or, when its chain makes no progress for `stall`, held naming the
|
|
96
|
-
* deepest unit that chain waits on. Its chain moves when one of its lanes
|
|
97
|
-
* commits a window, enters a root or places its unit, or when the host
|
|
98
|
-
* says bytes moved for one (`progressed`); a fetch that keeps moving has
|
|
99
|
-
* no total limit. A held lane keeps every obligation and goes on
|
|
100
|
-
* placing.
|
|
101
|
-
*/
|
|
102
|
-
fetch(unit, options) {
|
|
103
|
-
if (!this.#started)
|
|
104
|
-
return Promise.reject(new Error('entity Apply rail has not started'));
|
|
105
|
-
if (this.#stopped)
|
|
106
|
-
return Promise.reject(new Error('entity Apply rail is stopped'));
|
|
107
|
-
if (!UUID_PATTERN.test(unit))
|
|
108
|
-
return Promise.reject(new Error('entity Apply fetch needs a unit UUID'));
|
|
109
|
-
if (!Number.isFinite(options.stall) || options.stall < 0) {
|
|
110
|
-
return Promise.reject(new Error('entity Apply fetch needs a non-negative stall'));
|
|
111
|
-
}
|
|
112
|
-
if (options.emptied !== undefined && typeof options.emptied !== 'boolean') {
|
|
113
|
-
return Promise.reject(new Error('entity Apply fetch emptied must be a boolean'));
|
|
114
|
-
}
|
|
115
|
-
return new Promise((resolve, reject) => {
|
|
116
|
-
const lane = this.#ensureLane(unit, null, options.emptied === true);
|
|
117
|
-
const arm = () => this.#options.schedule.schedule(options.stall, () => {
|
|
118
|
-
if (!lane.waiters.delete(waiter))
|
|
119
|
-
return;
|
|
120
|
-
if (lane.emptied && ![...lane.waiters].some(other => other.emptied))
|
|
121
|
-
lane.emptied = false;
|
|
122
|
-
resolve(this.#heldAnswer(lane));
|
|
123
|
-
});
|
|
124
|
-
let timer = arm();
|
|
125
|
-
const waiter = {
|
|
126
|
-
emptied: options.emptied === true,
|
|
127
|
-
answer: (answer) => { timer.cancel(); resolve(answer); },
|
|
128
|
-
fail: (error) => { timer.cancel(); reject(error); },
|
|
129
|
-
moved: () => { timer.cancel(); timer = arm(); },
|
|
130
|
-
};
|
|
131
|
-
lane.waiters.add(waiter);
|
|
132
|
-
// A window whose prerequisite failed asks for it again.
|
|
133
|
-
if (lane.waitsOn === null)
|
|
134
|
-
this.#needsApplied(lane);
|
|
135
|
-
this.#pump();
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
/** The host moved `bytes` for the window placing `unit`: every byte pass
|
|
139
|
-
* it makes there says so, its cargo landing, the reads that prove it, its
|
|
140
|
-
* staged copy and its Verify. Every fetch whose chain waits on that lane
|
|
141
|
-
* has moved; nothing sums the count. */
|
|
142
|
-
progressed(unit, bytes) {
|
|
143
|
-
if (!UUID_PATTERN.test(unit))
|
|
144
|
-
throw new Error('entity Apply progress needs a unit UUID');
|
|
145
|
-
if (!Number.isSafeInteger(bytes) || bytes < 0)
|
|
146
|
-
throw new Error('entity Apply progress needs a byte count');
|
|
147
|
-
if (bytes > 0 && !this.#stopped)
|
|
148
|
-
this.#moved(unit);
|
|
149
|
-
}
|
|
150
|
-
/** Receive calls only after its Inbox transaction commits. */
|
|
151
|
-
recordsAvailable() {
|
|
152
|
-
this.#wake();
|
|
153
|
-
}
|
|
154
|
-
/** Record/Send or Detect calls after a local gate may have changed. Without
|
|
155
|
-
* ids, anything may have changed, including what this computer shows. */
|
|
156
|
-
localStateChanged(entityIds) {
|
|
157
|
-
this.#release('detect', entityIds);
|
|
158
|
-
this.#release('apply', entityIds);
|
|
159
|
-
this.#wake();
|
|
160
|
-
}
|
|
161
|
-
/** Send sequenced these entities' local results. */
|
|
162
|
-
sendAccepted(entityIds) {
|
|
163
|
-
this.#release('send', entityIds);
|
|
164
|
-
this.#wake();
|
|
165
|
-
}
|
|
166
|
-
/** The host re-examined a capability, for example after Git topology
|
|
167
|
-
* changed or a workspace root returned. */
|
|
168
|
-
capabilityChanged(entityIds) {
|
|
169
|
-
this.#release('capability', entityIds);
|
|
170
|
-
this.#wake();
|
|
171
|
-
}
|
|
172
|
-
/** Every line reads its window again. */
|
|
173
|
-
#wake() {
|
|
174
|
-
if (!this.#started || this.#stopped)
|
|
175
|
-
return;
|
|
176
|
-
this.#rescan = true;
|
|
177
|
-
this.#pump();
|
|
178
|
-
}
|
|
179
|
-
/** Diagnostics are derived from the tracks, never a second wait registry. */
|
|
180
|
-
waiting() {
|
|
181
|
-
return this.#tracks().flatMap(track => heldWait(track.held) ?? []);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Await work known at this boundary. It never creates an idle query loop,
|
|
185
|
-
* and it never re-runs a held head: its wait is the rail's proof that
|
|
186
|
-
* repeating the same attempt cannot help yet.
|
|
187
|
-
*/
|
|
188
|
-
async flush() {
|
|
189
|
-
if (!this.#started)
|
|
190
|
-
throw new Error('entity Apply rail has not started');
|
|
191
|
-
if (this.#stopped)
|
|
192
|
-
return;
|
|
193
|
-
await this.#untilIdle();
|
|
194
|
-
}
|
|
195
|
-
async stop() {
|
|
196
|
-
if (this.#stopped)
|
|
197
|
-
return;
|
|
198
|
-
this.#stopped = true;
|
|
199
|
-
this.#cancelRetry();
|
|
200
|
-
for (const pool of [this.#linePool, this.#lanePool])
|
|
201
|
-
for (const track of pool.queue.splice(0))
|
|
202
|
-
track.queued = false;
|
|
203
|
-
const stopped = new Error('entity Apply rail stopped before the fetch answered');
|
|
204
|
-
for (const lane of this.#lanes.values())
|
|
205
|
-
for (const waiter of lane.waiters)
|
|
206
|
-
waiter.fail(stopped);
|
|
207
|
-
this.#lanes.clear();
|
|
208
|
-
while (this.#running() > 0 || this.#scan) {
|
|
209
|
-
await Promise.allSettled([...this.#linePool.steps, ...this.#lanePool.steps, ...(this.#scan ? [this.#scan] : [])]);
|
|
210
|
-
}
|
|
211
|
-
await this.#fetchAhead.stop();
|
|
212
|
-
for (const waiter of this.#idle.splice(0))
|
|
213
|
-
waiter.resolve();
|
|
214
|
-
}
|
|
215
|
-
#untilIdle() {
|
|
216
|
-
return new Promise((resolve, reject) => {
|
|
217
|
-
this.#idle.push({ resolve, reject });
|
|
218
|
-
this.#rescan = true;
|
|
219
|
-
this.#pump();
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
/** Start what can run now; settle waiters when nothing is left. */
|
|
223
|
-
#pump() {
|
|
224
|
-
if (this.#stopped)
|
|
225
|
-
return;
|
|
226
|
-
if (this.#rescan && this.#scan === null) {
|
|
227
|
-
this.#rescan = false;
|
|
228
|
-
const scan = this.#scanAuthorities();
|
|
229
|
-
this.#scan = scan;
|
|
230
|
-
void scan.then(() => {
|
|
231
|
-
this.#scan = null;
|
|
232
|
-
this.#pump();
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
for (const [pool, size] of [[this.#lanePool, this.#laneConcurrency], [this.#linePool, this.#concurrency]]) {
|
|
236
|
-
while (pool.steps.size < size && pool.queue.length > 0) {
|
|
237
|
-
const track = pool.queue.shift();
|
|
238
|
-
track.queued = false;
|
|
239
|
-
this.#run(track, pool);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
if (this.#running() === 0 && this.#scan === null && !this.#rescan
|
|
243
|
-
&& this.#linePool.queue.length === 0 && this.#lanePool.queue.length === 0) {
|
|
244
|
-
// Nothing is running, so no comparison can still need a release.
|
|
245
|
-
this.#dependencyWakes.clear();
|
|
246
|
-
// A wait whose time has come is work, not idleness.
|
|
247
|
-
if (this.#elapse(this.#options.now())) {
|
|
248
|
-
this.#pump();
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
this.#armRetry();
|
|
252
|
-
for (const waiter of this.#idle.splice(0))
|
|
253
|
-
waiter.resolve();
|
|
254
|
-
this.#onIdle();
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
#running() {
|
|
258
|
-
return this.#linePool.steps.size + this.#lanePool.steps.size;
|
|
259
|
-
}
|
|
260
|
-
#tracks() {
|
|
261
|
-
return [...this.#lines.values(), ...this.#lanes.values()];
|
|
262
|
-
}
|
|
263
|
-
/** The track still names its line or lane: an ended lane takes no step. */
|
|
264
|
-
#current(track) {
|
|
265
|
-
return track.kind === 'line' ? this.#lines.get(track.authorityId) === track : this.#lanes.get(track.unit) === track;
|
|
266
|
-
}
|
|
267
|
-
#enqueue(track) {
|
|
268
|
-
if (this.#stopped)
|
|
269
|
-
return;
|
|
270
|
-
if (track.running) {
|
|
271
|
-
track.again = true;
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
if (track.queued)
|
|
275
|
-
return;
|
|
276
|
-
track.queued = true;
|
|
277
|
-
(track.kind === 'line' ? this.#linePool : this.#lanePool).queue.push(track);
|
|
278
|
-
}
|
|
279
|
-
/** One step, then the track goes to the back of its queue if it has more. */
|
|
280
|
-
#run(track, pool) {
|
|
281
|
-
track.running = true;
|
|
282
|
-
track.again = false;
|
|
283
|
-
const step = (track.kind === 'line' ? this.#lineStep(track) : this.#laneStep(track)).then((more) => {
|
|
284
|
-
track.running = false;
|
|
285
|
-
pool.steps.delete(step);
|
|
286
|
-
if ((more || track.again) && this.#current(track)) {
|
|
287
|
-
track.again = false;
|
|
288
|
-
this.#enqueue(track);
|
|
289
|
-
}
|
|
290
|
-
this.#pump();
|
|
291
|
-
});
|
|
292
|
-
pool.steps.add(step);
|
|
293
|
-
}
|
|
294
|
-
/** Every authority with work gets a line, and every line takes a step. */
|
|
295
|
-
async #scanAuthorities() {
|
|
296
|
-
try {
|
|
297
|
-
const authorities = await this.#options.store.readApplyAuthorities();
|
|
298
|
-
if (!Array.isArray(authorities) || new Set(authorities).size !== authorities.length
|
|
299
|
-
|| authorities.some(id => typeof id !== 'string' || id.length === 0)) {
|
|
300
|
-
throw new Error('entity Apply store returned an invalid authority list');
|
|
301
|
-
}
|
|
302
|
-
this.#scanRetryAt = Infinity;
|
|
303
|
-
const present = new Set(authorities);
|
|
304
|
-
for (const [authorityId, line] of this.#lines) {
|
|
305
|
-
if (!present.has(authorityId) && !line.running && !line.queued)
|
|
306
|
-
this.#lines.delete(authorityId);
|
|
307
|
-
}
|
|
308
|
-
for (const authorityId of authorities) {
|
|
309
|
-
let line = this.#lines.get(authorityId);
|
|
310
|
-
if (!line) {
|
|
311
|
-
line = createApplyLine(authorityId);
|
|
312
|
-
this.#lines.set(authorityId, line);
|
|
313
|
-
}
|
|
314
|
-
this.#enqueue(line);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
catch (error) {
|
|
318
|
-
// Without the authority list no line can be stepped. Whoever awaits
|
|
319
|
-
// this boundary learns of it; otherwise it is reported once.
|
|
320
|
-
this.#scanRetryAt = this.#options.now() + ENTITY_APPLY_RETRY_MAX_MS;
|
|
321
|
-
const waiting = this.#idle.splice(0);
|
|
322
|
-
if (waiting.length === 0)
|
|
323
|
-
this.#report(error);
|
|
324
|
-
for (const waiter of waiting)
|
|
325
|
-
waiter.reject(error);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
/** One step of one line. It never throws: a fault holds only its line. */
|
|
329
|
-
async #lineStep(line) {
|
|
330
|
-
try {
|
|
331
|
-
const held = line.held;
|
|
332
|
-
if (held && held.entityId === null && !held.due && held.notBefore > this.#options.now())
|
|
333
|
-
return false;
|
|
334
|
-
const startedAt = this.#wakeVersion;
|
|
335
|
-
const step = await this.#options.store.readApplyWindow(line.authorityId, line.endsBefore);
|
|
336
|
-
assertApplyLineStep(line.authorityId, step);
|
|
337
|
-
if (this.#stopped)
|
|
338
|
-
return false;
|
|
339
|
-
if (step.kind === 'end') {
|
|
340
|
-
line.held = null;
|
|
341
|
-
// Nothing is left before where its windows ended; the rows past it are still owed.
|
|
342
|
-
const ended = line.endsBefore !== null;
|
|
343
|
-
line.endsBefore = null;
|
|
344
|
-
return ended;
|
|
345
|
-
}
|
|
346
|
-
// A window with no position has nothing to look ahead of.
|
|
347
|
-
if (step.window.deliverySequence !== null)
|
|
348
|
-
this.#fetchAhead.advance(line.authorityId, step.window.deliverySequence);
|
|
349
|
-
return await this.#window(line, step.window, startedAt);
|
|
350
|
-
}
|
|
351
|
-
catch (error) {
|
|
352
|
-
this.#fault(line, error);
|
|
353
|
-
return false;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* One step of one lane: its unit's window at the lane's position, or what
|
|
358
|
-
* ends it. A prerequisite parks it on that unit's lane. It never throws: a
|
|
359
|
-
* fault fails its waiters and holds only its lane.
|
|
360
|
-
*/
|
|
361
|
-
async #laneStep(lane) {
|
|
362
|
-
try {
|
|
363
|
-
const held = lane.held;
|
|
364
|
-
if (held && held.entityId === null && !held.due && held.notBefore > this.#options.now())
|
|
365
|
-
return false;
|
|
366
|
-
const startedAt = this.#wakeVersion;
|
|
367
|
-
const step = await this.#options.store.readFetchWindow(lane.unit, lane.through);
|
|
368
|
-
assertApplyLaneStep(lane.unit, step);
|
|
369
|
-
if (this.#stopped || !this.#current(lane))
|
|
370
|
-
return false;
|
|
371
|
-
if (lane.through !== null && step.through > lane.through)
|
|
372
|
-
lane.met.clear();
|
|
373
|
-
lane.through = Math.max(lane.through ?? 0, step.through);
|
|
374
|
-
lane.waitsOn = null;
|
|
375
|
-
// Only a window holds a window: the store answers an open one first.
|
|
376
|
-
if (step.kind !== 'window')
|
|
377
|
-
lane.held = null;
|
|
378
|
-
switch (step.kind) {
|
|
379
|
-
case 'end':
|
|
380
|
-
this.#endLane(lane, { kind: 'placed' });
|
|
381
|
-
return false;
|
|
382
|
-
case 'nowhere':
|
|
383
|
-
this.#endLane(lane, { kind: 'nowhere', reason: step.reason });
|
|
384
|
-
return false;
|
|
385
|
-
case 'root':
|
|
386
|
-
return await this.#enterRoot(lane, step.through, step.reason);
|
|
387
|
-
case 'prerequisite':
|
|
388
|
-
return this.#awaitPrerequisite(lane, step.unit, step.reason, startedAt);
|
|
389
|
-
case 'window':
|
|
390
|
-
return await this.#window(lane, step.window, startedAt);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
catch (error) {
|
|
394
|
-
this.#fault(lane, error);
|
|
395
|
-
return false;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
/** The host enters the lane's root once at its position, then the lane
|
|
399
|
-
* reads again; a root entered there and still not held fails the fetch. */
|
|
400
|
-
async #enterRoot(lane, through, reason) {
|
|
401
|
-
if (lane.met.has(lane.unit)) {
|
|
402
|
-
this.#endLane(lane, { kind: 'held', unit: lane.unit, reason: `${lane.unit} entered and still not held: ${reason}` });
|
|
403
|
-
return false;
|
|
404
|
-
}
|
|
405
|
-
await this.#options.effects.enterRoot(lane.unit, through);
|
|
406
|
-
if (this.#stopped || !this.#current(lane))
|
|
407
|
-
return false;
|
|
408
|
-
if (lane.through === through)
|
|
409
|
-
lane.met.add(lane.unit);
|
|
410
|
-
this.#moved(lane.unit);
|
|
411
|
-
return true;
|
|
412
|
-
}
|
|
413
|
-
/** A unit's lane, created at `through` or raised to it. A raised lane
|
|
414
|
-
* reads again: its held window at the older cutoff is no longer the one
|
|
415
|
-
* its dependent needs. */
|
|
416
|
-
#ensureLane(unit, through, emptied = false) {
|
|
417
|
-
let lane = this.#lanes.get(unit);
|
|
418
|
-
if (!lane) {
|
|
419
|
-
lane = createApplyLane(unit, through, emptied);
|
|
420
|
-
this.#lanes.set(unit, lane);
|
|
421
|
-
this.#enqueue(lane);
|
|
422
|
-
}
|
|
423
|
-
else if (through !== null && (lane.through === null || lane.through < through)) {
|
|
424
|
-
lane.through = through;
|
|
425
|
-
lane.met.clear();
|
|
426
|
-
this.#enqueue(lane);
|
|
427
|
-
}
|
|
428
|
-
return lane;
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* The lane waits on `unit`'s lane, at least at its own position, until
|
|
432
|
-
* that lane ends. A unit whose lane already placed it at this position
|
|
433
|
-
* and is still needed can never be placed by its lane again, so the fetch
|
|
434
|
-
* fails, naming it.
|
|
435
|
-
*/
|
|
436
|
-
#awaitPrerequisite(lane, unit, reason, startedAt) {
|
|
437
|
-
if (lane.met.has(unit)) {
|
|
438
|
-
this.#endLane(lane, { kind: 'held', unit, reason: `${unit} placed and still needed: ${reason}` });
|
|
439
|
-
return false;
|
|
440
|
-
}
|
|
441
|
-
if (!this.#needs(lane, unit, reason))
|
|
442
|
-
return false;
|
|
443
|
-
const dependency = { producer: 'apply', entityIds: [unit] };
|
|
444
|
-
lane.held = {
|
|
445
|
-
entityId: null,
|
|
446
|
-
target: null,
|
|
447
|
-
kept: null,
|
|
448
|
-
cutoff: null,
|
|
449
|
-
attempt: 1,
|
|
450
|
-
notBefore: Infinity,
|
|
451
|
-
releaseOnProgress: false,
|
|
452
|
-
due: this.#dependencyChanged(dependency, startedAt),
|
|
453
|
-
reason,
|
|
454
|
-
dependency,
|
|
455
|
-
};
|
|
456
|
-
return lane.held.due;
|
|
457
|
-
}
|
|
458
|
-
/**
|
|
459
|
-
* A lane whose window waits on another entity's Apply waits on that
|
|
460
|
-
* entity's lane, a worktree on its home for one: only a lane places what
|
|
461
|
-
* this computer does not show. A unit its lane already placed at this
|
|
462
|
-
* position waits plainly, on the line's later rows.
|
|
463
|
-
*/
|
|
464
|
-
#needsApplied(lane) {
|
|
465
|
-
const held = lane.held;
|
|
466
|
-
if (held?.dependency?.producer !== 'apply')
|
|
467
|
-
return;
|
|
468
|
-
for (const unit of held.dependency.entityIds) {
|
|
469
|
-
if (unit !== lane.unit && !lane.met.has(unit) && !this.#needs(lane, unit, held.reason))
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* The lane waits on `unit`'s lane, raised to the lane's position. A chain
|
|
475
|
-
* that comes back to this lane can never end, so every fetch in it fails,
|
|
476
|
-
* naming the unit it waits on, and this answers false.
|
|
477
|
-
*/
|
|
478
|
-
#needs(lane, unit, reason) {
|
|
479
|
-
const chain = [lane];
|
|
480
|
-
let next = this.#lanes.get(unit);
|
|
481
|
-
while (next && next !== lane && !chain.includes(next)) {
|
|
482
|
-
chain.push(next);
|
|
483
|
-
next = next.waitsOn === null ? undefined : this.#lanes.get(next.waitsOn);
|
|
484
|
-
}
|
|
485
|
-
if (next === lane) {
|
|
486
|
-
for (const member of chain) {
|
|
487
|
-
this.#endLane(member, { kind: 'held', unit, reason: `prerequisite cycle through ${unit}: ${reason}` });
|
|
488
|
-
}
|
|
489
|
-
return false;
|
|
490
|
-
}
|
|
491
|
-
lane.waitsOn ??= unit;
|
|
492
|
-
this.#enqueue(this.#ensureLane(unit, lane.through));
|
|
493
|
-
return true;
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* The lane's fetches are answered. A placed unit releases every lane
|
|
497
|
-
* waiting on it; any other answer fails them, naming the unit that failed.
|
|
498
|
-
* A lane ends unless it holds a window: that window keeps every
|
|
499
|
-
* obligation it owns, and its lane goes on placing.
|
|
500
|
-
*/
|
|
501
|
-
#endLane(lane, answer) {
|
|
502
|
-
if (!this.#current(lane))
|
|
503
|
-
return;
|
|
504
|
-
for (const waiter of lane.waiters)
|
|
505
|
-
waiter.answer(answer);
|
|
506
|
-
lane.waiters.clear();
|
|
507
|
-
lane.waitsOn = null;
|
|
508
|
-
if (answer.kind === 'placed' || lane.held?.entityId == null)
|
|
509
|
-
this.#lanes.delete(lane.unit);
|
|
510
|
-
const failed = answer.kind === 'placed' || answer.kind === 'held' ? answer
|
|
511
|
-
: { kind: 'held', unit: lane.unit, reason: `${lane.unit} is nowhere here: ${answer.reason}` };
|
|
512
|
-
for (const dependent of [...this.#lanes.values()]) {
|
|
513
|
-
if (dependent.waitsOn !== lane.unit)
|
|
514
|
-
continue;
|
|
515
|
-
if (answer.kind !== 'placed') {
|
|
516
|
-
this.#endLane(dependent, failed);
|
|
517
|
-
continue;
|
|
518
|
-
}
|
|
519
|
-
dependent.met.add(lane.unit);
|
|
520
|
-
}
|
|
521
|
-
if (answer.kind === 'placed') {
|
|
522
|
-
this.#moved(lane.unit);
|
|
523
|
-
this.#release('apply', [lane.unit]);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
/**
|
|
527
|
-
* `unit`'s lane moved: the stall clock of every fetch whose chain reaches
|
|
528
|
-
* it starts again. Each lane's chain is walked once across all lanes.
|
|
529
|
-
*/
|
|
530
|
-
#moved(unit) {
|
|
531
|
-
const reaches = new Map([[unit, true]]);
|
|
532
|
-
for (const lane of this.#lanes.values()) {
|
|
533
|
-
const path = new Set();
|
|
534
|
-
let at = lane.unit;
|
|
535
|
-
while (at !== null && !reaches.has(at) && !path.has(at)) {
|
|
536
|
-
path.add(at);
|
|
537
|
-
at = this.#lanes.get(at)?.waitsOn ?? null;
|
|
538
|
-
}
|
|
539
|
-
const result = at !== null && reaches.get(at) === true;
|
|
540
|
-
for (const id of path)
|
|
541
|
-
reaches.set(id, result);
|
|
542
|
-
if (result)
|
|
543
|
-
for (const waiter of lane.waiters)
|
|
544
|
-
waiter.moved();
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
/** What a fetch says when its stall clock runs out: the deepest lane its
|
|
548
|
-
* chain waits on, and why that one has not finished. */
|
|
549
|
-
#heldAnswer(lane) {
|
|
550
|
-
let deepest = lane;
|
|
551
|
-
const seen = new Set([lane]);
|
|
552
|
-
for (let next = lane.waitsOn === null ? undefined : this.#lanes.get(lane.waitsOn); next && !seen.has(next); next = next.waitsOn === null ? undefined : this.#lanes.get(next.waitsOn)) {
|
|
553
|
-
seen.add(next);
|
|
554
|
-
deepest = next;
|
|
555
|
-
}
|
|
556
|
-
return { kind: 'held', unit: deepest.unit, reason: deepest.held?.reason ?? 'still placing' };
|
|
557
|
-
}
|
|
558
|
-
async #window(line, window, startedAt) {
|
|
559
|
-
const first = window.members[0]?.work.entityId ?? null;
|
|
560
|
-
// A different first member means the held one no longer heads the line.
|
|
561
|
-
if (line.held && line.held.entityId !== null && line.held.entityId !== first)
|
|
562
|
-
line.held = null;
|
|
563
|
-
if (await this.#holds(line, window))
|
|
564
|
-
return false;
|
|
565
|
-
const outcome = await outcomeOf(() => this.#journey.run(window, () => line.kind === 'lane' && line.emptied ? line.unit : null));
|
|
566
|
-
if (outcome === 'progress')
|
|
567
|
-
return this.#progress(line, window.members.map(member => member.work.entityId));
|
|
568
|
-
if (outcome === 'again') {
|
|
569
|
-
// A stale proof or a dropped member is not a wait: no backoff, and
|
|
570
|
-
// nothing is released because nothing durable changed. The line goes
|
|
571
|
-
// to the back of the queue, so every other line takes its turn before
|
|
572
|
-
// this window proves again.
|
|
573
|
-
if (line.held?.entityId === first)
|
|
574
|
-
line.held = null;
|
|
575
|
-
return true;
|
|
576
|
-
}
|
|
577
|
-
// An end that committed with its head still owed released what its
|
|
578
|
-
// other members did; the head still waits.
|
|
579
|
-
if (outcome.advanced?.length)
|
|
580
|
-
this.#advanced(line, outcome.advanced);
|
|
581
|
-
if (line.kind === 'line') {
|
|
582
|
-
const end = windowEndForWait(window, outcome.dependency);
|
|
583
|
-
if (end !== null) {
|
|
584
|
-
line.endsBefore = end;
|
|
585
|
-
return true;
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
this.#park(line, window, outcome, startedAt);
|
|
589
|
-
if (line.kind === 'lane')
|
|
590
|
-
this.#needsApplied(line);
|
|
591
|
-
return line.held.due;
|
|
592
|
-
}
|
|
593
|
-
/** A held window runs again only on the releases its hold names. */
|
|
594
|
-
async #holds(line, window) {
|
|
595
|
-
const held = line.held;
|
|
596
|
-
const first = window.members[0];
|
|
597
|
-
if (!held || first === undefined || held.entityId !== first.work.entityId)
|
|
598
|
-
return false;
|
|
599
|
-
if (held.due || held.notBefore <= this.#options.now())
|
|
600
|
-
return false;
|
|
601
|
-
if (this.#journey.targetOf(window) !== held.target || window.cutoff !== held.cutoff)
|
|
602
|
-
return false;
|
|
603
|
-
return await this.#options.store.localWorkAfter(window.authorityId, first.work.entityId, held.kept ?? held.target) === null;
|
|
604
|
-
}
|
|
605
|
-
/** Progress changed durable state and moved the track, so it reads its
|
|
606
|
-
* window again. */
|
|
607
|
-
#progress(line, entityIds) {
|
|
608
|
-
if (line.held && (line.held.entityId === null || entityIds.includes(line.held.entityId)))
|
|
609
|
-
line.held = null;
|
|
610
|
-
this.#advanced(line, entityIds);
|
|
611
|
-
return true;
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
* Durable state changed for `entityIds`, whether or not the track's head
|
|
615
|
-
* moved. Every hold waiting on these entities, on any track, is due, and
|
|
616
|
-
* another track's conflict may have moved. A lane's end can owe rows
|
|
617
|
-
* again, so every line reads its window again too.
|
|
618
|
-
*/
|
|
619
|
-
#advanced(line, entityIds) {
|
|
620
|
-
if (line.kind === 'lane') {
|
|
621
|
-
this.#rescan = true;
|
|
622
|
-
this.#moved(line.unit);
|
|
623
|
-
}
|
|
624
|
-
this.#release('apply', entityIds);
|
|
625
|
-
for (const other of this.#tracks()) {
|
|
626
|
-
if (other !== line && other.held?.releaseOnProgress && !other.held.due) {
|
|
627
|
-
other.held.due = true;
|
|
628
|
-
this.#enqueue(other);
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
/**
|
|
633
|
-
* The head holds its line while every other line goes on: a bound intent
|
|
634
|
-
* keeps its ownership, and an attempt stays in memory. A wake the held
|
|
635
|
-
* attempt caused itself, such as the Detect pass behind its own capture,
|
|
636
|
-
* cannot re-run it.
|
|
637
|
-
*/
|
|
638
|
-
#park(line, window, outcome, startedAt) {
|
|
639
|
-
if (outcome.dependency)
|
|
640
|
-
assertApplyDependency(outcome.dependency);
|
|
641
|
-
if (outcome.blocker && !outcome.dependency) {
|
|
642
|
-
throw new Error('Apply blocker must name the dependency that releases it');
|
|
643
|
-
}
|
|
644
|
-
const entityId = window.members[0].work.entityId;
|
|
645
|
-
const previous = line.held;
|
|
646
|
-
const attempt = (previous?.entityId === entityId ? previous.attempt : 0) + 1;
|
|
647
|
-
const delay = this.#backoff(attempt);
|
|
648
|
-
const held = {
|
|
649
|
-
entityId,
|
|
650
|
-
target: this.#journey.targetOf(window),
|
|
651
|
-
kept: window.members[0].work.kept,
|
|
652
|
-
cutoff: window.cutoff,
|
|
653
|
-
attempt,
|
|
654
|
-
notBefore: outcome.dependency ? Infinity : this.#options.now() + delay,
|
|
655
|
-
releaseOnProgress: outcome.releaseOnProgress,
|
|
656
|
-
due: outcome.dependency
|
|
657
|
-
? this.#dependencyChanged(outcome.dependency, outcome.comparedAt ?? startedAt) : false,
|
|
658
|
-
reason: outcome.reason,
|
|
659
|
-
...(outcome.dependency ? { dependency: outcome.dependency } : {}),
|
|
660
|
-
...(outcome.blocker ? { blocker: outcome.blocker } : {}),
|
|
661
|
-
};
|
|
662
|
-
line.held = held;
|
|
663
|
-
this.#armRetry();
|
|
664
|
-
// A wait is reported when it appears or changes, never on each recheck.
|
|
665
|
-
const before = heldWait(previous);
|
|
666
|
-
const wait = heldWait(held);
|
|
667
|
-
if (wait && JSON.stringify(wait) !== JSON.stringify(before))
|
|
668
|
-
this.#options.onWaiting?.(wait);
|
|
669
|
-
if (!outcome.report && attempt < ENTITY_APPLY_QUIET_ATTEMPTS)
|
|
670
|
-
return;
|
|
671
|
-
this.#report(new Error(`${label(line)} holds at ${entityId}, which ${outcome.releaseOnProgress ? 'is parked on a conflict' : outcome.report ? 'failed' : 'stands on ground that keeps moving'}, and will retry in ${delay}ms (attempt ${attempt}): ${outcome.reason}`, outcome.cause === undefined ? undefined : { cause: outcome.cause }));
|
|
672
|
-
}
|
|
673
|
-
/** A store or settlement fault holds this track alone, under backoff. A
|
|
674
|
-
* lane's waiters learn of it now; the lane goes on retrying. */
|
|
675
|
-
#fault(line, error) {
|
|
676
|
-
if (line.kind === 'lane') {
|
|
677
|
-
for (const waiter of line.waiters)
|
|
678
|
-
waiter.fail(error);
|
|
679
|
-
line.waiters.clear();
|
|
680
|
-
}
|
|
681
|
-
const previous = line.held;
|
|
682
|
-
const attempt = (previous?.entityId === null ? previous.attempt : 0) + 1;
|
|
683
|
-
const delay = this.#backoff(attempt);
|
|
684
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
685
|
-
line.held = {
|
|
686
|
-
entityId: null,
|
|
687
|
-
target: null,
|
|
688
|
-
kept: null,
|
|
689
|
-
cutoff: null,
|
|
690
|
-
attempt,
|
|
691
|
-
notBefore: this.#options.now() + delay,
|
|
692
|
-
releaseOnProgress: false,
|
|
693
|
-
due: false,
|
|
694
|
-
reason,
|
|
695
|
-
};
|
|
696
|
-
this.#armRetry();
|
|
697
|
-
this.#report(new Error(`${label(line)} faulted and will retry in ${delay}ms (attempt ${attempt}): ${reason}`, { cause: error }));
|
|
698
|
-
}
|
|
699
|
-
#report(error) {
|
|
700
|
-
try {
|
|
701
|
-
this.#onBackgroundError(error);
|
|
702
|
-
}
|
|
703
|
-
catch {
|
|
704
|
-
// A failing reporter cannot stop a line.
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
#backoff(attempt) {
|
|
708
|
-
const base = Math.min(ENTITY_APPLY_RETRY_MAX_MS, ENTITY_APPLY_RETRY_BASE_MS * (2 ** Math.min(attempt - 1, 16)));
|
|
709
|
-
const random = Math.max(0, Math.min(1, this.#options.schedule.random()));
|
|
710
|
-
return Math.round(base * (0.5 + random));
|
|
711
|
-
}
|
|
712
|
-
#release(producer, entityIds) {
|
|
713
|
-
const revision = ++this.#wakeVersion;
|
|
714
|
-
for (const id of entityIds ?? ['*'])
|
|
715
|
-
this.#dependencyWakes.set(`${producer}:${id}`, revision);
|
|
716
|
-
for (const track of this.#tracks()) {
|
|
717
|
-
if (releaseApplyLine(track, producer, entityIds))
|
|
718
|
-
this.#enqueue(track);
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
#dependencyChanged(dependency, since) {
|
|
722
|
-
return ['*', ...dependency.entityIds].some(id => (this.#dependencyWakes.get(`${dependency.producer}:${id}`) ?? 0) > since);
|
|
723
|
-
}
|
|
724
|
-
/**
|
|
725
|
-
* One timer serves every held line and lane and a failed authority read:
|
|
726
|
-
* it is armed for the earliest wait and, when it fires, steps every track
|
|
727
|
-
* whose wait has elapsed. A wake of any other kind leaves the timer alone, so no
|
|
728
|
-
* wake can shorten a backoff.
|
|
729
|
-
*/
|
|
730
|
-
#armRetry() {
|
|
731
|
-
if (this.#stopped)
|
|
732
|
-
return;
|
|
733
|
-
let earliest = this.#scanRetryAt;
|
|
734
|
-
for (const track of this.#tracks()) {
|
|
735
|
-
if (track.held && !track.held.due)
|
|
736
|
-
earliest = Math.min(earliest, track.held.notBefore);
|
|
737
|
-
}
|
|
738
|
-
if (earliest === Infinity) {
|
|
739
|
-
this.#cancelRetry();
|
|
740
|
-
return;
|
|
741
|
-
}
|
|
742
|
-
if (this.#retry?.dueAt === earliest)
|
|
743
|
-
return;
|
|
744
|
-
this.#cancelRetry();
|
|
745
|
-
const delay = Math.max(0, earliest - this.#options.now());
|
|
746
|
-
const timer = this.#options.schedule.schedule(delay, () => {
|
|
747
|
-
this.#retry = null;
|
|
748
|
-
this.#elapse(earliest);
|
|
749
|
-
this.#pump();
|
|
750
|
-
});
|
|
751
|
-
this.#retry = { dueAt: earliest, cancel: () => timer.cancel() };
|
|
752
|
-
}
|
|
753
|
-
/** Every wait whose time is at or before `at` is due. True when one was. */
|
|
754
|
-
#elapse(at) {
|
|
755
|
-
let elapsed = false;
|
|
756
|
-
for (const track of this.#tracks()) {
|
|
757
|
-
if (track.held && !track.held.due && track.held.notBefore <= at) {
|
|
758
|
-
track.held.due = true;
|
|
759
|
-
this.#enqueue(track);
|
|
760
|
-
elapsed = true;
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
if (this.#scanRetryAt <= at) {
|
|
764
|
-
this.#scanRetryAt = Infinity;
|
|
765
|
-
this.#rescan = true;
|
|
766
|
-
elapsed = true;
|
|
767
|
-
}
|
|
768
|
-
return elapsed;
|
|
769
|
-
}
|
|
770
|
-
#cancelRetry() {
|
|
771
|
-
this.#retry?.cancel();
|
|
772
|
-
this.#retry = null;
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
const label = (track) => track.kind === 'line' ? `entity Apply line ${track.authorityId}` : `entity Apply fetch of ${track.unit}`;
|
|
776
|
-
//# sourceMappingURL=rail.js.map
|
|
1
|
+
var g=Object.defineProperty;var a=(d,t)=>g(d,"name",{value:t,configurable:!0});import{UUID_PATTERN as f}from"../entities/types.js";import{FetchAhead as m}from"./fetch-ahead.js";import{EntityApplyJourney as A,outcomeOf as I}from"./journey.js";import{assertApplyLaneStep as k,createApplyLane as E}from"./lane.js";import{assertApplyDependency as P,assertApplyLineStep as b,createApplyLine as v,heldWait as c,releaseApplyLine as O}from"./line.js";import{windowEndForWait as $}from"./window.js";const S=8,q=1e3,p=3e4,M=8;class Y{static{a(this,"EntityApplyRail")}#t;#w;#P;#M;#T;#g;#b;#f=!1;#e=!1;#o=new Map;#s=new Map;#a={queue:[],steps:new Set};#d={queue:[],steps:new Set};#r=!1;#n=null;#c=1/0;#m=[];#A=0;#v=new Map;#p=null;constructor(t){this.#t=t,this.#w=t.concurrency??S,this.#P=t.laneConcurrency??this.#w,this.#M=t.onBackgroundError??(()=>{}),this.#T=t.onIdle??(()=>{});for(const[e,s]of[["concurrency",this.#w],["lane concurrency",this.#P]])if(!Number.isSafeInteger(s)||s<1)throw new Error(`entity Apply ${e} must be a positive integer`);this.#g=new A(t,()=>this.#A,()=>this.#e),this.#b=new m(t.cargo,{sha256Hex:t.sha256Hex,loops:t.loops})}async start(){if(this.#f)throw new Error("entity Apply rail already started");if(this.#e)throw new Error("entity Apply rail is stopped");this.#f=!0;const t=await this.#t.store.readOpenUnits();if(!Array.isArray(t)||new Set(t).size!==t.length||t.some(e=>!f.test(e)))throw new Error("entity Apply store returned an invalid open unit list");for(const e of t)this.#O(e,null);await this.#_()}fetch(t,e){return this.#f?this.#e?Promise.reject(new Error("entity Apply rail is stopped")):f.test(t)?!Number.isFinite(e.stall)||e.stall<0?Promise.reject(new Error("entity Apply fetch needs a non-negative stall")):e.emptied!==void 0&&typeof e.emptied!="boolean"?Promise.reject(new Error("entity Apply fetch emptied must be a boolean")):new Promise((s,i)=>{const r=this.#O(t,null,e.emptied===!0),n=a(()=>this.#t.schedule.schedule(e.stall,()=>{r.waiters.delete(l)&&(r.emptied&&![...r.waiters].some(o=>o.emptied)&&(r.emptied=!1),s(this.#Q(r)))}),"arm");let h=n();const l={emptied:e.emptied===!0,answer:a(o=>{h.cancel(),s(o)},"answer"),fail:a(o=>{h.cancel(),i(o)},"fail"),moved:a(()=>{h.cancel(),h=n()},"moved")};r.waiters.add(l),r.waitsOn===null&&this.#R(r),this.#h()}):Promise.reject(new Error("entity Apply fetch needs a unit UUID")):Promise.reject(new Error("entity Apply rail has not started"))}progressed(t,e){if(!f.test(t))throw new Error("entity Apply progress needs a unit UUID");if(!Number.isSafeInteger(e)||e<0)throw new Error("entity Apply progress needs a byte count");e>0&&!this.#e&&this.#E(t)}recordsAvailable(){this.#I()}localStateChanged(t){this.#u("detect",t),this.#u("apply",t),this.#I()}sendAccepted(t){this.#u("send",t),this.#I()}capabilityChanged(t){this.#u("capability",t),this.#I()}#I(){!this.#f||this.#e||(this.#r=!0,this.#h())}waiting(){return this.#y().flatMap(t=>c(t.held)??[])}async flush(){if(!this.#f)throw new Error("entity Apply rail has not started");this.#e||await this.#_()}async stop(){if(this.#e)return;this.#e=!0,this.#q();for(const e of[this.#a,this.#d])for(const s of e.queue.splice(0))s.queued=!1;const t=new Error("entity Apply rail stopped before the fetch answered");for(const e of this.#s.values())for(const s of e.waiters)s.fail(t);for(this.#s.clear();this.#B()>0||this.#n;)await Promise.allSettled([...this.#a.steps,...this.#d.steps,...this.#n?[this.#n]:[]]);await this.#b.stop();for(const e of this.#m.splice(0))e.resolve()}#_(){return new Promise((t,e)=>{this.#m.push({resolve:t,reject:e}),this.#r=!0,this.#h()})}#h(){if(!this.#e){if(this.#r&&this.#n===null){this.#r=!1;const t=this.#W();this.#n=t,t.then(()=>{this.#n=null,this.#h()})}for(const[t,e]of[[this.#d,this.#P],[this.#a,this.#w]])for(;t.steps.size<e&&t.queue.length>0;){const s=t.queue.shift();s.queued=!1,this.#z(s,t)}if(this.#B()===0&&this.#n===null&&!this.#r&&this.#a.queue.length===0&&this.#d.queue.length===0){if(this.#v.clear(),this.#j(this.#t.now())){this.#h();return}this.#S();for(const t of this.#m.splice(0))t.resolve();this.#T()}}}#B(){return this.#a.steps.size+this.#d.steps.size}#y(){return[...this.#o.values(),...this.#s.values()]}#k(t){return t.kind==="line"?this.#o.get(t.authorityId)===t:this.#s.get(t.unit)===t}#i(t){if(!this.#e){if(t.running){t.again=!0;return}t.queued||(t.queued=!0,(t.kind==="line"?this.#a:this.#d).queue.push(t))}}#z(t,e){t.running=!0,t.again=!1;const s=(t.kind==="line"?this.#D(t):this.#F(t)).then(i=>{t.running=!1,e.steps.delete(s),(i||t.again)&&this.#k(t)&&(t.again=!1,this.#i(t)),this.#h()});e.steps.add(s)}async#W(){try{const t=await this.#t.store.readApplyAuthorities();if(!Array.isArray(t)||new Set(t).size!==t.length||t.some(s=>typeof s!="string"||s.length===0))throw new Error("entity Apply store returned an invalid authority list");this.#c=1/0;const e=new Set(t);for(const[s,i]of this.#o)!e.has(s)&&!i.running&&!i.queued&&this.#o.delete(s);for(const s of t){let i=this.#o.get(s);i||(i=v(s),this.#o.set(s,i)),this.#i(i)}}catch(t){this.#c=this.#t.now()+p;const e=this.#m.splice(0);e.length===0&&this.#$(t);for(const s of e)s.reject(t)}}async#D(t){try{const e=t.held;if(e&&e.entityId===null&&!e.due&&e.notBefore>this.#t.now())return!1;const s=this.#A,i=await this.#t.store.readApplyWindow(t.authorityId,t.endsBefore);if(b(t.authorityId,i),this.#e)return!1;if(i.kind==="end"){t.held=null;const r=t.endsBefore!==null;return t.endsBefore=null,r}return i.window.deliverySequence!==null&&this.#b.advance(t.authorityId,i.window.deliverySequence),await this.#L(t,i.window,s)}catch(e){return this.#Y(t,e),!1}}async#F(t){try{const e=t.held;if(e&&e.entityId===null&&!e.due&&e.notBefore>this.#t.now())return!1;const s=this.#A,i=await this.#t.store.readFetchWindow(t.unit,t.through);if(k(t.unit,i),this.#e||!this.#k(t))return!1;switch(t.through!==null&&i.through>t.through&&t.met.clear(),t.through=Math.max(t.through??0,i.through),t.waitsOn=null,i.kind!=="window"&&(t.held=null),i.kind){case"end":return this.#l(t,{kind:"placed"}),!1;case"nowhere":return this.#l(t,{kind:"nowhere",reason:i.reason}),!1;case"root":return await this.#J(t,i.through,i.reason);case"prerequisite":return this.#H(t,i.unit,i.reason,s);case"window":return await this.#L(t,i.window,s)}}catch(e){return this.#Y(t,e),!1}}async#J(t,e,s){return t.met.has(t.unit)?(this.#l(t,{kind:"held",unit:t.unit,reason:`${t.unit} entered and still not held: ${s}`}),!1):(await this.#t.effects.enterRoot(t.unit,e),this.#e||!this.#k(t)?!1:(t.through===e&&t.met.add(t.unit),this.#E(t.unit),!0))}#O(t,e,s=!1){let i=this.#s.get(t);return i?e!==null&&(i.through===null||i.through<e)&&(i.through=e,i.met.clear(),this.#i(i)):(i=E(t,e,s),this.#s.set(t,i),this.#i(i)),i}#H(t,e,s,i){if(t.met.has(e))return this.#l(t,{kind:"held",unit:e,reason:`${e} placed and still needed: ${s}`}),!1;if(!this.#x(t,e,s))return!1;const r={producer:"apply",entityIds:[e]};return t.held={entityId:null,target:null,kept:null,cutoff:null,attempt:1,notBefore:1/0,releaseOnProgress:!1,due:this.#C(r,i),reason:s,dependency:r},t.held.due}#R(t){const e=t.held;if(e?.dependency?.producer==="apply"){for(const s of e.dependency.entityIds)if(s!==t.unit&&!t.met.has(s)&&!this.#x(t,s,e.reason))return}}#x(t,e,s){const i=[t];let r=this.#s.get(e);for(;r&&r!==t&&!i.includes(r);)i.push(r),r=r.waitsOn===null?void 0:this.#s.get(r.waitsOn);if(r===t){for(const n of i)this.#l(n,{kind:"held",unit:e,reason:`prerequisite cycle through ${e}: ${s}`});return!1}return t.waitsOn??=e,this.#i(this.#O(e,t.through)),!0}#l(t,e){if(!this.#k(t))return;for(const i of t.waiters)i.answer(e);t.waiters.clear(),t.waitsOn=null,(e.kind==="placed"||t.held?.entityId==null)&&this.#s.delete(t.unit);const s=e.kind==="placed"||e.kind==="held"?e:{kind:"held",unit:t.unit,reason:`${t.unit} is nowhere here: ${e.reason}`};for(const i of[...this.#s.values()])if(i.waitsOn===t.unit){if(e.kind!=="placed"){this.#l(i,s);continue}i.met.add(t.unit)}e.kind==="placed"&&(this.#E(t.unit),this.#u("apply",[t.unit]))}#E(t){const e=new Map([[t,!0]]);for(const s of this.#s.values()){const i=new Set;let r=s.unit;for(;r!==null&&!e.has(r)&&!i.has(r);)i.add(r),r=this.#s.get(r)?.waitsOn??null;const n=r!==null&&e.get(r)===!0;for(const h of i)e.set(h,n);if(n)for(const h of s.waiters)h.moved()}}#Q(t){let e=t;const s=new Set([t]);for(let i=t.waitsOn===null?void 0:this.#s.get(t.waitsOn);i&&!s.has(i);i=i.waitsOn===null?void 0:this.#s.get(i.waitsOn))s.add(i),e=i;return{kind:"held",unit:e.unit,reason:e.held?.reason??"still placing"}}async#L(t,e,s){const i=e.members[0]?.work.entityId??null;if(t.held&&t.held.entityId!==null&&t.held.entityId!==i&&(t.held=null),await this.#V(t,e))return!1;const r=await I(()=>this.#g.run(e,()=>t.kind==="lane"&&t.emptied?t.unit:null));if(r==="progress")return this.#X(t,e.members.map(n=>n.work.entityId));if(r==="again")return t.held?.entityId===i&&(t.held=null),!0;if(r.advanced?.length&&this.#N(t,r.advanced),t.kind==="line"){const n=$(e,r.dependency);if(n!==null)return t.endsBefore=n,!0}return this.#G(t,e,r,s),t.kind==="lane"&&this.#R(t),t.held.due}async#V(t,e){const s=t.held,i=e.members[0];return!s||i===void 0||s.entityId!==i.work.entityId||s.due||s.notBefore<=this.#t.now()||this.#g.targetOf(e)!==s.target||e.cutoff!==s.cutoff?!1:await this.#t.store.localWorkAfter(e.authorityId,i.work.entityId,s.kept??s.target)===null}#X(t,e){return t.held&&(t.held.entityId===null||e.includes(t.held.entityId))&&(t.held=null),this.#N(t,e),!0}#N(t,e){t.kind==="lane"&&(this.#r=!0,this.#E(t.unit)),this.#u("apply",e);for(const s of this.#y())s!==t&&s.held?.releaseOnProgress&&!s.held.due&&(s.held.due=!0,this.#i(s))}#G(t,e,s,i){if(s.dependency&&P(s.dependency),s.blocker&&!s.dependency)throw new Error("Apply blocker must name the dependency that releases it");const r=e.members[0].work.entityId,n=t.held,h=(n?.entityId===r?n.attempt:0)+1,l=this.#U(h),o={entityId:r,target:this.#g.targetOf(e),kept:e.members[0].work.kept,cutoff:e.cutoff,attempt:h,notBefore:s.dependency?1/0:this.#t.now()+l,releaseOnProgress:s.releaseOnProgress,due:s.dependency?this.#C(s.dependency,s.comparedAt??i):!1,reason:s.reason,...s.dependency?{dependency:s.dependency}:{},...s.blocker?{blocker:s.blocker}:{}};t.held=o,this.#S();const w=c(n),u=c(o);u&&JSON.stringify(u)!==JSON.stringify(w)&&this.#t.onWaiting?.(u),!(!s.report&&h<M)&&this.#$(new Error(`${y(t)} holds at ${r}, which ${s.releaseOnProgress?"is parked on a conflict":s.report?"failed":"stands on ground that keeps moving"}, and will retry in ${l}ms (attempt ${h}): ${s.reason}`,s.cause===void 0?void 0:{cause:s.cause}))}#Y(t,e){if(t.kind==="lane"){for(const h of t.waiters)h.fail(e);t.waiters.clear()}const s=t.held,i=(s?.entityId===null?s.attempt:0)+1,r=this.#U(i),n=e instanceof Error?e.message:String(e);t.held={entityId:null,target:null,kept:null,cutoff:null,attempt:i,notBefore:this.#t.now()+r,releaseOnProgress:!1,due:!1,reason:n},this.#S(),this.#$(new Error(`${y(t)} faulted and will retry in ${r}ms (attempt ${i}): ${n}`,{cause:e}))}#$(t){try{this.#M(t)}catch{}}#U(t){const e=Math.min(p,q*2**Math.min(t-1,16)),s=Math.max(0,Math.min(1,this.#t.schedule.random()));return Math.round(e*(.5+s))}#u(t,e){const s=++this.#A;for(const i of e??["*"])this.#v.set(`${t}:${i}`,s);for(const i of this.#y())O(i,t,e)&&this.#i(i)}#C(t,e){return["*",...t.entityIds].some(s=>(this.#v.get(`${t.producer}:${s}`)??0)>e)}#S(){if(this.#e)return;let t=this.#c;for(const i of this.#y())i.held&&!i.held.due&&(t=Math.min(t,i.held.notBefore));if(t===1/0){this.#q();return}if(this.#p?.dueAt===t)return;this.#q();const e=Math.max(0,t-this.#t.now()),s=this.#t.schedule.schedule(e,()=>{this.#p=null,this.#j(t),this.#h()});this.#p={dueAt:t,cancel:a(()=>s.cancel(),"cancel")}}#j(t){let e=!1;for(const s of this.#y())s.held&&!s.held.due&&s.held.notBefore<=t&&(s.held.due=!0,this.#i(s),e=!0);return this.#c<=t&&(this.#c=1/0,this.#r=!0,e=!0),e}#q(){this.#p?.cancel(),this.#p=null}}const y=a(d=>d.kind==="line"?`entity Apply line ${d.authorityId}`:`entity Apply fetch of ${d.unit}`,"label");export{S as ENTITY_APPLY_DEFAULT_CONCURRENCY,M as ENTITY_APPLY_QUIET_ATTEMPTS,q as ENTITY_APPLY_RETRY_BASE_MS,p as ENTITY_APPLY_RETRY_MAX_MS,Y as EntityApplyRail};
|