@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
|
@@ -1,627 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Download a set of immutable artifacts into a machine cache.
|
|
3
|
-
*
|
|
4
|
-
* The set is the primitive and the plan is physical. Wave one proves every
|
|
5
|
-
* manifest: locally held ones are checked in place, missing ones are
|
|
6
|
-
* resolved as one want-list and fetched grouped by the pack that holds
|
|
7
|
-
* them. Content past one manifest names a list of parts, so its parts'
|
|
8
|
-
* manifests are proven the same way, in one more want-list that content one
|
|
9
|
-
* manifest names never asks. Wave two reads the proven manifests, asks the cache which chunks
|
|
10
|
-
* are gaps, resolves the whole gap list, and fetches it the same way: all
|
|
11
|
-
* members of one pack collapse into a few broad byte spans — approximately
|
|
12
|
-
* one read per pack — while standalone objects remain one read each. A
|
|
13
|
-
* lone artifact is a set of one; there is no second download path.
|
|
14
|
-
*
|
|
15
|
-
* Spans complete in whatever order storage answers, but each artifact
|
|
16
|
-
* stores its chunks in chunk order: a verified chunk waits until every
|
|
17
|
-
* earlier gap of the same artifact is stored, so a host assembling a
|
|
18
|
-
* whole-file digest never re-reads what landed early. The scheduler admits
|
|
19
|
-
* fetch units strictly in fair plan order, and the plan orders units so a
|
|
20
|
-
* chunk's predecessor always lives in the same or an earlier unit — an
|
|
21
|
-
* artifact whose gaps do not line up ascending inside one pack falls back
|
|
22
|
-
* to per-object reads at its own positions — so ordered stores can never
|
|
23
|
-
* deadlock. Admission takes the largest remaining work first: the set is
|
|
24
|
-
* done only when all of it is, so the bytes its largest artifacts must move
|
|
25
|
-
* and land start with its first read, and small work fills in behind them.
|
|
26
|
-
* Fetched pack members feed a separate bounded store gate: source
|
|
27
|
-
* request geometry never limits independent destination files to one writer,
|
|
28
|
-
* and a later chunk waits for its predecessor before claiming a store lane.
|
|
29
|
-
* In-flight span bytes stay inside one explicit bound; raising request or
|
|
30
|
-
* store concurrency never silently raises memory.
|
|
31
|
-
*
|
|
32
|
-
* Every object keeps one content-addressed identity whether its sealed
|
|
33
|
-
* envelope lives alone or as a byte range inside an immutable pack. Physical
|
|
34
|
-
* placement is only a locator: a retried read may discover that an object
|
|
35
|
-
* moved between those shapes. A URL-only refresh keeps the current wave;
|
|
36
|
-
* moved geometry discards it and boundedly replans the whole unresolved set.
|
|
37
|
-
* Wrong or shifted bytes cannot leak — every dispensed slice is still an
|
|
38
|
-
* authenticated envelope the host opens and this engine hash-verifies before
|
|
39
|
-
* a single byte is stored.
|
|
40
|
-
*/
|
|
41
|
-
import { CHUNK_BYTES, checkContentIndex, checkContentLayout, checkContentManifest, isContentParts, manifestLayout, } from '../contracts/content.js';
|
|
42
|
-
import { failure } from '../faults/need.js';
|
|
43
|
-
import { assertTransferArtifact } from './artifacts.js';
|
|
44
|
-
import { createParallelGate, DEFAULT_TRANSFER_CONCURRENCY, parallelForEach, weightedParallelForEach, } from './parallel.js';
|
|
45
|
-
import { planPackSpans, RANGE_MERGE_GAP_BYTES } from './ranges.js';
|
|
46
|
-
import { resolveContentRefs } from './refs.js';
|
|
47
|
-
/** Physical placement is not content identity. This error crosses the host's
|
|
48
|
-
* storage retry boundary so the set primitive can discard every ref derived
|
|
49
|
-
* from the stale placement and resolve one coherent replacement plan. */
|
|
50
|
-
const CONTENT_PLACEMENT_CHANGED = Symbol.for('@amalgm/live/content-placement-changed');
|
|
51
|
-
const CONTENT_PLACEMENT_CHANGED_CODE = 'content_placement_changed';
|
|
52
|
-
export class ContentPlacementChangedError extends Error {
|
|
53
|
-
code = CONTENT_PLACEMENT_CHANGED_CODE;
|
|
54
|
-
constructor(object) {
|
|
55
|
-
super(`content ${object.kind} ${object.sha256} changed placement between fetch attempts`, {
|
|
56
|
-
cause: { code: CONTENT_PLACEMENT_CHANGED_CODE },
|
|
57
|
-
});
|
|
58
|
-
this.name = 'ContentPlacementChangedError';
|
|
59
|
-
Object.defineProperty(this, CONTENT_PLACEMENT_CHANGED, { value: true });
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/** SDK copies and host realms can coexist in one assembled runtime. A
|
|
63
|
-
* planning signal must retain its meaning across both boundaries: class
|
|
64
|
-
* identity and process-local symbols are implementation details, while an
|
|
65
|
-
* Error cause survives the host's structured-clone boundary. */
|
|
66
|
-
export function isContentPlacementChangedError(error) {
|
|
67
|
-
if (typeof error !== 'object' || error === null)
|
|
68
|
-
return false;
|
|
69
|
-
if (Reflect.get(error, CONTENT_PLACEMENT_CHANGED) === true
|
|
70
|
-
|| Reflect.get(error, 'code') === CONTENT_PLACEMENT_CHANGED_CODE)
|
|
71
|
-
return true;
|
|
72
|
-
const cause = Reflect.get(error, 'cause');
|
|
73
|
-
return typeof cause === 'object'
|
|
74
|
-
&& cause !== null
|
|
75
|
-
&& Reflect.get(cause, 'code') === CONTENT_PLACEMENT_CHANGED_CODE;
|
|
76
|
-
}
|
|
77
|
-
const MAX_DOWNLOAD_PLACEMENT_PLANS = 3;
|
|
78
|
-
/** Partition one concurrent phase by active work rather than summing
|
|
79
|
-
* overlapping operation durations. Counts, rather than booleans, keep a bit
|
|
80
|
-
* active until the last concurrent operation of that kind settles. */
|
|
81
|
-
class BlockActivityClock {
|
|
82
|
-
counts = [0, 0, 0];
|
|
83
|
-
totals = Array.from({ length: 8 }, () => 0);
|
|
84
|
-
state = 0;
|
|
85
|
-
changedAt = performance.now();
|
|
86
|
-
async time(activity, work) {
|
|
87
|
-
const bit = activity === 'network' ? 0 : activity === 'transform' ? 1 : 2;
|
|
88
|
-
this.transition(bit, 1);
|
|
89
|
-
try {
|
|
90
|
-
return await work();
|
|
91
|
-
}
|
|
92
|
-
finally {
|
|
93
|
-
this.transition(bit, -1);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
timeSync(activity, work) {
|
|
97
|
-
const bit = activity === 'network' ? 0 : activity === 'transform' ? 1 : 2;
|
|
98
|
-
this.transition(bit, 1);
|
|
99
|
-
try {
|
|
100
|
-
return work();
|
|
101
|
-
}
|
|
102
|
-
finally {
|
|
103
|
-
this.transition(bit, -1);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
report() {
|
|
107
|
-
this.record(performance.now());
|
|
108
|
-
const rounded = this.totals.map((duration) => Math.round(duration));
|
|
109
|
-
return {
|
|
110
|
-
blockNeitherMs: rounded[0] ?? 0,
|
|
111
|
-
blockNetworkOnlyMs: rounded[1] ?? 0,
|
|
112
|
-
blockTransformOnlyMs: rounded[2] ?? 0,
|
|
113
|
-
blockStoreOnlyMs: rounded[4] ?? 0,
|
|
114
|
-
blockNetworkTransformMs: rounded[3] ?? 0,
|
|
115
|
-
blockNetworkStoreMs: rounded[5] ?? 0,
|
|
116
|
-
blockTransformStoreMs: rounded[6] ?? 0,
|
|
117
|
-
blockAllActiveMs: rounded[7] ?? 0,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
transition(bit, delta) {
|
|
121
|
-
const now = performance.now();
|
|
122
|
-
this.record(now);
|
|
123
|
-
const next = (this.counts[bit] ?? 0) + delta;
|
|
124
|
-
if (next < 0)
|
|
125
|
-
throw new Error('download activity clock lost an operation');
|
|
126
|
-
this.counts[bit] = next;
|
|
127
|
-
this.state = this.counts.reduce((mask, count, index) => count > 0 ? mask | (1 << index) : mask, 0);
|
|
128
|
-
}
|
|
129
|
-
record(now) {
|
|
130
|
-
this.totals[this.state] = (this.totals[this.state] ?? 0) + (now - this.changedAt);
|
|
131
|
-
this.changedAt = now;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
function checkRefLocation(ref, object) {
|
|
135
|
-
if (ref === undefined || typeof ref.url !== 'string' || ref.url.length === 0) {
|
|
136
|
-
throw new Error(`content ref for ${object.kind} ${object.sha256} named no location`);
|
|
137
|
-
}
|
|
138
|
-
if ((ref.offset === undefined) !== (ref.length === undefined)) {
|
|
139
|
-
throw new Error(`content ref for ${object.kind} ${object.sha256} named half a byte range`);
|
|
140
|
-
}
|
|
141
|
-
if (ref.offset === undefined || ref.length === undefined)
|
|
142
|
-
return { url: ref.url, span: null };
|
|
143
|
-
if (!Number.isSafeInteger(ref.offset) || ref.offset < 0
|
|
144
|
-
|| !Number.isSafeInteger(ref.length) || ref.length < 1) {
|
|
145
|
-
throw new Error(`content ref for ${object.kind} ${object.sha256} named an invalid byte range`);
|
|
146
|
-
}
|
|
147
|
-
return { url: ref.url, span: { offset: ref.offset, length: ref.length } };
|
|
148
|
-
}
|
|
149
|
-
/** Resolve one wave's want-list and fetch it as planned units: pack members
|
|
150
|
-
* as broad spans, standalone objects whole. Deadlock-frame law: dependencies
|
|
151
|
-
* only run backward along a chain, chains join pack grouping only when their
|
|
152
|
-
* refs ascend inside one pack, a pack's spans stay contiguous in ascending
|
|
153
|
-
* offset order, and admission is strictly FIFO — so a chunk's predecessor is
|
|
154
|
-
* always in the same unit earlier, or in an already-admitted one. */
|
|
155
|
-
async function fetchWave(ports, chains, concurrency, maxInFlightBytes, sharedBytes, memberConcurrency = 1) {
|
|
156
|
-
// Largest remaining work first: each item is keyed by the bytes its chain
|
|
157
|
-
// holds from it on. What remains only shrinks along a chain, so every
|
|
158
|
-
// predecessor is admitted before its successor; equal keys keep input
|
|
159
|
-
// order.
|
|
160
|
-
const flat = chains.flatMap((items, chain) => {
|
|
161
|
-
let remaining = items.reduce((sum, item) => sum + item.standaloneWeight, 0);
|
|
162
|
-
return items.map((item, depth) => {
|
|
163
|
-
const key = remaining;
|
|
164
|
-
remaining -= item.standaloneWeight;
|
|
165
|
-
return { chain, depth, key, item };
|
|
166
|
-
});
|
|
167
|
-
}).sort((a, b) => b.key - a.key || a.chain - b.chain || a.depth - b.depth);
|
|
168
|
-
if (flat.length === 0)
|
|
169
|
-
return { rangedReads: 0, packedObjects: 0, standaloneObjects: 0 };
|
|
170
|
-
const refs = await resolveContentRefs(ports, flat.map(({ item }) => item.object));
|
|
171
|
-
const byChain = chains.map(() => []);
|
|
172
|
-
flat.forEach(({ chain, item }, order) => {
|
|
173
|
-
const members = byChain[chain];
|
|
174
|
-
if (members === undefined)
|
|
175
|
-
throw new Error('download wave lost a chain');
|
|
176
|
-
members.push({ item, order, ...checkRefLocation(refs[order], item.object) });
|
|
177
|
-
});
|
|
178
|
-
// A chain rides pack grouping only when every gap sits in one pack with
|
|
179
|
-
// non-descending offsets; anything else falls back to per-object reads so
|
|
180
|
-
// store order can never depend on a later fetch unit.
|
|
181
|
-
const groups = new Map();
|
|
182
|
-
const singles = [];
|
|
183
|
-
for (const chain of byChain) {
|
|
184
|
-
const first = chain[0];
|
|
185
|
-
if (first === undefined)
|
|
186
|
-
continue;
|
|
187
|
-
const coherent = chain.every((member, index) => {
|
|
188
|
-
if (member.span === null || member.url !== first.url)
|
|
189
|
-
return false;
|
|
190
|
-
const previous = chain[index - 1];
|
|
191
|
-
return previous?.span == null || member.span.offset >= previous.span.offset;
|
|
192
|
-
});
|
|
193
|
-
// A chain is one artifact's gaps, up to MAX_CONTENT_PARTS x
|
|
194
|
-
// MAX_CONTENT_BLOCKS of them, so it is never spread into one call's
|
|
195
|
-
// arguments: past about 100k the call stack overflows.
|
|
196
|
-
if (!coherent) {
|
|
197
|
-
for (const member of chain)
|
|
198
|
-
singles.push(member);
|
|
199
|
-
continue;
|
|
200
|
-
}
|
|
201
|
-
const members = groups.get(first.url);
|
|
202
|
-
if (members === undefined)
|
|
203
|
-
groups.set(first.url, [...chain]);
|
|
204
|
-
else
|
|
205
|
-
for (const member of chain)
|
|
206
|
-
members.push(member);
|
|
207
|
-
}
|
|
208
|
-
const units = [];
|
|
209
|
-
let packedObjects = 0;
|
|
210
|
-
let standaloneObjects = 0;
|
|
211
|
-
for (const members of groups.values()) {
|
|
212
|
-
packedObjects += members.length;
|
|
213
|
-
members.sort((a, b) => (a.span?.offset ?? 0) - (b.span?.offset ?? 0) || a.order - b.order);
|
|
214
|
-
const spans = members.map((member) => {
|
|
215
|
-
if (member.span === null)
|
|
216
|
-
throw new Error('download wave grouped a standalone object');
|
|
217
|
-
return member.span;
|
|
218
|
-
});
|
|
219
|
-
const plan = planPackSpans(spans, RANGE_MERGE_GAP_BYTES, maxInFlightBytes);
|
|
220
|
-
const perSpan = plan.spans.map(() => []);
|
|
221
|
-
members.forEach((member, index) => {
|
|
222
|
-
const spanIndex = plan.memberSpan[index];
|
|
223
|
-
const list = spanIndex === undefined ? undefined : perSpan[spanIndex];
|
|
224
|
-
if (list === undefined)
|
|
225
|
-
throw new Error('download wave lost a span member');
|
|
226
|
-
list.push(member);
|
|
227
|
-
});
|
|
228
|
-
const primary = members.reduce((least, member) => Math.min(least, member.order), Number.MAX_SAFE_INTEGER);
|
|
229
|
-
plan.spans.forEach((span, index) => {
|
|
230
|
-
const list = perSpan[index];
|
|
231
|
-
const anchor = list?.[0];
|
|
232
|
-
if (list === undefined || anchor === undefined) {
|
|
233
|
-
throw new Error('download wave planned an empty span');
|
|
234
|
-
}
|
|
235
|
-
units.push({
|
|
236
|
-
url: anchor.url,
|
|
237
|
-
span,
|
|
238
|
-
members: list.map((member) => {
|
|
239
|
-
if (member.span === null)
|
|
240
|
-
throw new Error('download wave grouped a standalone object');
|
|
241
|
-
return {
|
|
242
|
-
item: member.item,
|
|
243
|
-
offset: member.span.offset - span.offset,
|
|
244
|
-
length: member.span.length,
|
|
245
|
-
};
|
|
246
|
-
}),
|
|
247
|
-
refresh: anchor,
|
|
248
|
-
weight: Math.min(span.length, maxInFlightBytes),
|
|
249
|
-
primary,
|
|
250
|
-
secondary: index,
|
|
251
|
-
ranged: true,
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
for (const member of singles) {
|
|
256
|
-
if (member.span !== null) {
|
|
257
|
-
packedObjects += 1;
|
|
258
|
-
units.push({
|
|
259
|
-
url: member.url,
|
|
260
|
-
span: member.span,
|
|
261
|
-
members: [{ item: member.item, offset: 0, length: member.span.length }],
|
|
262
|
-
refresh: member,
|
|
263
|
-
weight: Math.min(member.span.length, maxInFlightBytes),
|
|
264
|
-
primary: member.order,
|
|
265
|
-
secondary: 0,
|
|
266
|
-
ranged: true,
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
standaloneObjects += 1;
|
|
271
|
-
units.push({
|
|
272
|
-
url: member.url,
|
|
273
|
-
span: null,
|
|
274
|
-
members: [{ item: member.item, offset: 0, length: null }],
|
|
275
|
-
refresh: member,
|
|
276
|
-
weight: Math.max(1, Math.min(member.item.standaloneWeight, maxInFlightBytes)),
|
|
277
|
-
primary: member.order,
|
|
278
|
-
secondary: 0,
|
|
279
|
-
ranged: false,
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
units.sort((a, b) => a.primary - b.primary || a.secondary - b.secondary);
|
|
284
|
-
/** One unit's storage read and the delivery of every member it carries. */
|
|
285
|
-
const fetchUnit = async (unit) => {
|
|
286
|
-
const started = new Set();
|
|
287
|
-
try {
|
|
288
|
-
const refresh = async () => {
|
|
289
|
-
const [fresh] = await ports.requestRefs([unit.refresh.item.object]);
|
|
290
|
-
const location = checkRefLocation(fresh, unit.refresh.item.object);
|
|
291
|
-
const before = unit.refresh.span;
|
|
292
|
-
const moved = (location.span === null) !== (before === null)
|
|
293
|
-
|| (location.span !== null && before !== null
|
|
294
|
-
&& (location.span.offset !== before.offset
|
|
295
|
-
|| location.span.length !== before.length));
|
|
296
|
-
if (moved) {
|
|
297
|
-
throw new ContentPlacementChangedError(unit.refresh.item.object);
|
|
298
|
-
}
|
|
299
|
-
return location.url;
|
|
300
|
-
};
|
|
301
|
-
const bytes = await ports.fetchSpan(unit.url, unit.span, refresh);
|
|
302
|
-
if (!(bytes instanceof Uint8Array))
|
|
303
|
-
throw new Error('storage fetch answered no bytes');
|
|
304
|
-
if (unit.span !== null && bytes.byteLength !== unit.span.length) {
|
|
305
|
-
throw new Error('storage fetch answered the wrong byte count');
|
|
306
|
-
}
|
|
307
|
-
await parallelForEach(unit.members, memberConcurrency, async (member) => {
|
|
308
|
-
started.add(member.item);
|
|
309
|
-
const sealed = member.length === null
|
|
310
|
-
? bytes
|
|
311
|
-
: bytes.subarray(member.offset, member.offset + member.length);
|
|
312
|
-
if (member.length !== null && sealed.byteLength !== member.length) {
|
|
313
|
-
throw new Error('storage span cannot cover a planned member');
|
|
314
|
-
}
|
|
315
|
-
await member.item.deliver(sealed);
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
catch (error) {
|
|
319
|
-
for (const member of unit.members) {
|
|
320
|
-
if (!started.has(member.item))
|
|
321
|
-
member.item.fail(error);
|
|
322
|
-
}
|
|
323
|
-
throw error;
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
await weightedParallelForEach(units, concurrency, maxInFlightBytes, (unit) => unit.weight, (unit) => sharedBytes === undefined ? fetchUnit(unit) : sharedBytes.run(unit.weight, () => fetchUnit(unit)));
|
|
327
|
-
return {
|
|
328
|
-
rangedReads: units.reduce((count, unit) => count + (unit.ranged ? 1 : 0), 0),
|
|
329
|
-
packedObjects,
|
|
330
|
-
standaloneObjects,
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
const addWaves = (left, right) => ({
|
|
334
|
-
rangedReads: left.rangedReads + right.rangedReads,
|
|
335
|
-
packedObjects: left.packedObjects + right.packedObjects,
|
|
336
|
-
standaloneObjects: left.standaloneObjects + right.standaloneObjects,
|
|
337
|
-
});
|
|
338
|
-
/** Open one fetched manifest object into its parsed JSON. */
|
|
339
|
-
const openManifest = async (ports, object, sealed) => {
|
|
340
|
-
const plain = await ports.openEnvelope(object, sealed);
|
|
341
|
-
try {
|
|
342
|
-
return JSON.parse(new TextDecoder().decode(plain));
|
|
343
|
-
}
|
|
344
|
-
catch {
|
|
345
|
-
throw failure(`downloaded manifest for ${object.sha256} is not valid JSON`, 'cargo-missing', 'manifest-unreadable', null, object.sha256);
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
/** Prove one manifest per artifact, held ones in place and the rest as one
|
|
349
|
-
* planned wave grouped by pack. `check` proves each against its artifact; a
|
|
350
|
-
* fetched one it refuses is cargo the authority no longer holds whole. */
|
|
351
|
-
async function proveWave(artifacts, ports, check, proven, concurrency, maxInFlightBytes, sharedBytes) {
|
|
352
|
-
const indexes = new Array(artifacts.length);
|
|
353
|
-
let local = 0;
|
|
354
|
-
const chains = [];
|
|
355
|
-
artifacts.forEach((artifact, slot) => {
|
|
356
|
-
const held = ports.localManifest(artifact);
|
|
357
|
-
if (held !== null && held !== undefined) {
|
|
358
|
-
const checked = check(held, artifact);
|
|
359
|
-
if (!checked.ok)
|
|
360
|
-
throw new Error(checked.error);
|
|
361
|
-
indexes[slot] = checked.value;
|
|
362
|
-
local += 1;
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
const object = { kind: 'manifest', sha256: artifact.contentHash };
|
|
366
|
-
chains.push([{
|
|
367
|
-
object,
|
|
368
|
-
standaloneWeight: 1,
|
|
369
|
-
deliver: async (sealed) => {
|
|
370
|
-
const checked = check(await openManifest(ports, object, sealed), artifact);
|
|
371
|
-
if (!checked.ok)
|
|
372
|
-
throw failure(checked.error, 'cargo-missing', 'manifest-invalid', null, artifact.contentHash);
|
|
373
|
-
indexes[slot] = checked.value;
|
|
374
|
-
await proven(artifact, checked.value);
|
|
375
|
-
},
|
|
376
|
-
fail: () => { },
|
|
377
|
-
}]);
|
|
378
|
-
});
|
|
379
|
-
const wave = await fetchWave(ports, chains, concurrency, maxInFlightBytes, sharedBytes);
|
|
380
|
-
return {
|
|
381
|
-
indexes: indexes.map((index) => {
|
|
382
|
-
if (index === undefined)
|
|
383
|
-
throw new Error('download set lost a manifest');
|
|
384
|
-
return index;
|
|
385
|
-
}),
|
|
386
|
-
local,
|
|
387
|
-
fetched: chains.length,
|
|
388
|
-
wave,
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
/** Wave one, its first half: prove every artifact's index, the manifest or
|
|
392
|
-
* list its content hash names. */
|
|
393
|
-
async function proveIndexes(artifacts, ports, concurrency, maxInFlightBytes, sharedBytes) {
|
|
394
|
-
return proveWave(artifacts, ports, (input, artifact) => checkContentIndex(input, artifact.contentHash), (artifact, index) => ports.manifestProven(artifact, index), concurrency, maxInFlightBytes, sharedBytes);
|
|
395
|
-
}
|
|
396
|
-
/** Wave one: prove every index, then every part manifest a list names, each
|
|
397
|
-
* part once whichever artifacts name it. Content one manifest names asks
|
|
398
|
-
* nothing more. */
|
|
399
|
-
async function proveManifests(artifacts, ports, concurrency, maxInFlightBytes, sharedBytes) {
|
|
400
|
-
const top = await proveIndexes(artifacts, ports, concurrency, maxInFlightBytes, sharedBytes);
|
|
401
|
-
const wanted = new Map();
|
|
402
|
-
top.indexes.forEach((index, slot) => {
|
|
403
|
-
if (!isContentParts(index))
|
|
404
|
-
return;
|
|
405
|
-
for (const part of index.parts) {
|
|
406
|
-
if (!wanted.has(part.sha256)) {
|
|
407
|
-
wanted.set(part.sha256, { artifact: { ...artifacts[slot], contentHash: part.sha256 }, bytes: part.bytes });
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
});
|
|
411
|
-
const named = [...wanted.values()];
|
|
412
|
-
const parts = named.length === 0 ? null : await proveWave(named.map((part) => part.artifact), ports, (input, artifact) => {
|
|
413
|
-
const checked = checkContentManifest(input, artifact.contentHash);
|
|
414
|
-
if (checked.ok && checked.value.bytes !== wanted.get(artifact.contentHash)?.bytes) {
|
|
415
|
-
return { ok: false, error: `content part ${artifact.contentHash} manifest length is invalid` };
|
|
416
|
-
}
|
|
417
|
-
return checked;
|
|
418
|
-
}, (artifact, manifest) => ports.manifestProven(artifact, manifest), concurrency, maxInFlightBytes, sharedBytes);
|
|
419
|
-
const partManifests = new Map(parts?.indexes.map((manifest) => [manifest.contentHash, manifest]));
|
|
420
|
-
return {
|
|
421
|
-
layouts: top.indexes.map((index) => {
|
|
422
|
-
if (!isContentParts(index))
|
|
423
|
-
return manifestLayout(index);
|
|
424
|
-
const checked = checkContentLayout(index, index.parts.map((part) => partManifests.get(part.sha256)), index.contentHash);
|
|
425
|
-
if (!checked.ok)
|
|
426
|
-
throw new Error(checked.error);
|
|
427
|
-
return checked.value;
|
|
428
|
-
}),
|
|
429
|
-
local: top.local + (parts?.local ?? 0),
|
|
430
|
-
fetched: top.fetched + (parts?.fetched ?? 0),
|
|
431
|
-
wave: parts === null ? top.wave : addWaves(top.wave, parts.wave),
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
/** Download a set of immutable artifacts, fetching only machine-cache gaps.
|
|
435
|
-
* Receipts return in input order; any failure fails the whole set after
|
|
436
|
-
* letting in-flight effects settle. */
|
|
437
|
-
async function downloadAttempt(artifacts, ports, options = {}) {
|
|
438
|
-
const downloadStarted = performance.now();
|
|
439
|
-
const concurrency = options.concurrency ?? DEFAULT_TRANSFER_CONCURRENCY;
|
|
440
|
-
const storeConcurrency = options.storeConcurrency ?? DEFAULT_TRANSFER_CONCURRENCY;
|
|
441
|
-
const maxInFlightBytes = options.maxInFlightBytes
|
|
442
|
-
?? DEFAULT_TRANSFER_CONCURRENCY * CHUNK_BYTES;
|
|
443
|
-
const storeGate = createParallelGate(storeConcurrency);
|
|
444
|
-
for (const artifact of artifacts)
|
|
445
|
-
assertTransferArtifact(artifact);
|
|
446
|
-
const manifestPhaseStarted = performance.now();
|
|
447
|
-
const { layouts, local: localManifests, fetched: fetchedManifests, wave: manifestWave } = await proveManifests(artifacts, ports, concurrency, maxInFlightBytes, options.sharedBytes);
|
|
448
|
-
const manifestPhaseMs = performance.now() - manifestPhaseStarted;
|
|
449
|
-
// Ask the cache which chunks are gaps, now that every manifest is proven.
|
|
450
|
-
const gapCheckStarted = performance.now();
|
|
451
|
-
const gaps = new Array(artifacts.length);
|
|
452
|
-
await parallelForEach([...artifacts.keys()], concurrency, async (slot) => {
|
|
453
|
-
const artifact = artifacts[slot];
|
|
454
|
-
const layout = layouts[slot];
|
|
455
|
-
if (artifact === undefined || layout === undefined) {
|
|
456
|
-
throw new Error('download set lost a manifest');
|
|
457
|
-
}
|
|
458
|
-
const missing = [];
|
|
459
|
-
for (const index of layout.chunks.keys()) {
|
|
460
|
-
if (!await ports.hasChunk(artifact, layout, index))
|
|
461
|
-
missing.push(index);
|
|
462
|
-
}
|
|
463
|
-
gaps[slot] = missing;
|
|
464
|
-
});
|
|
465
|
-
const gapCheckMs = performance.now() - gapCheckStarted;
|
|
466
|
-
// Wave two: fetch every gap as one planned wave. Each artifact's gaps form
|
|
467
|
-
// one chain so chunks store in chunk order; `delivered` settles when a gap
|
|
468
|
-
// is stored, or rejects so no later chunk waits forever.
|
|
469
|
-
const blockPhaseStarted = performance.now();
|
|
470
|
-
const blockActivity = new BlockActivityClock();
|
|
471
|
-
const blockChains = [];
|
|
472
|
-
artifacts.forEach((artifact, slot) => {
|
|
473
|
-
const layout = layouts[slot];
|
|
474
|
-
const missing = gaps[slot];
|
|
475
|
-
if (layout === undefined || missing === undefined || missing.length === 0)
|
|
476
|
-
return;
|
|
477
|
-
let prior;
|
|
478
|
-
const chain = [];
|
|
479
|
-
for (const index of missing) {
|
|
480
|
-
const expected = layout.chunks[index];
|
|
481
|
-
if (expected === undefined)
|
|
482
|
-
throw new Error('download manifest named an unknown chunk index');
|
|
483
|
-
let stored;
|
|
484
|
-
let failed;
|
|
485
|
-
const delivered = new Promise((resolve, reject) => {
|
|
486
|
-
stored = resolve;
|
|
487
|
-
failed = reject;
|
|
488
|
-
});
|
|
489
|
-
// A failed unit may leave no later chunk admitted to observe the
|
|
490
|
-
// rejection; the set still fails through the unit's own throw.
|
|
491
|
-
delivered.catch(() => { });
|
|
492
|
-
const priorStored = prior;
|
|
493
|
-
chain.push({
|
|
494
|
-
object: { kind: 'block', sha256: expected.sha256 },
|
|
495
|
-
standaloneWeight: expected.bytes,
|
|
496
|
-
deliver: async (sealed) => {
|
|
497
|
-
try {
|
|
498
|
-
const plain = await blockActivity.time('transform', async () => {
|
|
499
|
-
const opened = await ports.openEnvelope({ kind: 'block', sha256: expected.sha256 }, sealed);
|
|
500
|
-
if (!(opened instanceof Uint8Array)
|
|
501
|
-
|| opened.byteLength !== expected.bytes
|
|
502
|
-
|| ports.sha256Hex(opened) !== expected.sha256) {
|
|
503
|
-
throw failure(`downloaded content chunk ${index} failed verification`, 'cargo-missing', 'chunk-hash', null, artifact.contentHash);
|
|
504
|
-
}
|
|
505
|
-
return opened;
|
|
506
|
-
});
|
|
507
|
-
if (priorStored !== undefined)
|
|
508
|
-
await priorStored;
|
|
509
|
-
await storeGate.run(() => blockActivity.time('store', () => ports.putChunk(artifact, layout, index, plain)));
|
|
510
|
-
stored();
|
|
511
|
-
}
|
|
512
|
-
catch (error) {
|
|
513
|
-
failed(error);
|
|
514
|
-
throw error;
|
|
515
|
-
}
|
|
516
|
-
},
|
|
517
|
-
fail: failed,
|
|
518
|
-
});
|
|
519
|
-
prior = delivered;
|
|
520
|
-
}
|
|
521
|
-
blockChains.push(chain);
|
|
522
|
-
});
|
|
523
|
-
const blockWave = await fetchWave({
|
|
524
|
-
requestRefs: (objects) => blockActivity.time('network', () => ports.requestRefs(objects)),
|
|
525
|
-
fetchSpan: (url, span, refresh) => blockActivity.time('network', () => ports.fetchSpan(url, span, refresh)),
|
|
526
|
-
}, blockChains, concurrency, maxInFlightBytes, options.sharedBytes, storeConcurrency);
|
|
527
|
-
const blockActivityReport = blockActivity.report();
|
|
528
|
-
const blockPhaseMs = performance.now() - blockPhaseStarted;
|
|
529
|
-
const sealPassStarted = performance.now();
|
|
530
|
-
const receipts = new Array(artifacts.length);
|
|
531
|
-
await parallelForEach([...artifacts.keys()], concurrency, async (slot) => {
|
|
532
|
-
const artifact = artifacts[slot];
|
|
533
|
-
const layout = layouts[slot];
|
|
534
|
-
const missing = gaps[slot];
|
|
535
|
-
if (artifact === undefined || layout === undefined || missing === undefined) {
|
|
536
|
-
throw new Error('download set lost a manifest');
|
|
537
|
-
}
|
|
538
|
-
const sealed = await ports.sealArtifact(artifact, layout);
|
|
539
|
-
if (sealed.bytes !== layout.bytes || sealed.contentHash !== layout.contentHash) {
|
|
540
|
-
throw failure(`downloaded artifact ${artifact.contentHash} failed verification`, 'cargo-missing', 'artifact-hash', null, artifact.contentHash);
|
|
541
|
-
}
|
|
542
|
-
receipts[slot] = {
|
|
543
|
-
artifact,
|
|
544
|
-
layout,
|
|
545
|
-
local: sealed.local,
|
|
546
|
-
downloadedChunks: missing.length,
|
|
547
|
-
reusedChunks: layout.chunks.length - missing.length,
|
|
548
|
-
};
|
|
549
|
-
});
|
|
550
|
-
const sealPassMs = performance.now() - sealPassStarted;
|
|
551
|
-
const orderedReceipts = receipts.map((receipt) => {
|
|
552
|
-
if (receipt === undefined)
|
|
553
|
-
throw new Error('download set lost an artifact receipt');
|
|
554
|
-
return receipt;
|
|
555
|
-
});
|
|
556
|
-
const downloadTotalMs = performance.now() - downloadStarted;
|
|
557
|
-
const orchestrationMs = Math.max(0, downloadTotalMs - manifestPhaseMs - gapCheckMs - blockPhaseMs - sealPassMs);
|
|
558
|
-
return {
|
|
559
|
-
receipts: orderedReceipts,
|
|
560
|
-
shape: {
|
|
561
|
-
localManifests,
|
|
562
|
-
fetchedManifests,
|
|
563
|
-
packedManifests: manifestWave.packedObjects,
|
|
564
|
-
standaloneManifests: manifestWave.standaloneObjects,
|
|
565
|
-
manifestSpans: manifestWave.rangedReads,
|
|
566
|
-
packedBlocks: blockWave.packedObjects,
|
|
567
|
-
standaloneBlocks: blockWave.standaloneObjects,
|
|
568
|
-
blockSpans: blockWave.rangedReads,
|
|
569
|
-
placementReplans: 0,
|
|
570
|
-
manifestPhaseMs: Math.round(manifestPhaseMs),
|
|
571
|
-
gapCheckMs: Math.round(gapCheckMs),
|
|
572
|
-
blockPhaseMs: Math.round(blockPhaseMs),
|
|
573
|
-
sealPassMs: Math.round(sealPassMs),
|
|
574
|
-
orchestrationMs: Math.round(orchestrationMs),
|
|
575
|
-
downloadTotalMs: Math.round(downloadTotalMs),
|
|
576
|
-
...blockActivityReport,
|
|
577
|
-
},
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
/** Download through one coherent physical plan at a time. Placement may move
|
|
581
|
-
* while content identity remains fixed, so a moved locator discards the stale
|
|
582
|
-
* plan and re-resolves the unresolved set. Verified chunks from an abandoned
|
|
583
|
-
* plan remain reusable evidence. Finite plans make persistent placement churn
|
|
584
|
-
* a loud set failure instead of an infinite retry loop. */
|
|
585
|
-
export async function downloadAll(artifacts, ports, options = {}) {
|
|
586
|
-
const started = performance.now();
|
|
587
|
-
return throughPlacementPlans(async (plan) => {
|
|
588
|
-
const result = await downloadAttempt(artifacts, ports, options);
|
|
589
|
-
const downloadTotalMs = Math.round(performance.now() - started);
|
|
590
|
-
const abandonedPlanMs = Math.max(0, downloadTotalMs - result.shape.downloadTotalMs);
|
|
591
|
-
return {
|
|
592
|
-
receipts: result.receipts,
|
|
593
|
-
shape: {
|
|
594
|
-
...result.shape,
|
|
595
|
-
placementReplans: plan,
|
|
596
|
-
orchestrationMs: result.shape.orchestrationMs + abandonedPlanMs,
|
|
597
|
-
downloadTotalMs,
|
|
598
|
-
},
|
|
599
|
-
};
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
/** Prove a set's indexes and stop there. A caller reusing content the
|
|
603
|
-
* warehouse already holds, such as a file moved into another workspace,
|
|
604
|
-
* names its index without moving a byte of its blocks or reading its parts.
|
|
605
|
-
* Placement replans as a download's does. */
|
|
606
|
-
export async function fetchManifests(artifacts, ports, options = {}) {
|
|
607
|
-
for (const artifact of artifacts)
|
|
608
|
-
assertTransferArtifact(artifact);
|
|
609
|
-
const concurrency = options.concurrency ?? DEFAULT_TRANSFER_CONCURRENCY;
|
|
610
|
-
const maxInFlightBytes = options.maxInFlightBytes ?? DEFAULT_TRANSFER_CONCURRENCY * CHUNK_BYTES;
|
|
611
|
-
return throughPlacementPlans(async () => (await proveIndexes(artifacts, ports, concurrency, maxInFlightBytes, options.sharedBytes)).indexes);
|
|
612
|
-
}
|
|
613
|
-
/** One coherent physical plan at a time, at most a finite few. */
|
|
614
|
-
async function throughPlacementPlans(attempt) {
|
|
615
|
-
for (let plan = 0; plan < MAX_DOWNLOAD_PLACEMENT_PLANS; plan += 1) {
|
|
616
|
-
try {
|
|
617
|
-
return await attempt(plan);
|
|
618
|
-
}
|
|
619
|
-
catch (error) {
|
|
620
|
-
if (!isContentPlacementChangedError(error)
|
|
621
|
-
|| plan + 1 >= MAX_DOWNLOAD_PLACEMENT_PLANS)
|
|
622
|
-
throw error;
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
throw new Error('download exhausted its finite physical plans');
|
|
626
|
-
}
|
|
627
|
-
//# sourceMappingURL=download.js.map
|
|
1
|
+
var ce=Object.defineProperty;var f=(t,e)=>ce(t,"name",{value:e,configurable:!0});import{CHUNK_BYTES as K,checkContentIndex as le,checkContentLayout as ie,checkContentManifest as de,isContentParts as z,manifestLayout as he}from"../contracts/content.js";import{isProtectionError as fe}from"../contracts/protection.js";import{failure as G}from"../faults/need.js";import{assertTransferArtifact as Q}from"./artifacts.js";import{wrongBlockFailure as ue}from"./dispute.js";import{createParallelGate as pe,DEFAULT_TRANSFER_CONCURRENCY as _,parallelForEach as D,weightedParallelForEach as we}from"./parallel.js";import{planPackSpans as me,RANGE_MERGE_GAP_BYTES as ge}from"./ranges.js";import{resolveContentRefs as ye}from"./refs.js";const V=Symbol.for("@amalgm/live/content-placement-changed"),x="content_placement_changed";class ke extends Error{static{f(this,"ContentPlacementChangedError")}code=x;constructor(e){super(`content ${e.kind} ${e.sha256} changed placement between fetch attempts`,{cause:{code:x}}),this.name="ContentPlacementChangedError",Object.defineProperty(this,V,{value:!0})}}function be(t){if(typeof t!="object"||t===null)return!1;if(Reflect.get(t,V)===!0||Reflect.get(t,"code")===x)return!0;const e=Reflect.get(t,"cause");return typeof e=="object"&&e!==null&&Reflect.get(e,"code")===x}f(be,"isContentPlacementChangedError");const Z=3;class Me{static{f(this,"BlockActivityClock")}counts=[0,0,0];totals=Array.from({length:8},()=>0);state=0;changedAt=performance.now();async time(e,o){const c=e==="network"?0:e==="transform"?1:2;this.transition(c,1);try{return await o()}finally{this.transition(c,-1)}}timeSync(e,o){const c=e==="network"?0:e==="transform"?1:2;this.transition(c,1);try{return o()}finally{this.transition(c,-1)}}report(){this.record(performance.now());const e=this.totals.map(o=>Math.round(o));return{blockNeitherMs:e[0]??0,blockNetworkOnlyMs:e[1]??0,blockTransformOnlyMs:e[2]??0,blockStoreOnlyMs:e[4]??0,blockNetworkTransformMs:e[3]??0,blockNetworkStoreMs:e[5]??0,blockTransformStoreMs:e[6]??0,blockAllActiveMs:e[7]??0}}transition(e,o){const c=performance.now();this.record(c);const p=(this.counts[e]??0)+o;if(p<0)throw new Error("download activity clock lost an operation");this.counts[e]=p,this.state=this.counts.reduce((l,u,b)=>u>0?l|1<<b:l,0)}record(e){this.totals[this.state]=(this.totals[this.state]??0)+(e-this.changedAt),this.changedAt=e}}function ee(t,e){if(t===void 0||typeof t.url!="string"||t.url.length===0)throw new Error(`content ref for ${e.kind} ${e.sha256} named no location`);if(t.offset===void 0!=(t.length===void 0))throw new Error(`content ref for ${e.kind} ${e.sha256} named half a byte range`);if(t.offset===void 0||t.length===void 0)return{url:t.url,span:null};if(!Number.isSafeInteger(t.offset)||t.offset<0||!Number.isSafeInteger(t.length)||t.length<1)throw new Error(`content ref for ${e.kind} ${e.sha256} named an invalid byte range`);return{url:t.url,span:{offset:t.offset,length:t.length}}}f(ee,"checkRefLocation");async function ne(t,e,o,c,p,l=1){const u=e.flatMap((n,a)=>{let y=n.reduce((i,d)=>i+d.standaloneWeight,0);return n.map((i,d)=>{const r=y;return y-=i.standaloneWeight,{chain:a,depth:d,key:r,item:i}})}).sort((n,a)=>a.key-n.key||n.chain-a.chain||n.depth-a.depth);if(u.length===0)return{rangedReads:0,packedObjects:0,standaloneObjects:0};const b=await ye(t,u.map(({item:n})=>n.object)),M=e.map(()=>[]);u.forEach(({chain:n,item:a},y)=>{const i=M[n];if(i===void 0)throw new Error("download wave lost a chain");i.push({item:a,order:y,...ee(b[y],a.object)})});const E=new Map,h=[];for(const n of M){const a=n[0];if(a===void 0)continue;if(!n.every((d,r)=>{if(d.span===null||d.url!==a.url)return!1;const g=n[r-1];return g?.span==null||d.span.offset>=g.span.offset})){for(const d of n)h.push(d);continue}const i=E.get(a.url);if(i===void 0)E.set(a.url,[...n]);else for(const d of n)i.push(d)}const s=[];let w=0,P=0;for(const n of E.values()){w+=n.length,n.sort((r,g)=>(r.span?.offset??0)-(g.span?.offset??0)||r.order-g.order);const a=n.map(r=>{if(r.span===null)throw new Error("download wave grouped a standalone object");return r.span}),y=me(a,ge,c),i=y.spans.map(()=>[]);n.forEach((r,g)=>{const C=y.memberSpan[g],R=C===void 0?void 0:i[C];if(R===void 0)throw new Error("download wave lost a span member");R.push(r)});const d=n.reduce((r,g)=>Math.min(r,g.order),Number.MAX_SAFE_INTEGER);y.spans.forEach((r,g)=>{const C=i[g],R=C?.[0];if(C===void 0||R===void 0)throw new Error("download wave planned an empty span");s.push({url:R.url,span:r,members:C.map(O=>{if(O.span===null)throw new Error("download wave grouped a standalone object");return{item:O.item,offset:O.span.offset-r.offset,length:O.span.length}}),refresh:R,weight:Math.min(r.length,c),primary:d,secondary:g,ranged:!0})})}for(const n of h)n.span!==null?(w+=1,s.push({url:n.url,span:n.span,members:[{item:n.item,offset:0,length:n.span.length}],refresh:n,weight:Math.min(n.span.length,c),primary:n.order,secondary:0,ranged:!0})):(P+=1,s.push({url:n.url,span:null,members:[{item:n.item,offset:0,length:null}],refresh:n,weight:Math.max(1,Math.min(n.item.standaloneWeight,c)),primary:n.order,secondary:0,ranged:!1}));s.sort((n,a)=>n.primary-a.primary||n.secondary-a.secondary);const N=f(async n=>{const a=new Set;try{const y=f(async()=>{const[d]=await t.requestRefs([n.refresh.item.object]),r=ee(d,n.refresh.item.object),g=n.refresh.span;if(r.span===null!=(g===null)||r.span!==null&&g!==null&&(r.span.offset!==g.offset||r.span.length!==g.length))throw new ke(n.refresh.item.object);return r.url},"refresh"),i=await t.fetchSpan(n.url,n.span,y);if(!(i instanceof Uint8Array))throw new Error("storage fetch answered no bytes");if(n.span!==null&&i.byteLength!==n.span.length)throw new Error("storage fetch answered the wrong byte count");await D(n.members,l,async d=>{a.add(d.item);const r=d.length===null?i:i.subarray(d.offset,d.offset+d.length);if(d.length!==null&&r.byteLength!==d.length)throw new Error("storage span cannot cover a planned member");await d.item.deliver(r)})}catch(y){for(const i of n.members)a.has(i.item)||i.item.fail(y);throw y}},"fetchUnit");return await we(s,o,c,n=>n.weight,n=>p===void 0?N(n):p.run(n.weight,()=>N(n))),{rangedReads:s.reduce((n,a)=>n+(a.ranged?1:0),0),packedObjects:w,standaloneObjects:P}}f(ne,"fetchWave");const Ee=f((t,e)=>({rangedReads:t.rangedReads+e.rangedReads,packedObjects:t.packedObjects+e.packedObjects,standaloneObjects:t.standaloneObjects+e.standaloneObjects}),"addWaves"),ve=f(async(t,e,o)=>{const c=await t.openEnvelope(e,o);try{return JSON.parse(new TextDecoder().decode(c))}catch{throw G(`downloaded manifest for ${e.sha256} is not valid JSON`,"cargo-missing","manifest-unreadable",null,e.sha256)}},"openManifest");async function te(t,e,o,c,p,l,u){const b=new Array(t.length);let M=0;const E=[];t.forEach((s,w)=>{const P=e.localManifest(s);if(P!=null){const n=o(P,s);if(!n.ok)throw new Error(n.error);b[w]=n.value,M+=1;return}const N={kind:"manifest",sha256:s.contentHash};E.push([{object:N,standaloneWeight:1,deliver:f(async n=>{const a=o(await ve(e,N,n),s);if(!a.ok)throw G(a.error,"cargo-missing","manifest-invalid",null,s.contentHash);b[w]=a.value,await c(s,a.value)},"deliver"),fail:f(()=>{},"fail")}])});const h=await ne(e,E,p,l,u);return{indexes:b.map(s=>{if(s===void 0)throw new Error("download set lost a manifest");return s}),local:M,fetched:E.length,wave:h}}f(te,"proveWave");async function oe(t,e,o,c,p){return te(t,e,(l,u)=>le(l,u.contentHash),(l,u)=>e.manifestProven(l,u),o,c,p)}f(oe,"proveIndexes");async function Ce(t,e,o,c,p){const l=await oe(t,e,o,c,p),u=new Map;l.indexes.forEach((h,s)=>{if(z(h))for(const w of h.parts)u.has(w.sha256)||u.set(w.sha256,{artifact:{...t[s],contentHash:w.sha256},bytes:w.bytes})});const b=[...u.values()],M=b.length===0?null:await te(b.map(h=>h.artifact),e,(h,s)=>{const w=de(h,s.contentHash);return w.ok&&w.value.bytes!==u.get(s.contentHash)?.bytes?{ok:!1,error:`content part ${s.contentHash} manifest length is invalid`}:w},(h,s)=>e.manifestProven(h,s),o,c,p),E=new Map(M?.indexes.map(h=>[h.contentHash,h]));return{layouts:l.indexes.map(h=>{if(!z(h))return he(h);const s=ie(h,h.parts.map(w=>E.get(w.sha256)),h.contentHash);if(!s.ok)throw new Error(s.error);return s.value}),local:l.local+(M?.local??0),fetched:l.fetched+(M?.fetched??0),wave:M===null?l.wave:Ee(l.wave,M.wave)}}f(Ce,"proveManifests");async function Ae(t,e,o={}){const c=performance.now(),p=o.concurrency??_,l=o.storeConcurrency??_,u=o.maxInFlightBytes??_*K,b=pe(l);for(const m of t)Q(m);const M=performance.now(),{layouts:E,local:h,fetched:s,wave:w}=await Ce(t,e,p,u,o.sharedBytes),P=performance.now()-M,N=performance.now(),n=new Array(t.length);await D([...t.keys()],p,async m=>{const v=t[m],k=E[m];if(v===void 0||k===void 0)throw new Error("download set lost a manifest");const A=[];for(const S of k.chunks.keys())await e.hasChunk(v,k,S)||A.push(S);n[m]=A});const a=performance.now()-N,y=performance.now(),i=new Me,d=[];t.forEach((m,v)=>{const k=E[v],A=n[v];if(k===void 0||A===void 0||A.length===0)return;let S;const F=[];for(const L of A){const T=k.chunks[L];if(T===void 0)throw new Error("download manifest named an unknown chunk index");let I,$;const q=new Promise((W,H)=>{I=W,$=H});q.catch(()=>{});const Y=S;F.push({object:{kind:"block",sha256:T.sha256},standaloneWeight:T.bytes,deliver:f(async W=>{try{const H=await i.time("transform",async()=>{const J=f(()=>ue(`downloaded content chunk ${L} failed verification`,{sha256:T.sha256,contentHash:m.contentHash}),"wrong");let j;try{j=await e.openEnvelope({kind:"block",sha256:T.sha256},W)}catch(X){throw fe(X)?J():X}if(!(j instanceof Uint8Array)||j.byteLength!==T.bytes||e.sha256Hex(j)!==T.sha256)throw J();return j});Y!==void 0&&await Y,await b.run(()=>i.time("store",()=>e.putChunk(m,k,L,H))),I()}catch(H){throw $(H),H}},"deliver"),fail:$}),S=q}d.push(F)});const r=await ne({requestRefs:f(m=>i.time("network",()=>e.requestRefs(m)),"requestRefs"),fetchSpan:f((m,v,k)=>i.time("network",()=>e.fetchSpan(m,v,k)),"fetchSpan")},d,p,u,o.sharedBytes,l),g=i.report(),C=performance.now()-y,R=performance.now(),O=new Array(t.length);await D([...t.keys()],p,async m=>{const v=t[m],k=E[m],A=n[m];if(v===void 0||k===void 0||A===void 0)throw new Error("download set lost a manifest");const S=await e.sealArtifact(v,k);if(S.bytes!==k.bytes||S.contentHash!==k.contentHash)throw G(`downloaded artifact ${v.contentHash} failed verification`,"cargo-missing","artifact-hash",null,v.contentHash);O[m]={artifact:v,layout:k,local:S.local,downloadedChunks:A.length,reusedChunks:k.chunks.length-A.length}});const B=performance.now()-R,se=O.map(m=>{if(m===void 0)throw new Error("download set lost an artifact receipt");return m}),U=performance.now()-c,re=Math.max(0,U-P-a-C-B);return{receipts:se,shape:{localManifests:h,fetchedManifests:s,packedManifests:w.packedObjects,standaloneManifests:w.standaloneObjects,manifestSpans:w.rangedReads,packedBlocks:r.packedObjects,standaloneBlocks:r.standaloneObjects,blockSpans:r.rangedReads,placementReplans:0,manifestPhaseMs:Math.round(P),gapCheckMs:Math.round(a),blockPhaseMs:Math.round(C),sealPassMs:Math.round(B),orchestrationMs:Math.round(re),downloadTotalMs:Math.round(U),...g}}}f(Ae,"downloadAttempt");async function xe(t,e,o={}){const c=performance.now();return ae(async p=>{const l=await Ae(t,e,o),u=Math.round(performance.now()-c),b=Math.max(0,u-l.shape.downloadTotalMs);return{receipts:l.receipts,shape:{...l.shape,placementReplans:p,orchestrationMs:l.shape.orchestrationMs+b,downloadTotalMs:u}}})}f(xe,"downloadAll");async function Le(t,e,o={}){for(const l of t)Q(l);const c=o.concurrency??_,p=o.maxInFlightBytes??_*K;return ae(async()=>(await oe(t,e,c,p,o.sharedBytes)).indexes)}f(Le,"fetchManifests");async function ae(t){for(let e=0;e<Z;e+=1)try{return await t(e)}catch(o){if(!be(o)||e+1>=Z)throw o}throw new Error("download exhausted its finite physical plans")}f(ae,"throughPlacementPlans");export{ke as ContentPlacementChangedError,xe as downloadAll,Le as fetchManifests,be as isContentPlacementChangedError};
|
package/dist/transfer/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/** Type-aware immutable content transfer operations. */
|
|
2
1
|
export * from './artifacts.js';
|
|
3
2
|
export * from './cargo.js';
|
|
4
|
-
export * from './cargo-
|
|
3
|
+
export * from './cargo-pack.js';
|
|
5
4
|
export * from './upload.js';
|
|
6
5
|
export * from './download.js';
|
|
6
|
+
export * from './dispute.js';
|
|
7
7
|
export * from './refs.js';
|
|
8
8
|
export * from './ranges.js';
|
|
9
9
|
export { createParallelGate, createWeightedGate, parallelForEach, type ParallelGate, type WeightedGate, } from './parallel.js';
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|