@amalgm/live 0.2.81-preview.45708334404 → 0.2.81-preview.46146788616
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apply/contracts.d.ts +17 -348
- package/dist/apply/contracts.js +1 -108
- package/dist/apply/fetch-ahead.d.ts +0 -45
- package/dist/apply/fetch-ahead.js +1 -169
- package/dist/apply/index.d.ts +0 -2
- package/dist/apply/index.js +1 -10
- package/dist/apply/journey.d.ts +0 -35
- package/dist/apply/journey.js +1 -403
- package/dist/apply/lane.d.ts +0 -34
- package/dist/apply/lane.js +1 -72
- package/dist/apply/line.d.ts +0 -28
- package/dist/apply/line.js +1 -81
- package/dist/apply/plans.d.ts +0 -14
- package/dist/apply/plans.js +1 -182
- package/dist/apply/rail.d.ts +0 -60
- package/dist/apply/rail.js +1 -776
- package/dist/apply/selection.d.ts +0 -15
- package/dist/apply/selection.js +1 -111
- package/dist/apply/settling.d.ts +0 -57
- package/dist/apply/settling.js +1 -63
- package/dist/apply/showing.d.ts +1 -95
- package/dist/apply/showing.js +1 -203
- package/dist/apply/type-adapters.d.ts +0 -8
- package/dist/apply/type-adapters.js +1 -39
- package/dist/apply/window.d.ts +0 -109
- package/dist/apply/window.js +1 -323
- package/dist/clash/bodmas.d.ts +1 -51
- package/dist/clash/bodmas.js +1 -130
- package/dist/clash/echo.d.ts +0 -27
- package/dist/clash/echo.js +1 -35
- package/dist/clash/index.d.ts +0 -1
- package/dist/clash/index.js +1 -6
- package/dist/clash/local-work.d.ts +0 -36
- package/dist/clash/local-work.js +1 -51
- package/dist/clash/resolution.d.ts +0 -13
- package/dist/clash/resolution.js +1 -15
- package/dist/clash/tetris.d.ts +0 -18
- package/dist/clash/tetris.js +1 -26
- package/dist/{sharing/command-input.d.ts → commands/input.d.ts} +5 -9
- package/dist/commands/input.js +1 -0
- package/dist/commands/mcp.d.ts +23 -0
- package/dist/commands/mcp.js +1 -0
- package/dist/contracts/content.d.ts +0 -78
- package/dist/contracts/content.js +1 -251
- package/dist/contracts/index.d.ts +0 -6
- package/dist/contracts/index.js +1 -9
- package/dist/contracts/protection.d.ts +16 -22
- package/dist/contracts/protection.js +1 -53
- package/dist/contracts/validate.d.ts +0 -18
- package/dist/contracts/validate.js +1 -23
- package/dist/detection/adapter-contract.d.ts +0 -75
- package/dist/detection/adapter-contract.js +1 -130
- package/dist/detection/batch.d.ts +1 -14
- package/dist/detection/batch.js +1 -75
- package/dist/detection/classify.d.ts +6 -40
- package/dist/detection/classify.js +1 -45
- package/dist/detection/content.d.ts +0 -17
- package/dist/detection/content.js +1 -76
- package/dist/detection/dispositions.d.ts +3 -82
- package/dist/detection/dispositions.js +0 -20
- package/dist/detection/echo.d.ts +0 -20
- package/dist/detection/echo.js +1 -33
- package/dist/detection/identity.d.ts +0 -56
- package/dist/detection/identity.js +1 -229
- package/dist/detection/ignore-lines.d.ts +0 -15
- package/dist/detection/ignore-lines.js +2 -212
- package/dist/detection/index.d.ts +0 -31
- package/dist/detection/index.js +1 -48
- package/dist/detection/package-proposal.d.ts +0 -24
- package/dist/detection/package-proposal.js +1 -114
- package/dist/detection/record-order.d.ts +5 -19
- package/dist/detection/record-order.js +1 -311
- package/dist/detection/record-proposal.d.ts +0 -98
- package/dist/detection/record-proposal.js +1 -384
- package/dist/detection/refusal.d.ts +0 -69
- package/dist/detection/refusal.js +1 -78
- package/dist/detection/removals.d.ts +0 -8
- package/dist/detection/removals.js +1 -51
- package/dist/detection/scoped-identity.d.ts +1 -61
- package/dist/detection/scoped-identity.js +1 -189
- package/dist/detection/skip-defaults.d.ts +0 -16
- package/dist/detection/skip-defaults.js +3 -20
- package/dist/detection/skip-policy.d.ts +0 -58
- package/dist/detection/skip-policy.js +1 -203
- package/dist/detection/watch-boundary.d.ts +0 -16
- package/dist/detection/watch-boundary.js +1 -47
- package/dist/drive/contracts.d.ts +0 -182
- package/dist/drive/contracts.js +1 -30
- package/dist/drive/drive.d.ts +0 -147
- package/dist/drive/drive.js +1 -414
- package/dist/drive/held-removals.d.ts +0 -49
- package/dist/drive/held-removals.js +1 -136
- package/dist/drive/index.d.ts +0 -7
- package/dist/drive/index.js +1 -16
- package/dist/drive/kept.d.ts +0 -10
- package/dist/drive/kept.js +1 -33
- package/dist/drive/listing.d.ts +2 -13
- package/dist/drive/listing.js +1 -84
- package/dist/drive/map-index.d.ts +0 -59
- package/dist/drive/map-index.js +1 -240
- package/dist/drive/placements.d.ts +0 -71
- package/dist/drive/placements.js +1 -164
- package/dist/drive/records.d.ts +0 -43
- package/dist/drive/records.js +1 -85
- package/dist/drive/where.d.ts +7 -94
- package/dist/drive/where.js +2 -378
- package/dist/entities/accepted-view.d.ts +0 -47
- package/dist/entities/accepted-view.js +1 -260
- package/dist/entities/bytes.d.ts +0 -16
- package/dist/entities/bytes.js +1 -112
- package/dist/entities/cloud.d.ts +0 -125
- package/dist/entities/cloud.js +1 -430
- package/dist/entities/graph-head.d.ts +0 -32
- package/dist/entities/graph-head.js +1 -114
- package/dist/entities/graph-pages.d.ts +0 -75
- package/dist/entities/graph-pages.js +1 -239
- package/dist/entities/index.d.ts +0 -28
- package/dist/entities/index.js +1 -40
- package/dist/entities/package-pages.d.ts +0 -28
- package/dist/entities/package-pages.js +1 -91
- package/dist/entities/placement-owed.d.ts +0 -27
- package/dist/entities/placement-owed.js +1 -86
- package/dist/entities/reducer.d.ts +0 -30
- package/dist/entities/reducer.js +1 -130
- package/dist/entities/registry-graph.d.ts +0 -80
- package/dist/entities/registry-graph.js +1 -478
- package/dist/entities/rules.d.ts +7 -72
- package/dist/entities/rules.js +1 -230
- package/dist/entities/types.d.ts +0 -71
- package/dist/entities/types.js +1 -55
- package/dist/entities/units.d.ts +0 -25
- package/dist/entities/units.js +1 -27
- package/dist/faults/classify.d.ts +0 -24
- package/dist/faults/classify.js +1 -77
- package/dist/faults/index.d.ts +0 -8
- package/dist/faults/index.js +1 -13
- package/dist/faults/need.d.ts +0 -24
- package/dist/faults/need.js +1 -76
- package/dist/faults/recover.d.ts +0 -18
- package/dist/faults/recover.js +1 -44
- package/dist/faults/report.d.ts +0 -23
- package/dist/faults/report.js +1 -130
- package/dist/faults/scrub.d.ts +0 -27
- package/dist/faults/scrub.js +3 -159
- package/dist/faults/wire.d.ts +0 -13
- package/dist/faults/wire.js +1 -42
- package/dist/files/accepted-files.d.ts +0 -37
- package/dist/files/accepted-files.js +1 -129
- package/dist/files/api.d.ts +0 -1
- package/dist/files/api.js +1 -83
- package/dist/files/browse-types.d.ts +7 -7
- package/dist/files/browse-types.js +1 -46
- package/dist/files/browser.d.ts +4 -2
- package/dist/files/browser.js +1 -100
- package/dist/files/cloud-files.d.ts +6 -5
- package/dist/files/cloud-files.js +1 -153
- package/dist/files/commands.d.ts +0 -54
- package/dist/files/commands.js +1 -140
- package/dist/files/computer-address.d.ts +0 -10
- package/dist/files/computer-address.js +1 -48
- package/dist/files/index.d.ts +1 -3
- package/dist/files/index.js +1 -18
- package/dist/files/local-files.d.ts +0 -2
- package/dist/files/local-files.js +1 -104
- package/dist/files/media-type.d.ts +0 -1
- package/dist/files/media-type.js +1 -50
- package/dist/files/own-folders.d.ts +0 -29
- package/dist/files/own-folders.js +1 -50
- package/dist/files/plans.d.ts +1 -16
- package/dist/files/plans.js +1 -36
- package/dist/files/trash.d.ts +0 -97
- package/dist/files/trash.js +1 -287
- package/dist/files/usage-categories.d.ts +0 -13
- package/dist/files/usage-categories.js +1 -33
- package/dist/files/usage-chain.d.ts +0 -27
- package/dist/files/usage-chain.js +1 -44
- package/dist/files/usage-effect.d.ts +0 -34
- package/dist/files/usage-effect.js +1 -29
- package/dist/files/usage.d.ts +3 -47
- package/dist/files/usage.js +1 -132
- package/dist/git/alternates.d.ts +0 -21
- package/dist/git/alternates.js +1 -79
- package/dist/git/artifact.d.ts +0 -69
- package/dist/git/artifact.js +1 -190
- package/dist/git/chain.d.ts +0 -32
- package/dist/git/chain.js +1 -55
- package/dist/git/holds.d.ts +30 -0
- package/dist/git/holds.js +1 -0
- package/dist/git/index.d.ts +4 -2
- package/dist/git/index.js +1 -11
- package/dist/git/parts.d.ts +10 -0
- package/dist/git/parts.js +7 -0
- package/dist/git/places.d.ts +6 -0
- package/dist/git/places.js +1 -0
- package/dist/git/plan.d.ts +0 -40
- package/dist/git/plan.js +1 -97
- package/dist/git/play.d.ts +11 -72
- package/dist/git/play.js +4 -318
- package/dist/git/refs.d.ts +0 -18
- package/dist/git/refs.js +8 -63
- package/dist/git/restore.d.ts +8 -0
- package/dist/git/restore.js +2 -0
- package/dist/git/state.d.ts +0 -103
- package/dist/git/state.js +3 -209
- package/dist/git/tag.d.ts +5 -51
- package/dist/git/tag.js +3 -68
- package/dist/git/text.d.ts +0 -3
- package/dist/git/text.js +1 -4
- package/dist/git/turns.d.ts +0 -104
- package/dist/git/turns.js +1 -153
- package/dist/history/history.d.ts +2 -14
- package/dist/history/history.js +1 -51
- package/dist/history/identity.d.ts +11 -0
- package/dist/history/identity.js +1 -0
- package/dist/history/index.d.ts +6 -9
- package/dist/history/index.js +1 -10
- package/dist/history/rule.d.ts +3 -38
- package/dist/history/rule.js +1 -78
- package/dist/history/runs.d.ts +17 -0
- package/dist/history/runs.js +1 -0
- package/dist/history/types.d.ts +6 -64
- package/dist/history/types.js +0 -9
- package/dist/history/version.d.ts +2 -8
- package/dist/history/version.js +1 -32
- package/dist/index.d.ts +0 -15
- package/dist/index.js +1 -32
- package/dist/records/authority.d.ts +0 -7
- package/dist/records/authority.js +1 -28
- package/dist/records/codec.d.ts +0 -2
- package/dist/records/codec.js +1 -43
- package/dist/records/contracts.d.ts +0 -20
- package/dist/records/contracts.js +1 -190
- package/dist/records/inbox.d.ts +0 -3
- package/dist/records/inbox.js +1 -40
- package/dist/records/index.d.ts +0 -2
- package/dist/records/index.js +1 -18
- package/dist/records/intentional.d.ts +0 -24
- package/dist/records/intentional.js +1 -58
- package/dist/records/outbox.d.ts +0 -10
- package/dist/records/outbox.js +1 -46
- package/dist/records/owned-effects.d.ts +0 -8
- package/dist/records/owned-effects.js +1 -37
- package/dist/records/publication.d.ts +1 -67
- package/dist/records/publication.js +1 -583
- package/dist/records/rail-ports.d.ts +2 -81
- package/dist/records/rail-ports.js +0 -3
- package/dist/records/rail.d.ts +1 -42
- package/dist/records/rail.js +1 -195
- package/dist/records/receive-channel.d.ts +0 -42
- package/dist/records/receive-channel.js +1 -131
- package/dist/records/receive-loop.d.ts +0 -48
- package/dist/records/receive-loop.js +1 -278
- package/dist/records/receive-pages.d.ts +0 -23
- package/dist/records/receive-pages.js +1 -98
- package/dist/records/retry-clock.d.ts +0 -3
- package/dist/records/retry-clock.js +1 -35
- package/dist/records/send-batch.d.ts +0 -45
- package/dist/records/send-batch.js +1 -119
- package/dist/records/send-freeing.d.ts +4 -42
- package/dist/records/send-freeing.js +1 -124
- package/dist/records/send-line.d.ts +1 -82
- package/dist/records/send-line.js +1 -411
- package/dist/records/send-preparation.d.ts +0 -39
- package/dist/records/send-preparation.js +1 -226
- package/dist/records/submit-frame.d.ts +0 -28
- package/dist/records/submit-frame.js +1 -161
- package/dist/records/unsent-count.d.ts +0 -24
- package/dist/records/unsent-count.js +1 -91
- package/dist/records/wire.d.ts +0 -10
- package/dist/records/wire.js +1 -121
- package/dist/registration/home-layout.d.ts +0 -18
- package/dist/registration/home-layout.js +1 -34
- package/dist/registration/index.d.ts +0 -3
- package/dist/registration/index.js +1 -5
- package/dist/registration/user-ground.d.ts +0 -165
- package/dist/registration/user-ground.js +1 -399
- package/dist/sharing/access.d.ts +0 -8
- package/dist/sharing/access.js +1 -51
- package/dist/sharing/cli.d.ts +0 -7
- package/dist/sharing/cli.js +8 -88
- package/dist/sharing/commands.d.ts +3 -16
- package/dist/sharing/commands.js +1 -164
- package/dist/sharing/construct.d.ts +0 -10
- package/dist/sharing/construct.js +1 -47
- package/dist/sharing/download.d.ts +0 -12
- package/dist/sharing/download.js +1 -45
- package/dist/sharing/entity.d.ts +0 -11
- package/dist/sharing/entity.js +1 -53
- package/dist/sharing/errors.d.ts +0 -2
- package/dist/sharing/errors.js +1 -11
- package/dist/sharing/grants.d.ts +0 -15
- package/dist/sharing/grants.js +1 -103
- package/dist/sharing/index.d.ts +3 -9
- package/dist/sharing/index.js +1 -16
- package/dist/sharing/mcp.d.ts +2 -25
- package/dist/sharing/mcp.js +1 -31
- package/dist/sharing/permissions.d.ts +0 -8
- package/dist/sharing/permissions.js +1 -45
- package/dist/sharing/publish.d.ts +0 -8
- package/dist/sharing/publish.js +1 -42
- package/dist/sharing/share.d.ts +0 -10
- package/dist/sharing/share.js +1 -31
- package/dist/sharing/sharing.d.ts +0 -5
- package/dist/sharing/sharing.js +1 -22
- package/dist/sharing/types.d.ts +0 -47
- package/dist/sharing/types.js +1 -15
- package/dist/steps.d.ts +0 -18
- package/dist/steps.js +1 -58
- package/dist/transfer/artifacts.d.ts +0 -19
- package/dist/transfer/artifacts.js +1 -89
- package/dist/transfer/batches.d.ts +0 -11
- package/dist/transfer/batches.js +1 -40
- package/dist/transfer/cargo-pack.d.ts +39 -0
- package/dist/transfer/cargo-pack.js +1 -0
- package/dist/transfer/cargo.d.ts +0 -39
- package/dist/transfer/cargo.js +1 -130
- package/dist/transfer/dispute.d.ts +9 -0
- package/dist/transfer/dispute.js +1 -0
- package/dist/transfer/download.d.ts +0 -97
- package/dist/transfer/download.js +1 -627
- package/dist/transfer/index.d.ts +2 -3
- package/dist/transfer/index.js +1 -10
- package/dist/transfer/parallel.d.ts +0 -19
- package/dist/transfer/parallel.js +1 -136
- package/dist/transfer/ranges.d.ts +0 -22
- package/dist/transfer/ranges.js +1 -59
- package/dist/transfer/refs.d.ts +0 -22
- package/dist/transfer/refs.js +1 -41
- package/dist/transfer/upload.d.ts +0 -49
- package/dist/transfer/upload.js +1 -248
- package/dist/versions/admit.d.ts +8 -0
- package/dist/versions/admit.js +1 -0
- package/dist/versions/api.d.ts +3 -0
- package/dist/versions/api.js +1 -0
- package/dist/versions/cli-text.d.ts +3 -0
- package/dist/versions/cli-text.js +5 -0
- package/dist/versions/cli.d.ts +12 -0
- package/dist/versions/cli.js +19 -0
- package/dist/versions/commands.d.ts +31 -0
- package/dist/versions/commands.js +1 -0
- package/dist/versions/content.d.ts +4 -0
- package/dist/versions/content.js +1 -0
- package/dist/versions/dates.d.ts +15 -0
- package/dist/versions/dates.js +1 -0
- package/dist/versions/deliver.d.ts +25 -0
- package/dist/versions/deliver.js +2 -0
- package/dist/versions/errors.d.ts +10 -0
- package/dist/versions/errors.js +1 -0
- package/dist/versions/index.d.ts +18 -0
- package/dist/versions/index.js +1 -0
- package/dist/versions/line.d.ts +8 -0
- package/dist/versions/line.js +1 -0
- package/dist/versions/list.d.ts +5 -0
- package/dist/versions/list.js +1 -0
- package/dist/versions/mcp.d.ts +3 -0
- package/dist/versions/mcp.js +1 -0
- package/dist/versions/ports.d.ts +46 -0
- package/dist/versions/ports.js +0 -0
- package/dist/versions/read.d.ts +12 -0
- package/dist/versions/read.js +1 -0
- package/dist/versions/restore.d.ts +5 -0
- package/dist/versions/restore.js +1 -0
- package/dist/versions/services.d.ts +4 -0
- package/dist/versions/services.js +1 -0
- package/dist/versions/show.d.ts +5 -0
- package/dist/versions/show.js +1 -0
- package/dist/versions/types.d.ts +64 -0
- package/dist/versions/types.js +0 -0
- package/dist/versions/versions.d.ts +10 -0
- package/dist/versions/versions.js +1 -0
- package/dist/watching/coverage.d.ts +0 -23
- package/dist/watching/coverage.js +1 -44
- package/dist/watching/index.d.ts +0 -6
- package/dist/watching/index.js +1 -9
- package/dist/watching/maintenance.d.ts +0 -66
- package/dist/watching/maintenance.js +1 -204
- package/dist/watching/suspicion.d.ts +0 -59
- package/dist/watching/suspicion.js +1 -513
- package/dist/workspace/api.d.ts +0 -1
- package/dist/workspace/api.js +1 -108
- package/dist/workspace/entries.d.ts +0 -3
- package/dist/workspace/entries.js +1 -77
- package/dist/workspace/identity.d.ts +0 -2
- package/dist/workspace/identity.js +1 -27
- package/dist/workspace/index.d.ts +0 -1
- package/dist/workspace/index.js +1 -5
- package/dist/workspace/registry.d.ts +0 -12
- package/dist/workspace/registry.js +1 -255
- package/dist/workspace/types.d.ts +0 -19
- package/dist/workspace/types.js +0 -2
- package/dist-cjs/apply/contracts.js +1 -115
- package/dist-cjs/apply/fetch-ahead.js +1 -174
- package/dist-cjs/apply/index.js +1 -26
- package/dist-cjs/apply/journey.js +1 -408
- package/dist-cjs/apply/lane.js +1 -76
- package/dist-cjs/apply/line.js +1 -91
- package/dist-cjs/apply/plans.js +1 -185
- package/dist-cjs/apply/rail.js +1 -780
- package/dist-cjs/apply/selection.js +1 -117
- package/dist-cjs/apply/settling.js +1 -67
- package/dist-cjs/apply/showing.js +1 -211
- package/dist-cjs/apply/type-adapters.js +1 -43
- package/dist-cjs/apply/window.js +1 -331
- package/dist-cjs/clash/bodmas.js +1 -133
- package/dist-cjs/clash/echo.js +1 -38
- package/dist-cjs/clash/index.js +1 -22
- package/dist-cjs/clash/local-work.js +1 -57
- package/dist-cjs/clash/resolution.js +1 -19
- package/dist-cjs/clash/tetris.js +1 -29
- package/dist-cjs/commands/input.js +1 -0
- package/dist-cjs/commands/mcp.js +1 -0
- package/dist-cjs/contracts/content.js +1 -267
- package/dist-cjs/contracts/index.js +1 -25
- package/dist-cjs/contracts/protection.js +1 -58
- package/dist-cjs/contracts/validate.js +1 -31
- package/dist-cjs/detection/adapter-contract.js +1 -135
- package/dist-cjs/detection/batch.js +1 -78
- package/dist-cjs/detection/classify.js +1 -52
- package/dist-cjs/detection/content.js +1 -82
- package/dist-cjs/detection/dispositions.js +1 -21
- package/dist-cjs/detection/echo.js +1 -36
- package/dist-cjs/detection/identity.js +1 -239
- package/dist-cjs/detection/ignore-lines.js +2 -216
- package/dist-cjs/detection/index.js +1 -64
- package/dist-cjs/detection/package-proposal.js +1 -120
- package/dist-cjs/detection/record-order.js +1 -314
- package/dist-cjs/detection/record-proposal.js +1 -398
- package/dist-cjs/detection/refusal.js +1 -88
- package/dist-cjs/detection/removals.js +1 -54
- package/dist-cjs/detection/scoped-identity.js +1 -192
- package/dist-cjs/detection/skip-defaults.js +2 -22
- package/dist-cjs/detection/skip-policy.js +1 -208
- package/dist-cjs/detection/watch-boundary.js +1 -51
- package/dist-cjs/drive/contracts.js +1 -34
- package/dist-cjs/drive/drive.js +1 -418
- package/dist-cjs/drive/held-removals.js +1 -140
- package/dist-cjs/drive/index.js +1 -32
- package/dist-cjs/drive/kept.js +1 -36
- package/dist-cjs/drive/listing.js +1 -87
- package/dist-cjs/drive/map-index.js +1 -245
- package/dist-cjs/drive/placements.js +1 -168
- package/dist-cjs/drive/records.js +1 -93
- package/dist-cjs/drive/where.js +2 -394
- package/dist-cjs/entities/accepted-view.js +1 -264
- package/dist-cjs/entities/bytes.js +1 -124
- package/dist-cjs/entities/cloud.js +1 -451
- package/dist-cjs/entities/graph-head.js +1 -121
- package/dist-cjs/entities/graph-pages.js +1 -257
- package/dist-cjs/entities/index.js +1 -56
- package/dist-cjs/entities/package-pages.js +1 -99
- package/dist-cjs/entities/placement-owed.js +1 -91
- package/dist-cjs/entities/reducer.js +1 -136
- package/dist-cjs/entities/registry-graph.js +1 -483
- package/dist-cjs/entities/rules.js +1 -251
- package/dist-cjs/entities/types.js +1 -61
- package/dist-cjs/entities/units.js +1 -30
- package/dist-cjs/faults/classify.js +1 -83
- package/dist-cjs/faults/index.js +1 -32
- package/dist-cjs/faults/need.js +1 -84
- package/dist-cjs/faults/recover.js +1 -49
- package/dist-cjs/faults/report.js +1 -135
- package/dist-cjs/faults/scrub.js +3 -169
- package/dist-cjs/faults/wire.js +1 -47
- package/dist-cjs/files/accepted-files.js +1 -135
- package/dist-cjs/files/api.js +1 -85
- package/dist-cjs/files/browse-types.js +1 -54
- package/dist-cjs/files/browser.js +1 -104
- package/dist-cjs/files/cloud-files.js +1 -159
- package/dist-cjs/files/commands.js +1 -145
- package/dist-cjs/files/computer-address.js +1 -52
- package/dist-cjs/files/index.js +1 -65
- package/dist-cjs/files/local-files.js +1 -108
- package/dist-cjs/files/media-type.js +1 -53
- package/dist-cjs/files/own-folders.js +1 -53
- package/dist-cjs/files/plans.js +1 -40
- package/dist-cjs/files/trash.js +1 -299
- package/dist-cjs/files/usage-categories.js +1 -37
- package/dist-cjs/files/usage-chain.js +1 -49
- package/dist-cjs/files/usage-effect.js +1 -34
- package/dist-cjs/files/usage.js +1 -140
- package/dist-cjs/git/alternates.js +1 -84
- package/dist-cjs/git/artifact.js +1 -202
- package/dist-cjs/git/chain.js +1 -59
- package/dist-cjs/git/holds.js +1 -0
- package/dist-cjs/git/index.js +1 -29
- package/dist-cjs/git/parts.js +7 -0
- package/dist-cjs/git/places.js +1 -0
- package/dist-cjs/git/plan.js +1 -100
- package/dist-cjs/git/play.js +4 -323
- package/dist-cjs/git/refs.js +8 -72
- package/dist-cjs/git/restore.js +2 -0
- package/dist-cjs/git/state.js +3 -230
- package/dist-cjs/git/tag.js +3 -72
- package/dist-cjs/git/text.js +1 -8
- package/dist-cjs/git/turns.js +1 -162
- package/dist-cjs/history/history.js +1 -53
- package/dist-cjs/history/identity.js +1 -0
- package/dist-cjs/history/index.js +1 -21
- package/dist-cjs/history/rule.js +1 -83
- package/dist-cjs/history/runs.js +1 -0
- package/dist-cjs/history/types.js +1 -10
- package/dist-cjs/history/version.js +1 -36
- package/dist-cjs/index.js +1 -48
- package/dist-cjs/records/authority.js +1 -31
- package/dist-cjs/records/codec.js +1 -49
- package/dist-cjs/records/contracts.js +1 -196
- package/dist-cjs/records/inbox.js +1 -43
- package/dist-cjs/records/index.js +1 -47
- package/dist-cjs/records/intentional.js +1 -61
- package/dist-cjs/records/outbox.js +1 -50
- package/dist-cjs/records/owned-effects.js +1 -41
- package/dist-cjs/records/publication.js +1 -593
- package/dist-cjs/records/rail-ports.js +1 -4
- package/dist-cjs/records/rail.js +1 -199
- package/dist-cjs/records/receive-channel.js +1 -136
- package/dist-cjs/records/receive-loop.js +1 -282
- package/dist-cjs/records/receive-pages.js +1 -103
- package/dist-cjs/records/retry-clock.js +1 -39
- package/dist-cjs/records/send-batch.js +1 -126
- package/dist-cjs/records/send-freeing.js +1 -128
- package/dist-cjs/records/send-line.js +1 -415
- package/dist-cjs/records/send-preparation.js +1 -230
- package/dist-cjs/records/submit-frame.js +1 -167
- package/dist-cjs/records/unsent-count.js +1 -95
- package/dist-cjs/records/wire.js +1 -127
- package/dist-cjs/registration/home-layout.js +1 -38
- package/dist-cjs/registration/index.js +1 -21
- package/dist-cjs/registration/user-ground.js +1 -407
- package/dist-cjs/sharing/access.js +1 -56
- package/dist-cjs/sharing/cli.js +8 -93
- package/dist-cjs/sharing/commands.js +1 -169
- package/dist-cjs/sharing/construct.js +1 -53
- package/dist-cjs/sharing/download.js +1 -48
- package/dist-cjs/sharing/entity.js +1 -59
- package/dist-cjs/sharing/errors.js +1 -14
- package/dist-cjs/sharing/grants.js +1 -108
- package/dist-cjs/sharing/index.js +1 -36
- package/dist-cjs/sharing/mcp.js +1 -33
- package/dist-cjs/sharing/permissions.js +1 -47
- package/dist-cjs/sharing/publish.js +1 -45
- package/dist-cjs/sharing/share.js +1 -36
- package/dist-cjs/sharing/sharing.js +1 -24
- package/dist-cjs/sharing/types.js +1 -19
- package/dist-cjs/steps.js +1 -64
- package/dist-cjs/transfer/artifacts.js +1 -95
- package/dist-cjs/transfer/batches.js +1 -44
- package/dist-cjs/transfer/cargo-pack.js +1 -0
- package/dist-cjs/transfer/cargo.js +1 -135
- package/dist-cjs/transfer/dispute.js +1 -0
- package/dist-cjs/transfer/download.js +1 -634
- package/dist-cjs/transfer/index.js +1 -30
- package/dist-cjs/transfer/parallel.js +1 -143
- package/dist-cjs/transfer/ranges.js +1 -63
- package/dist-cjs/transfer/refs.js +1 -45
- package/dist-cjs/transfer/upload.js +1 -256
- package/dist-cjs/versions/admit.js +1 -0
- package/dist-cjs/versions/api.js +1 -0
- package/dist-cjs/versions/cli-text.js +5 -0
- package/dist-cjs/versions/cli.js +19 -0
- package/dist-cjs/versions/commands.js +1 -0
- package/dist-cjs/versions/content.js +1 -0
- package/dist-cjs/versions/dates.js +1 -0
- package/dist-cjs/versions/deliver.js +2 -0
- package/dist-cjs/versions/errors.js +1 -0
- package/dist-cjs/versions/index.js +1 -0
- package/dist-cjs/versions/line.js +1 -0
- package/dist-cjs/versions/list.js +1 -0
- package/dist-cjs/versions/mcp.js +1 -0
- package/dist-cjs/versions/ports.js +1 -0
- package/dist-cjs/versions/read.js +1 -0
- package/dist-cjs/versions/restore.js +1 -0
- package/dist-cjs/versions/services.js +1 -0
- package/dist-cjs/versions/show.js +1 -0
- package/dist-cjs/versions/types.js +1 -0
- package/dist-cjs/versions/versions.js +1 -0
- package/dist-cjs/watching/coverage.js +1 -48
- package/dist-cjs/watching/index.js +1 -25
- package/dist-cjs/watching/maintenance.js +1 -208
- package/dist-cjs/watching/suspicion.js +1 -517
- package/dist-cjs/workspace/api.js +1 -110
- package/dist-cjs/workspace/entries.js +1 -82
- package/dist-cjs/workspace/identity.js +1 -32
- package/dist-cjs/workspace/index.js +1 -15
- package/dist-cjs/workspace/registry.js +1 -259
- package/dist-cjs/workspace/types.js +1 -3
- package/package.json +22 -7
- package/PURPOSE.md +0 -697
- package/dist/apply/contracts.d.ts.map +0 -1
- package/dist/apply/contracts.js.map +0 -1
- package/dist/apply/fetch-ahead.d.ts.map +0 -1
- package/dist/apply/fetch-ahead.js.map +0 -1
- package/dist/apply/index.d.ts.map +0 -1
- package/dist/apply/index.js.map +0 -1
- package/dist/apply/journey.d.ts.map +0 -1
- package/dist/apply/journey.js.map +0 -1
- package/dist/apply/lane.d.ts.map +0 -1
- package/dist/apply/lane.js.map +0 -1
- package/dist/apply/line.d.ts.map +0 -1
- package/dist/apply/line.js.map +0 -1
- package/dist/apply/plans.d.ts.map +0 -1
- package/dist/apply/plans.js.map +0 -1
- package/dist/apply/rail.d.ts.map +0 -1
- package/dist/apply/rail.js.map +0 -1
- package/dist/apply/selection.d.ts.map +0 -1
- package/dist/apply/selection.js.map +0 -1
- package/dist/apply/settling.d.ts.map +0 -1
- package/dist/apply/settling.js.map +0 -1
- package/dist/apply/showing.d.ts.map +0 -1
- package/dist/apply/showing.js.map +0 -1
- package/dist/apply/type-adapters.d.ts.map +0 -1
- package/dist/apply/type-adapters.js.map +0 -1
- package/dist/apply/window.d.ts.map +0 -1
- package/dist/apply/window.js.map +0 -1
- package/dist/clash/bodmas.d.ts.map +0 -1
- package/dist/clash/bodmas.js.map +0 -1
- package/dist/clash/echo.d.ts.map +0 -1
- package/dist/clash/echo.js.map +0 -1
- package/dist/clash/index.d.ts.map +0 -1
- package/dist/clash/index.js.map +0 -1
- package/dist/clash/local-work.d.ts.map +0 -1
- package/dist/clash/local-work.js.map +0 -1
- package/dist/clash/resolution.d.ts.map +0 -1
- package/dist/clash/resolution.js.map +0 -1
- package/dist/clash/tetris.d.ts.map +0 -1
- package/dist/clash/tetris.js.map +0 -1
- package/dist/contracts/content.d.ts.map +0 -1
- package/dist/contracts/content.js.map +0 -1
- package/dist/contracts/index.d.ts.map +0 -1
- package/dist/contracts/index.js.map +0 -1
- package/dist/contracts/protection.d.ts.map +0 -1
- package/dist/contracts/protection.js.map +0 -1
- package/dist/contracts/validate.d.ts.map +0 -1
- package/dist/contracts/validate.js.map +0 -1
- package/dist/detection/adapter-contract.d.ts.map +0 -1
- package/dist/detection/adapter-contract.js.map +0 -1
- package/dist/detection/batch.d.ts.map +0 -1
- package/dist/detection/batch.js.map +0 -1
- package/dist/detection/classify.d.ts.map +0 -1
- package/dist/detection/classify.js.map +0 -1
- package/dist/detection/content.d.ts.map +0 -1
- package/dist/detection/content.js.map +0 -1
- package/dist/detection/dispositions.d.ts.map +0 -1
- package/dist/detection/dispositions.js.map +0 -1
- package/dist/detection/echo.d.ts.map +0 -1
- package/dist/detection/echo.js.map +0 -1
- package/dist/detection/identity.d.ts.map +0 -1
- package/dist/detection/identity.js.map +0 -1
- package/dist/detection/ignore-lines.d.ts.map +0 -1
- package/dist/detection/ignore-lines.js.map +0 -1
- package/dist/detection/index.d.ts.map +0 -1
- package/dist/detection/index.js.map +0 -1
- package/dist/detection/package-proposal.d.ts.map +0 -1
- package/dist/detection/package-proposal.js.map +0 -1
- package/dist/detection/record-order.d.ts.map +0 -1
- package/dist/detection/record-order.js.map +0 -1
- package/dist/detection/record-proposal.d.ts.map +0 -1
- package/dist/detection/record-proposal.js.map +0 -1
- package/dist/detection/refusal.d.ts.map +0 -1
- package/dist/detection/refusal.js.map +0 -1
- package/dist/detection/removals.d.ts.map +0 -1
- package/dist/detection/removals.js.map +0 -1
- package/dist/detection/scoped-identity.d.ts.map +0 -1
- package/dist/detection/scoped-identity.js.map +0 -1
- package/dist/detection/skip-defaults.d.ts.map +0 -1
- package/dist/detection/skip-defaults.js.map +0 -1
- package/dist/detection/skip-policy.d.ts.map +0 -1
- package/dist/detection/skip-policy.js.map +0 -1
- package/dist/detection/watch-boundary.d.ts.map +0 -1
- package/dist/detection/watch-boundary.js.map +0 -1
- package/dist/drive/contracts.d.ts.map +0 -1
- package/dist/drive/contracts.js.map +0 -1
- package/dist/drive/drive.d.ts.map +0 -1
- package/dist/drive/drive.js.map +0 -1
- package/dist/drive/held-removals.d.ts.map +0 -1
- package/dist/drive/held-removals.js.map +0 -1
- package/dist/drive/index.d.ts.map +0 -1
- package/dist/drive/index.js.map +0 -1
- package/dist/drive/kept.d.ts.map +0 -1
- package/dist/drive/kept.js.map +0 -1
- package/dist/drive/listing.d.ts.map +0 -1
- package/dist/drive/listing.js.map +0 -1
- package/dist/drive/map-index.d.ts.map +0 -1
- package/dist/drive/map-index.js.map +0 -1
- package/dist/drive/placements.d.ts.map +0 -1
- package/dist/drive/placements.js.map +0 -1
- package/dist/drive/records.d.ts.map +0 -1
- package/dist/drive/records.js.map +0 -1
- package/dist/drive/where.d.ts.map +0 -1
- package/dist/drive/where.js.map +0 -1
- package/dist/entities/accepted-view.d.ts.map +0 -1
- package/dist/entities/accepted-view.js.map +0 -1
- package/dist/entities/bytes.d.ts.map +0 -1
- package/dist/entities/bytes.js.map +0 -1
- package/dist/entities/cloud.d.ts.map +0 -1
- package/dist/entities/cloud.js.map +0 -1
- package/dist/entities/graph-head.d.ts.map +0 -1
- package/dist/entities/graph-head.js.map +0 -1
- package/dist/entities/graph-pages.d.ts.map +0 -1
- package/dist/entities/graph-pages.js.map +0 -1
- package/dist/entities/index.d.ts.map +0 -1
- package/dist/entities/index.js.map +0 -1
- package/dist/entities/package-pages.d.ts.map +0 -1
- package/dist/entities/package-pages.js.map +0 -1
- package/dist/entities/placement-owed.d.ts.map +0 -1
- package/dist/entities/placement-owed.js.map +0 -1
- package/dist/entities/reducer.d.ts.map +0 -1
- package/dist/entities/reducer.js.map +0 -1
- package/dist/entities/registry-graph.d.ts.map +0 -1
- package/dist/entities/registry-graph.js.map +0 -1
- package/dist/entities/rules.d.ts.map +0 -1
- package/dist/entities/rules.js.map +0 -1
- package/dist/entities/types.d.ts.map +0 -1
- package/dist/entities/types.js.map +0 -1
- package/dist/entities/units.d.ts.map +0 -1
- package/dist/entities/units.js.map +0 -1
- package/dist/faults/classify.d.ts.map +0 -1
- package/dist/faults/classify.js.map +0 -1
- package/dist/faults/index.d.ts.map +0 -1
- package/dist/faults/index.js.map +0 -1
- package/dist/faults/need.d.ts.map +0 -1
- package/dist/faults/need.js.map +0 -1
- package/dist/faults/recover.d.ts.map +0 -1
- package/dist/faults/recover.js.map +0 -1
- package/dist/faults/report.d.ts.map +0 -1
- package/dist/faults/report.js.map +0 -1
- package/dist/faults/scrub.d.ts.map +0 -1
- package/dist/faults/scrub.js.map +0 -1
- package/dist/faults/wire.d.ts.map +0 -1
- package/dist/faults/wire.js.map +0 -1
- package/dist/files/accepted-files.d.ts.map +0 -1
- package/dist/files/accepted-files.js.map +0 -1
- package/dist/files/api.d.ts.map +0 -1
- package/dist/files/api.js.map +0 -1
- package/dist/files/browse-types.d.ts.map +0 -1
- package/dist/files/browse-types.js.map +0 -1
- package/dist/files/browser.d.ts.map +0 -1
- package/dist/files/browser.js.map +0 -1
- package/dist/files/cloud-files.d.ts.map +0 -1
- package/dist/files/cloud-files.js.map +0 -1
- package/dist/files/commands.d.ts.map +0 -1
- package/dist/files/commands.js.map +0 -1
- package/dist/files/computer-address.d.ts.map +0 -1
- package/dist/files/computer-address.js.map +0 -1
- package/dist/files/index.d.ts.map +0 -1
- package/dist/files/index.js.map +0 -1
- package/dist/files/local-files.d.ts.map +0 -1
- package/dist/files/local-files.js.map +0 -1
- package/dist/files/media-type.d.ts.map +0 -1
- package/dist/files/media-type.js.map +0 -1
- package/dist/files/own-folders.d.ts.map +0 -1
- package/dist/files/own-folders.js.map +0 -1
- package/dist/files/plans.d.ts.map +0 -1
- package/dist/files/plans.js.map +0 -1
- package/dist/files/trash.d.ts.map +0 -1
- package/dist/files/trash.js.map +0 -1
- package/dist/files/usage-categories.d.ts.map +0 -1
- package/dist/files/usage-categories.js.map +0 -1
- package/dist/files/usage-chain.d.ts.map +0 -1
- package/dist/files/usage-chain.js.map +0 -1
- package/dist/files/usage-effect.d.ts.map +0 -1
- package/dist/files/usage-effect.js.map +0 -1
- package/dist/files/usage.d.ts.map +0 -1
- package/dist/files/usage.js.map +0 -1
- package/dist/git/alternates.d.ts.map +0 -1
- package/dist/git/alternates.js.map +0 -1
- package/dist/git/artifact.d.ts.map +0 -1
- package/dist/git/artifact.js.map +0 -1
- package/dist/git/chain.d.ts.map +0 -1
- package/dist/git/chain.js.map +0 -1
- package/dist/git/commands.d.ts +0 -3
- package/dist/git/commands.d.ts.map +0 -1
- package/dist/git/commands.js +0 -35
- package/dist/git/commands.js.map +0 -1
- package/dist/git/index.d.ts.map +0 -1
- package/dist/git/index.js.map +0 -1
- package/dist/git/plan.d.ts.map +0 -1
- package/dist/git/plan.js.map +0 -1
- package/dist/git/play.d.ts.map +0 -1
- package/dist/git/play.js.map +0 -1
- package/dist/git/refs.d.ts.map +0 -1
- package/dist/git/refs.js.map +0 -1
- package/dist/git/state.d.ts.map +0 -1
- package/dist/git/state.js.map +0 -1
- package/dist/git/tag.d.ts.map +0 -1
- package/dist/git/tag.js.map +0 -1
- package/dist/git/text.d.ts.map +0 -1
- package/dist/git/text.js.map +0 -1
- package/dist/git/turns.d.ts.map +0 -1
- package/dist/git/turns.js.map +0 -1
- package/dist/history/history.d.ts.map +0 -1
- package/dist/history/history.js.map +0 -1
- package/dist/history/index.d.ts.map +0 -1
- package/dist/history/index.js.map +0 -1
- package/dist/history/rule.d.ts.map +0 -1
- package/dist/history/rule.js.map +0 -1
- package/dist/history/types.d.ts.map +0 -1
- package/dist/history/types.js.map +0 -1
- package/dist/history/version.d.ts.map +0 -1
- package/dist/history/version.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/records/authority.d.ts.map +0 -1
- package/dist/records/authority.js.map +0 -1
- package/dist/records/codec.d.ts.map +0 -1
- package/dist/records/codec.js.map +0 -1
- package/dist/records/contracts.d.ts.map +0 -1
- package/dist/records/contracts.js.map +0 -1
- package/dist/records/inbox.d.ts.map +0 -1
- package/dist/records/inbox.js.map +0 -1
- package/dist/records/index.d.ts.map +0 -1
- package/dist/records/index.js.map +0 -1
- package/dist/records/intentional.d.ts.map +0 -1
- package/dist/records/intentional.js.map +0 -1
- package/dist/records/outbox.d.ts.map +0 -1
- package/dist/records/outbox.js.map +0 -1
- package/dist/records/owned-effects.d.ts.map +0 -1
- package/dist/records/owned-effects.js.map +0 -1
- package/dist/records/publication.d.ts.map +0 -1
- package/dist/records/publication.js.map +0 -1
- package/dist/records/rail-ports.d.ts.map +0 -1
- package/dist/records/rail-ports.js.map +0 -1
- package/dist/records/rail.d.ts.map +0 -1
- package/dist/records/rail.js.map +0 -1
- package/dist/records/receive-channel.d.ts.map +0 -1
- package/dist/records/receive-channel.js.map +0 -1
- package/dist/records/receive-loop.d.ts.map +0 -1
- package/dist/records/receive-loop.js.map +0 -1
- package/dist/records/receive-pages.d.ts.map +0 -1
- package/dist/records/receive-pages.js.map +0 -1
- package/dist/records/retry-clock.d.ts.map +0 -1
- package/dist/records/retry-clock.js.map +0 -1
- package/dist/records/send-batch.d.ts.map +0 -1
- package/dist/records/send-batch.js.map +0 -1
- package/dist/records/send-freeing.d.ts.map +0 -1
- package/dist/records/send-freeing.js.map +0 -1
- package/dist/records/send-line.d.ts.map +0 -1
- package/dist/records/send-line.js.map +0 -1
- package/dist/records/send-preparation.d.ts.map +0 -1
- package/dist/records/send-preparation.js.map +0 -1
- package/dist/records/submit-frame.d.ts.map +0 -1
- package/dist/records/submit-frame.js.map +0 -1
- package/dist/records/unsent-count.d.ts.map +0 -1
- package/dist/records/unsent-count.js.map +0 -1
- package/dist/records/wire.d.ts.map +0 -1
- package/dist/records/wire.js.map +0 -1
- package/dist/registration/home-layout.d.ts.map +0 -1
- package/dist/registration/home-layout.js.map +0 -1
- package/dist/registration/index.d.ts.map +0 -1
- package/dist/registration/index.js.map +0 -1
- package/dist/registration/user-ground.d.ts.map +0 -1
- package/dist/registration/user-ground.js.map +0 -1
- package/dist/sharing/access.d.ts.map +0 -1
- package/dist/sharing/access.js.map +0 -1
- package/dist/sharing/cli.d.ts.map +0 -1
- package/dist/sharing/cli.js.map +0 -1
- package/dist/sharing/command-input.d.ts.map +0 -1
- package/dist/sharing/command-input.js +0 -63
- package/dist/sharing/command-input.js.map +0 -1
- package/dist/sharing/commands.d.ts.map +0 -1
- package/dist/sharing/commands.js.map +0 -1
- package/dist/sharing/construct.d.ts.map +0 -1
- package/dist/sharing/construct.js.map +0 -1
- package/dist/sharing/download.d.ts.map +0 -1
- package/dist/sharing/download.js.map +0 -1
- package/dist/sharing/entity.d.ts.map +0 -1
- package/dist/sharing/entity.js.map +0 -1
- package/dist/sharing/errors.d.ts.map +0 -1
- package/dist/sharing/errors.js.map +0 -1
- package/dist/sharing/grants.d.ts.map +0 -1
- package/dist/sharing/grants.js.map +0 -1
- package/dist/sharing/index.d.ts.map +0 -1
- package/dist/sharing/index.js.map +0 -1
- package/dist/sharing/mcp.d.ts.map +0 -1
- package/dist/sharing/mcp.js.map +0 -1
- package/dist/sharing/permissions.d.ts.map +0 -1
- package/dist/sharing/permissions.js.map +0 -1
- package/dist/sharing/publish.d.ts.map +0 -1
- package/dist/sharing/publish.js.map +0 -1
- package/dist/sharing/share.d.ts.map +0 -1
- package/dist/sharing/share.js.map +0 -1
- package/dist/sharing/sharing.d.ts.map +0 -1
- package/dist/sharing/sharing.js.map +0 -1
- package/dist/sharing/types.d.ts.map +0 -1
- package/dist/sharing/types.js.map +0 -1
- package/dist/steps.d.ts.map +0 -1
- package/dist/steps.js.map +0 -1
- package/dist/transfer/artifacts.d.ts.map +0 -1
- package/dist/transfer/artifacts.js.map +0 -1
- package/dist/transfer/batches.d.ts.map +0 -1
- package/dist/transfer/batches.js.map +0 -1
- package/dist/transfer/cargo-frame.d.ts +0 -42
- package/dist/transfer/cargo-frame.d.ts.map +0 -1
- package/dist/transfer/cargo-frame.js +0 -98
- package/dist/transfer/cargo-frame.js.map +0 -1
- package/dist/transfer/cargo.d.ts.map +0 -1
- package/dist/transfer/cargo.js.map +0 -1
- package/dist/transfer/download.d.ts.map +0 -1
- package/dist/transfer/download.js.map +0 -1
- package/dist/transfer/index.d.ts.map +0 -1
- package/dist/transfer/index.js.map +0 -1
- package/dist/transfer/parallel.d.ts.map +0 -1
- package/dist/transfer/parallel.js.map +0 -1
- package/dist/transfer/ranges.d.ts.map +0 -1
- package/dist/transfer/ranges.js.map +0 -1
- package/dist/transfer/refs.d.ts.map +0 -1
- package/dist/transfer/refs.js.map +0 -1
- package/dist/transfer/upload.d.ts.map +0 -1
- package/dist/transfer/upload.js.map +0 -1
- package/dist/watching/coverage.d.ts.map +0 -1
- package/dist/watching/coverage.js.map +0 -1
- package/dist/watching/index.d.ts.map +0 -1
- package/dist/watching/index.js.map +0 -1
- package/dist/watching/maintenance.d.ts.map +0 -1
- package/dist/watching/maintenance.js.map +0 -1
- package/dist/watching/suspicion.d.ts.map +0 -1
- package/dist/watching/suspicion.js.map +0 -1
- package/dist/workspace/api.d.ts.map +0 -1
- package/dist/workspace/api.js.map +0 -1
- package/dist/workspace/entries.d.ts.map +0 -1
- package/dist/workspace/entries.js.map +0 -1
- package/dist/workspace/identity.d.ts.map +0 -1
- package/dist/workspace/identity.js.map +0 -1
- package/dist/workspace/index.d.ts.map +0 -1
- package/dist/workspace/index.js.map +0 -1
- package/dist/workspace/registry.d.ts.map +0 -1
- package/dist/workspace/registry.js.map +0 -1
- package/dist/workspace/types.d.ts.map +0 -1
- package/dist/workspace/types.js.map +0 -1
- package/dist-cjs/apply/contracts.js.map +0 -1
- package/dist-cjs/apply/fetch-ahead.js.map +0 -1
- package/dist-cjs/apply/index.js.map +0 -1
- package/dist-cjs/apply/journey.js.map +0 -1
- package/dist-cjs/apply/lane.js.map +0 -1
- package/dist-cjs/apply/line.js.map +0 -1
- package/dist-cjs/apply/plans.js.map +0 -1
- package/dist-cjs/apply/rail.js.map +0 -1
- package/dist-cjs/apply/selection.js.map +0 -1
- package/dist-cjs/apply/settling.js.map +0 -1
- package/dist-cjs/apply/showing.js.map +0 -1
- package/dist-cjs/apply/type-adapters.js.map +0 -1
- package/dist-cjs/apply/window.js.map +0 -1
- package/dist-cjs/clash/bodmas.js.map +0 -1
- package/dist-cjs/clash/echo.js.map +0 -1
- package/dist-cjs/clash/index.js.map +0 -1
- package/dist-cjs/clash/local-work.js.map +0 -1
- package/dist-cjs/clash/resolution.js.map +0 -1
- package/dist-cjs/clash/tetris.js.map +0 -1
- package/dist-cjs/contracts/content.js.map +0 -1
- package/dist-cjs/contracts/index.js.map +0 -1
- package/dist-cjs/contracts/protection.js.map +0 -1
- package/dist-cjs/contracts/validate.js.map +0 -1
- package/dist-cjs/detection/adapter-contract.js.map +0 -1
- package/dist-cjs/detection/batch.js.map +0 -1
- package/dist-cjs/detection/classify.js.map +0 -1
- package/dist-cjs/detection/content.js.map +0 -1
- package/dist-cjs/detection/dispositions.js.map +0 -1
- package/dist-cjs/detection/echo.js.map +0 -1
- package/dist-cjs/detection/identity.js.map +0 -1
- package/dist-cjs/detection/ignore-lines.js.map +0 -1
- package/dist-cjs/detection/index.js.map +0 -1
- package/dist-cjs/detection/package-proposal.js.map +0 -1
- package/dist-cjs/detection/record-order.js.map +0 -1
- package/dist-cjs/detection/record-proposal.js.map +0 -1
- package/dist-cjs/detection/refusal.js.map +0 -1
- package/dist-cjs/detection/removals.js.map +0 -1
- package/dist-cjs/detection/scoped-identity.js.map +0 -1
- package/dist-cjs/detection/skip-defaults.js.map +0 -1
- package/dist-cjs/detection/skip-policy.js.map +0 -1
- package/dist-cjs/detection/watch-boundary.js.map +0 -1
- package/dist-cjs/drive/contracts.js.map +0 -1
- package/dist-cjs/drive/drive.js.map +0 -1
- package/dist-cjs/drive/held-removals.js.map +0 -1
- package/dist-cjs/drive/index.js.map +0 -1
- package/dist-cjs/drive/kept.js.map +0 -1
- package/dist-cjs/drive/listing.js.map +0 -1
- package/dist-cjs/drive/map-index.js.map +0 -1
- package/dist-cjs/drive/placements.js.map +0 -1
- package/dist-cjs/drive/records.js.map +0 -1
- package/dist-cjs/drive/where.js.map +0 -1
- package/dist-cjs/entities/accepted-view.js.map +0 -1
- package/dist-cjs/entities/bytes.js.map +0 -1
- package/dist-cjs/entities/cloud.js.map +0 -1
- package/dist-cjs/entities/graph-head.js.map +0 -1
- package/dist-cjs/entities/graph-pages.js.map +0 -1
- package/dist-cjs/entities/index.js.map +0 -1
- package/dist-cjs/entities/package-pages.js.map +0 -1
- package/dist-cjs/entities/placement-owed.js.map +0 -1
- package/dist-cjs/entities/reducer.js.map +0 -1
- package/dist-cjs/entities/registry-graph.js.map +0 -1
- package/dist-cjs/entities/rules.js.map +0 -1
- package/dist-cjs/entities/types.js.map +0 -1
- package/dist-cjs/entities/units.js.map +0 -1
- package/dist-cjs/faults/classify.js.map +0 -1
- package/dist-cjs/faults/index.js.map +0 -1
- package/dist-cjs/faults/need.js.map +0 -1
- package/dist-cjs/faults/recover.js.map +0 -1
- package/dist-cjs/faults/report.js.map +0 -1
- package/dist-cjs/faults/scrub.js.map +0 -1
- package/dist-cjs/faults/wire.js.map +0 -1
- package/dist-cjs/files/accepted-files.js.map +0 -1
- package/dist-cjs/files/api.js.map +0 -1
- package/dist-cjs/files/browse-types.js.map +0 -1
- package/dist-cjs/files/browser.js.map +0 -1
- package/dist-cjs/files/cloud-files.js.map +0 -1
- package/dist-cjs/files/commands.js.map +0 -1
- package/dist-cjs/files/computer-address.js.map +0 -1
- package/dist-cjs/files/index.js.map +0 -1
- package/dist-cjs/files/local-files.js.map +0 -1
- package/dist-cjs/files/media-type.js.map +0 -1
- package/dist-cjs/files/own-folders.js.map +0 -1
- package/dist-cjs/files/plans.js.map +0 -1
- package/dist-cjs/files/trash.js.map +0 -1
- package/dist-cjs/files/usage-categories.js.map +0 -1
- package/dist-cjs/files/usage-chain.js.map +0 -1
- package/dist-cjs/files/usage-effect.js.map +0 -1
- package/dist-cjs/files/usage.js.map +0 -1
- package/dist-cjs/git/alternates.js.map +0 -1
- package/dist-cjs/git/artifact.js.map +0 -1
- package/dist-cjs/git/chain.js.map +0 -1
- package/dist-cjs/git/commands.js +0 -39
- package/dist-cjs/git/commands.js.map +0 -1
- package/dist-cjs/git/index.js.map +0 -1
- package/dist-cjs/git/plan.js.map +0 -1
- package/dist-cjs/git/play.js.map +0 -1
- package/dist-cjs/git/refs.js.map +0 -1
- package/dist-cjs/git/state.js.map +0 -1
- package/dist-cjs/git/tag.js.map +0 -1
- package/dist-cjs/git/text.js.map +0 -1
- package/dist-cjs/git/turns.js.map +0 -1
- package/dist-cjs/history/history.js.map +0 -1
- package/dist-cjs/history/index.js.map +0 -1
- package/dist-cjs/history/rule.js.map +0 -1
- package/dist-cjs/history/types.js.map +0 -1
- package/dist-cjs/history/version.js.map +0 -1
- package/dist-cjs/index.js.map +0 -1
- package/dist-cjs/records/authority.js.map +0 -1
- package/dist-cjs/records/codec.js.map +0 -1
- package/dist-cjs/records/contracts.js.map +0 -1
- package/dist-cjs/records/inbox.js.map +0 -1
- package/dist-cjs/records/index.js.map +0 -1
- package/dist-cjs/records/intentional.js.map +0 -1
- package/dist-cjs/records/outbox.js.map +0 -1
- package/dist-cjs/records/owned-effects.js.map +0 -1
- package/dist-cjs/records/publication.js.map +0 -1
- package/dist-cjs/records/rail-ports.js.map +0 -1
- package/dist-cjs/records/rail.js.map +0 -1
- package/dist-cjs/records/receive-channel.js.map +0 -1
- package/dist-cjs/records/receive-loop.js.map +0 -1
- package/dist-cjs/records/receive-pages.js.map +0 -1
- package/dist-cjs/records/retry-clock.js.map +0 -1
- package/dist-cjs/records/send-batch.js.map +0 -1
- package/dist-cjs/records/send-freeing.js.map +0 -1
- package/dist-cjs/records/send-line.js.map +0 -1
- package/dist-cjs/records/send-preparation.js.map +0 -1
- package/dist-cjs/records/submit-frame.js.map +0 -1
- package/dist-cjs/records/unsent-count.js.map +0 -1
- package/dist-cjs/records/wire.js.map +0 -1
- package/dist-cjs/registration/home-layout.js.map +0 -1
- package/dist-cjs/registration/index.js.map +0 -1
- package/dist-cjs/registration/user-ground.js.map +0 -1
- package/dist-cjs/sharing/access.js.map +0 -1
- package/dist-cjs/sharing/cli.js.map +0 -1
- package/dist-cjs/sharing/command-input.js +0 -69
- package/dist-cjs/sharing/command-input.js.map +0 -1
- package/dist-cjs/sharing/commands.js.map +0 -1
- package/dist-cjs/sharing/construct.js.map +0 -1
- package/dist-cjs/sharing/download.js.map +0 -1
- package/dist-cjs/sharing/entity.js.map +0 -1
- package/dist-cjs/sharing/errors.js.map +0 -1
- package/dist-cjs/sharing/grants.js.map +0 -1
- package/dist-cjs/sharing/index.js.map +0 -1
- package/dist-cjs/sharing/mcp.js.map +0 -1
- package/dist-cjs/sharing/permissions.js.map +0 -1
- package/dist-cjs/sharing/publish.js.map +0 -1
- package/dist-cjs/sharing/share.js.map +0 -1
- package/dist-cjs/sharing/sharing.js.map +0 -1
- package/dist-cjs/sharing/types.js.map +0 -1
- package/dist-cjs/steps.js.map +0 -1
- package/dist-cjs/transfer/artifacts.js.map +0 -1
- package/dist-cjs/transfer/batches.js.map +0 -1
- package/dist-cjs/transfer/cargo-frame.js +0 -104
- package/dist-cjs/transfer/cargo-frame.js.map +0 -1
- package/dist-cjs/transfer/cargo.js.map +0 -1
- package/dist-cjs/transfer/download.js.map +0 -1
- package/dist-cjs/transfer/index.js.map +0 -1
- package/dist-cjs/transfer/parallel.js.map +0 -1
- package/dist-cjs/transfer/ranges.js.map +0 -1
- package/dist-cjs/transfer/refs.js.map +0 -1
- package/dist-cjs/transfer/upload.js.map +0 -1
- package/dist-cjs/watching/coverage.js.map +0 -1
- package/dist-cjs/watching/index.js.map +0 -1
- package/dist-cjs/watching/maintenance.js.map +0 -1
- package/dist-cjs/watching/suspicion.js.map +0 -1
- package/dist-cjs/workspace/api.js.map +0 -1
- package/dist-cjs/workspace/entries.js.map +0 -1
- package/dist-cjs/workspace/identity.js.map +0 -1
- package/dist-cjs/workspace/index.js.map +0 -1
- package/dist-cjs/workspace/registry.js.map +0 -1
- package/dist-cjs/workspace/types.js.map +0 -1
package/dist/transfer/upload.js
CHANGED
|
@@ -1,248 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Upload one already-captured immutable artifact.
|
|
3
|
-
*
|
|
4
|
-
* The source is seekable so the operation can first derive its manifest and
|
|
5
|
-
* then reread only the chunks the authority reports missing. The manifest is
|
|
6
|
-
* committed last; until then a partial upload is invisible.
|
|
7
|
-
*
|
|
8
|
-
* Content past one manifest uploads as its parts: one question names the
|
|
9
|
-
* parts the authority has not sealed, each of those uploads exactly as
|
|
10
|
-
* content of its own bytes would, and the list seals last, so a resumed
|
|
11
|
-
* upload sends no part the authority already holds.
|
|
12
|
-
*/
|
|
13
|
-
import { assertContentBytes, checkContentLayout, CONTENT_PART_BYTES, contentLayoutFrom, isContentParts, MAX_CONTENT_BLOCK_BYTES, chunkSizes, manifestFromChunks, partSizes, } from '../contracts/content.js';
|
|
14
|
-
import { GRAPH_PAGE_BYTES } from '../entities/graph-pages.js';
|
|
15
|
-
import { assertTransferArtifact } from './artifacts.js';
|
|
16
|
-
import { planChunkBatches } from './batches.js';
|
|
17
|
-
import { DEFAULT_TRANSFER_CONCURRENCY, parallelForEach } from './parallel.js';
|
|
18
|
-
/** The seekable source no longer carries the captured artifact's exact bytes.
|
|
19
|
-
* The bytes named by the content head cannot be produced from this source, so
|
|
20
|
-
* the artifact must be recaptured from current ground — never resent as-is.
|
|
21
|
-
* Hosts classify by `code` so the signal survives serialization boundaries. */
|
|
22
|
-
export class UploadSourceMismatchError extends Error {
|
|
23
|
-
code = 'UPLOAD_SOURCE_MISMATCH';
|
|
24
|
-
}
|
|
25
|
-
const planChunks = (sizes) => {
|
|
26
|
-
let offset = 0;
|
|
27
|
-
return sizes.map((size, index) => {
|
|
28
|
-
const chunk = { index, offset, bytes: size };
|
|
29
|
-
offset += size;
|
|
30
|
-
return chunk;
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
const fixedSizes = (totalBytes, partBytes) => {
|
|
34
|
-
assertContentBytes(totalBytes);
|
|
35
|
-
const sizes = [];
|
|
36
|
-
for (let remaining = totalBytes; remaining > 0; remaining -= partBytes) {
|
|
37
|
-
sizes.push(Math.min(remaining, partBytes));
|
|
38
|
-
}
|
|
39
|
-
return sizes;
|
|
40
|
-
};
|
|
41
|
-
/** Entity type selects semantic transfer framing. Files and construct
|
|
42
|
-
* payloads use reusable Syncthing-style blocks. A link target is one literal
|
|
43
|
-
* value. A Git artifact already carries its own native incremental pack,
|
|
44
|
-
* so the outer wire only segments it at the maximum frame size instead of
|
|
45
|
-
* re-chunking it as a file. This is the one layout a manifest commits to, so
|
|
46
|
-
* a host rebuilding a lost manifest from retained bytes uses it too. */
|
|
47
|
-
export const artifactBlockSizes = (artifact, totalBytes) => {
|
|
48
|
-
switch (artifact.kind) {
|
|
49
|
-
case 'file':
|
|
50
|
-
case 'construct':
|
|
51
|
-
return chunkSizes(totalBytes);
|
|
52
|
-
case 'link':
|
|
53
|
-
if (totalBytes > MAX_CONTENT_BLOCK_BYTES)
|
|
54
|
-
throw new Error('link target exceeds the transfer frame bound');
|
|
55
|
-
return totalBytes === 0 ? [] : [totalBytes];
|
|
56
|
-
case 'page':
|
|
57
|
-
// A graph page is at most one mebibyte and never empty: one block.
|
|
58
|
-
if (totalBytes === 0 || totalBytes > GRAPH_PAGE_BYTES)
|
|
59
|
-
throw new Error('a graph page must be one bounded block');
|
|
60
|
-
return [totalBytes];
|
|
61
|
-
case 'git':
|
|
62
|
-
return fixedSizes(totalBytes, MAX_CONTENT_BLOCK_BYTES);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
/** The manifest an artifact's layout fixes without its bytes. An artifact of
|
|
66
|
-
* at most one part is its own single block, so its content hash and size are
|
|
67
|
-
* its whole manifest. Null when the layout has more parts: only the bytes, or
|
|
68
|
-
* the manifest the read of them left, can answer. */
|
|
69
|
-
export function layoutManifest(artifact, totalBytes) {
|
|
70
|
-
const sizes = artifactBlockSizes(artifact, totalBytes);
|
|
71
|
-
if (sizes.length > 1)
|
|
72
|
-
return null;
|
|
73
|
-
const checked = manifestFromChunks(artifact.contentHash, sizes.map((bytes) => ({ sha256: artifact.contentHash, bytes })));
|
|
74
|
-
return checked.ok ? checked.value : null;
|
|
75
|
-
}
|
|
76
|
-
/** Derive the reusable upload evidence while capture already owns the bytes.
|
|
77
|
-
* A host persists this beside its immutable artifact so upload never has to
|
|
78
|
-
* rediscover block boundaries or reread the complete source just to prove the
|
|
79
|
-
* work registration already completed. */
|
|
80
|
-
export function deriveUploadManifest(artifact, bytes, sha256Hex) {
|
|
81
|
-
assertTransferArtifact(artifact);
|
|
82
|
-
if (sha256Hex(bytes) !== artifact.contentHash) {
|
|
83
|
-
throw new UploadSourceMismatchError(`captured artifact does not match ${artifact.contentHash}`);
|
|
84
|
-
}
|
|
85
|
-
// A single part is the whole content, so its digest is the one just taken.
|
|
86
|
-
const sizes = artifactBlockSizes(artifact, bytes.byteLength);
|
|
87
|
-
const chunks = [];
|
|
88
|
-
let offset = 0;
|
|
89
|
-
for (const size of sizes) {
|
|
90
|
-
const part = bytes.subarray(offset, offset + size);
|
|
91
|
-
chunks.push({ sha256: sizes.length === 1 ? artifact.contentHash : sha256Hex(part), bytes: size });
|
|
92
|
-
offset += size;
|
|
93
|
-
}
|
|
94
|
-
const checked = manifestFromChunks(artifact.contentHash, chunks);
|
|
95
|
-
if (!checked.ok)
|
|
96
|
-
throw new Error(checked.error);
|
|
97
|
-
return checked.value;
|
|
98
|
-
}
|
|
99
|
-
const readExact = async (source, chunk) => {
|
|
100
|
-
const bytes = await source.read(chunk.offset, chunk.bytes);
|
|
101
|
-
if (!(bytes instanceof Uint8Array) || bytes.byteLength !== chunk.bytes) {
|
|
102
|
-
throw new Error(`upload source returned the wrong byte count for chunk ${chunk.index}`);
|
|
103
|
-
}
|
|
104
|
-
return bytes;
|
|
105
|
-
};
|
|
106
|
-
const assertBatchChunks = (bytes, indexes, manifest, sha256Hex) => {
|
|
107
|
-
let offset = 0;
|
|
108
|
-
for (const index of indexes) {
|
|
109
|
-
const expected = manifest.chunks[index];
|
|
110
|
-
if (!expected)
|
|
111
|
-
throw new Error(`content manifest has no chunk ${index}`);
|
|
112
|
-
const chunk = bytes.subarray(offset, offset + expected.bytes);
|
|
113
|
-
if (chunk.byteLength !== expected.bytes || sha256Hex(chunk) !== expected.sha256) {
|
|
114
|
-
throw new UploadSourceMismatchError(`upload source changed while reading chunk ${index}`);
|
|
115
|
-
}
|
|
116
|
-
offset += expected.bytes;
|
|
117
|
-
}
|
|
118
|
-
if (offset !== bytes.byteLength)
|
|
119
|
-
throw new Error('upload source returned the wrong byte count for a file batch');
|
|
120
|
-
};
|
|
121
|
-
/** The layout a source's cached index and part manifests state, refused
|
|
122
|
-
* unless it is exactly the layout of this artifact's length. */
|
|
123
|
-
const cachedLayout = (artifact, source) => {
|
|
124
|
-
const expectedSizes = artifactBlockSizes(artifact, source.bytes);
|
|
125
|
-
const cached = checkContentLayout(source.manifest, source.parts ?? [], artifact.contentHash);
|
|
126
|
-
if (!cached.ok || cached.value.bytes !== source.bytes
|
|
127
|
-
|| cached.value.chunks.length !== expectedSizes.length
|
|
128
|
-
|| cached.value.chunks.some((chunk, index) => chunk.bytes !== expectedSizes[index])) {
|
|
129
|
-
throw new Error('cached upload manifest is invalid');
|
|
130
|
-
}
|
|
131
|
-
return cached.value;
|
|
132
|
-
};
|
|
133
|
-
/** Read the whole source once, hashing it, each part and each block in the
|
|
134
|
-
* same pass. A layout is only ever the reading of the bytes its content
|
|
135
|
-
* hash names, so a source that changed is refused whatever the authority
|
|
136
|
-
* already holds. */
|
|
137
|
-
const readLayout = async (artifact, source, ports) => {
|
|
138
|
-
const bounds = partSizes(source.bytes);
|
|
139
|
-
const whole = ports.sha256Stream();
|
|
140
|
-
const chunks = [];
|
|
141
|
-
const partHashes = [];
|
|
142
|
-
let part = bounds.length > 0 ? ports.sha256Stream() : null;
|
|
143
|
-
let partLeft = bounds[0] ?? 0;
|
|
144
|
-
for (const chunk of planChunks(artifactBlockSizes(artifact, source.bytes))) {
|
|
145
|
-
const bytes = await readExact(source, chunk);
|
|
146
|
-
whole.update(bytes);
|
|
147
|
-
chunks.push({ sha256: ports.sha256Hex(bytes), bytes: chunk.bytes });
|
|
148
|
-
if (part === null)
|
|
149
|
-
continue;
|
|
150
|
-
part.update(bytes);
|
|
151
|
-
partLeft -= chunk.bytes;
|
|
152
|
-
if (partLeft === 0) {
|
|
153
|
-
partHashes.push(part.digest());
|
|
154
|
-
partLeft = bounds[partHashes.length] ?? 0;
|
|
155
|
-
part = partLeft > 0 ? ports.sha256Stream() : null;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
if (whole.digest() !== artifact.contentHash) {
|
|
159
|
-
throw new UploadSourceMismatchError(`upload source does not match ${artifact.contentHash}`);
|
|
160
|
-
}
|
|
161
|
-
const checked = contentLayoutFrom(artifact.contentHash, chunks, partHashes);
|
|
162
|
-
if (!checked.ok)
|
|
163
|
-
throw new Error(checked.error);
|
|
164
|
-
return checked.value;
|
|
165
|
-
};
|
|
166
|
-
/** Send one manifest's missing blocks, then seal it. */
|
|
167
|
-
const sendManifest = async (artifact, source, manifest, ports, options) => {
|
|
168
|
-
const plan = planChunks(manifest.chunks.map((chunk) => chunk.bytes));
|
|
169
|
-
const reported = [...await ports.missingChunks(artifact, manifest)];
|
|
170
|
-
if (new Set(reported).size !== reported.length
|
|
171
|
-
|| reported.some((index) => !Number.isSafeInteger(index) || index < 0 || index >= plan.length)) {
|
|
172
|
-
throw new Error('upload authority returned invalid missing chunk indexes');
|
|
173
|
-
}
|
|
174
|
-
// A block is addressed by its digest, so a block the artifact repeats is
|
|
175
|
-
// one block: it is put once, at its first missing index.
|
|
176
|
-
const digests = new Set();
|
|
177
|
-
const missing = reported.sort((left, right) => left - right).filter((index) => {
|
|
178
|
-
const digest = manifest.chunks[index].sha256;
|
|
179
|
-
if (digests.has(digest))
|
|
180
|
-
return false;
|
|
181
|
-
digests.add(digest);
|
|
182
|
-
return true;
|
|
183
|
-
});
|
|
184
|
-
if ((artifact.kind === 'file' || artifact.kind === 'construct') && ports.putChunkBatch) {
|
|
185
|
-
await parallelForEach(planChunkBatches(missing, manifest), options.concurrency ?? DEFAULT_TRANSFER_CONCURRENCY, async (batch) => {
|
|
186
|
-
const bytes = await readExact(source, { index: batch.indexes[0], offset: batch.offset, bytes: batch.bytes });
|
|
187
|
-
assertBatchChunks(bytes, batch.indexes, manifest, ports.sha256Hex);
|
|
188
|
-
await ports.putChunkBatch(artifact, manifest, batch.indexes, bytes);
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
await parallelForEach(missing, options.concurrency ?? DEFAULT_TRANSFER_CONCURRENCY, async (index) => {
|
|
193
|
-
const chunk = plan[index];
|
|
194
|
-
if (chunk === undefined)
|
|
195
|
-
throw new Error('upload authority returned an unknown chunk index');
|
|
196
|
-
const bytes = await readExact(source, chunk);
|
|
197
|
-
if (ports.sha256Hex(bytes) !== manifest.chunks[index]?.sha256) {
|
|
198
|
-
throw new UploadSourceMismatchError(`upload source changed while reading chunk ${index}`);
|
|
199
|
-
}
|
|
200
|
-
await ports.putChunk(artifact, manifest, index, bytes);
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
await ports.putManifest(artifact, manifest);
|
|
204
|
-
return missing.length;
|
|
205
|
-
};
|
|
206
|
-
/** Send the parts the authority has not sealed, each as content of its own
|
|
207
|
-
* bytes, then seal the list. */
|
|
208
|
-
const sendParts = async (artifact, source, layout, ports, options) => {
|
|
209
|
-
const reported = [...await ports.missingParts(artifact, layout.index)];
|
|
210
|
-
if (new Set(reported).size !== reported.length
|
|
211
|
-
|| reported.some((index) => !Number.isSafeInteger(index) || index < 0 || index >= layout.parts.length)) {
|
|
212
|
-
throw new Error('upload authority returned invalid missing part indexes');
|
|
213
|
-
}
|
|
214
|
-
// A part is addressed by its hash, as a block is by its digest.
|
|
215
|
-
const hashes = new Set();
|
|
216
|
-
let uploaded = 0;
|
|
217
|
-
for (const at of reported.sort((left, right) => left - right)) {
|
|
218
|
-
const part = layout.parts[at];
|
|
219
|
-
if (hashes.has(part.contentHash))
|
|
220
|
-
continue;
|
|
221
|
-
hashes.add(part.contentHash);
|
|
222
|
-
const base = at * CONTENT_PART_BYTES;
|
|
223
|
-
uploaded += await sendManifest({ ...artifact, contentHash: part.contentHash }, { bytes: part.bytes, read: (offset, bytes) => source.read(base + offset, bytes) }, part, ports, options);
|
|
224
|
-
}
|
|
225
|
-
await ports.putManifest(artifact, layout.index);
|
|
226
|
-
return uploaded;
|
|
227
|
-
};
|
|
228
|
-
/** Upload one immutable artifact, sending only authority-declared gaps. */
|
|
229
|
-
export async function upload(artifact, source, ports, options = {}) {
|
|
230
|
-
assertTransferArtifact(artifact);
|
|
231
|
-
if (!Number.isSafeInteger(source.bytes) || source.bytes < 0) {
|
|
232
|
-
throw new Error('upload source byte count is invalid');
|
|
233
|
-
}
|
|
234
|
-
const layout = source.manifest !== undefined
|
|
235
|
-
? cachedLayout(artifact, source)
|
|
236
|
-
: await readLayout(artifact, source, ports);
|
|
237
|
-
const index = layout.index;
|
|
238
|
-
const uploadedChunks = isContentParts(index)
|
|
239
|
-
? await sendParts(artifact, source, { ...layout, index }, ports, options)
|
|
240
|
-
: await sendManifest(artifact, source, index, ports, options);
|
|
241
|
-
return {
|
|
242
|
-
artifact,
|
|
243
|
-
layout,
|
|
244
|
-
uploadedChunks,
|
|
245
|
-
reusedChunks: layout.chunks.length - uploadedChunks,
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
//# sourceMappingURL=upload.js.map
|
|
1
|
+
var x=Object.defineProperty;var d=(e,n)=>x(e,"name",{value:n,configurable:!0});import{assertContentBytes as H,checkContentLayout as v,CONTENT_PART_BYTES as L,contentLayoutFrom as T,isContentParts as _,MAX_CONTENT_BLOCK_BYTES as k,chunkSizes as z,manifestFromChunks as y,partSizes as A}from"../contracts/content.js";import{GRAPH_PAGE_BYTES as M}from"../entities/graph-pages.js";import{assertTransferArtifact as g}from"./artifacts.js";import{planChunkBatches as N}from"./batches.js";import{DEFAULT_TRANSFER_CONCURRENCY as b,parallelForEach as m}from"./parallel.js";class w extends Error{static{d(this,"UploadSourceMismatchError")}code="UPLOAD_SOURCE_MISMATCH"}const E=d(e=>{let n=0;return e.map((t,s)=>{const o={index:s,offset:n,bytes:t};return n+=t,o})},"planChunks"),P=d((e,n)=>{H(e);const t=[];for(let s=e;s>0;s-=n)t.push(Math.min(s,n));return t},"fixedSizes"),f=d((e,n)=>{switch(e.kind){case"file":case"construct":return z(n);case"link":if(n>k)throw new Error("link target exceeds the transfer frame bound");return n===0?[]:[n];case"page":if(n===0||n>M)throw new Error("a graph page must be one bounded block");return[n];case"git":return P(n,k)}},"artifactBlockSizes");function K(e,n){const t=f(e,n);if(t.length>1)return null;const s=y(e.contentHash,t.map(o=>({sha256:e.contentHash,bytes:o})));return s.ok?s.value:null}d(K,"layoutManifest");function X(e,n,t){if(g(e),t(n)!==e.contentHash)throw new w(`captured artifact does not match ${e.contentHash}`);const s=f(e,n.byteLength),o=[];let a=0;for(const u of s){const i=n.subarray(a,a+u);o.push({sha256:s.length===1?e.contentHash:t(i),bytes:u}),a+=u}const h=y(e.contentHash,o);if(!h.ok)throw new Error(h.error);return h.value}d(X,"deriveUploadManifest");const p=d(async(e,n)=>{const t=await e.read(n.offset,n.bytes);if(!(t instanceof Uint8Array)||t.byteLength!==n.bytes)throw new Error(`upload source returned the wrong byte count for chunk ${n.index}`);return t},"readExact"),R=d((e,n,t,s)=>{let o=0;for(const a of n){const h=t.chunks[a];if(!h)throw new Error(`content manifest has no chunk ${a}`);const u=e.subarray(o,o+h.bytes);if(u.byteLength!==h.bytes||s(u)!==h.sha256)throw new w(`upload source changed while reading chunk ${a}`);o+=h.bytes}if(o!==e.byteLength)throw new Error("upload source returned the wrong byte count for a file batch")},"assertBatchChunks"),U=d((e,n)=>{const t=f(e,n.bytes),s=v(n.manifest,n.parts??[],e.contentHash);if(!s.ok||s.value.bytes!==n.bytes||s.value.chunks.length!==t.length||s.value.chunks.some((o,a)=>o.bytes!==t[a]))throw new Error("cached upload manifest is invalid");return s.value},"cachedLayout"),O=d(async(e,n,t)=>{const s=A(n.bytes),o=t.sha256Stream(),a=[],h=[];let u=s.length>0?t.sha256Stream():null,i=s[0]??0;for(const c of E(f(e,n.bytes))){const l=await p(n,c);o.update(l),a.push({sha256:t.sha256Hex(l),bytes:c.bytes}),u!==null&&(u.update(l),i-=c.bytes,i===0&&(h.push(u.digest()),i=s[h.length]??0,u=i>0?t.sha256Stream():null))}if(o.digest()!==e.contentHash)throw new w(`upload source does not match ${e.contentHash}`);const r=T(e.contentHash,a,h);if(!r.ok)throw new Error(r.error);return r.value},"readLayout"),S=d(async(e,n,t,s,o)=>{const a=E(t.chunks.map(r=>r.bytes)),h=[...await s.missingChunks(e,t)];if(new Set(h).size!==h.length||h.some(r=>!Number.isSafeInteger(r)||r<0||r>=a.length))throw new Error("upload authority returned invalid missing chunk indexes");const u=new Set,i=h.sort((r,c)=>r-c).filter(r=>{const c=t.chunks[r].sha256;return u.has(c)?!1:(u.add(c),!0)});return(e.kind==="file"||e.kind==="construct")&&s.putChunkBatch?await m(N(i,t),o.concurrency??b,async r=>{const c=await p(n,{index:r.indexes[0],offset:r.offset,bytes:r.bytes});R(c,r.indexes,t,s.sha256Hex),await s.putChunkBatch(e,t,r.indexes,c)}):await m(i,o.concurrency??b,async r=>{const c=a[r];if(c===void 0)throw new Error("upload authority returned an unknown chunk index");const l=await p(n,c);if(s.sha256Hex(l)!==t.chunks[r]?.sha256)throw new w(`upload source changed while reading chunk ${r}`);await s.putChunk(e,t,r,l)}),await s.putManifest(e,t),i.length},"sendManifest"),$=d(async(e,n,t,s,o)=>{const a=[...await s.missingParts(e,t.index)];if(new Set(a).size!==a.length||a.some(i=>!Number.isSafeInteger(i)||i<0||i>=t.parts.length))throw new Error("upload authority returned invalid missing part indexes");const h=new Set;let u=0;for(const i of a.sort((r,c)=>r-c)){const r=t.parts[i];if(h.has(r.contentHash))continue;h.add(r.contentHash);const c=i*L;u+=await S({...e,contentHash:r.contentHash},{bytes:r.bytes,read:d((l,C)=>n.read(c+l,C),"read")},r,s,o)}return await s.putManifest(e,t.index),u},"sendParts");async function j(e,n,t,s={}){if(g(e),!Number.isSafeInteger(n.bytes)||n.bytes<0)throw new Error("upload source byte count is invalid");const o=n.manifest!==void 0?U(e,n):await O(e,n,t),a=o.index,h=_(a)?await $(e,n,{...o,index:a},t,s):await S(e,n,a,t,s);return{artifact:e,layout:o,uploadedChunks:h,reusedChunks:o.chunks.length-h}}d(j,"upload");export{w as UploadSourceMismatchError,f as artifactBlockSizes,X as deriveUploadManifest,K as layoutManifest,j as upload};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Actor } from '../sharing/types.js';
|
|
2
|
+
import type { LocatedEntity, VersionPorts, VersionRole } from './ports.js';
|
|
3
|
+
import { type VersionService } from './services.js';
|
|
4
|
+
export interface Admitted {
|
|
5
|
+
readonly entity: LocatedEntity;
|
|
6
|
+
readonly role: VersionRole;
|
|
7
|
+
}
|
|
8
|
+
export declare function admit(ports: VersionPorts, service: VersionService, caller: Actor, item: string): Promise<Admitted>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var w=Object.defineProperty;var t=(e,n)=>w(e,"name",{value:n,configurable:!0});import{VERSION_DEFINITIONS as h}from"../history/identity.js";import{VersionError as s}from"./errors.js";import{SERVICE_LABELS as k,SERVICE_TYPES as p}from"./services.js";const c={folder:"Folders keep no versions of their own. Ask for a file inside it.",workspace:"Workspaces keep no versions of their own. Ask for a file inside it.",reference:"Linked folders keep no versions of their own. Ask for a file inside it."};async function I(e,n,d,f){const r=t(()=>new s("not_found",`No item "${f}" in ${k[n]}.`),"notFound"),o=await e.locate(f);if(o===null)throw r();const{type:i,name:a}=o.row;if(!p[n].has(i))throw r();const l=await e.role(d,o);if(l===null)throw r();if(o.status==="deleted")throw new s("no_history",`${a} was deleted for good and keeps no versions.`);if(h[i]===null)throw new s("no_history",c[i]??`${a} keeps no versions.`);return{entity:o,role:l}}t(I,"admit");export{I as admit};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f=Object.defineProperty;var i=(e,o)=>f(e,"name",{value:o,configurable:!0});import{commandDefinition as y,versionArgument as m}from"./commands.js";import{refusalOf as w,VERSION_ERROR_STATUS as h,VersionError as s}from"./errors.js";const u=16*1024;function T(e){const o=`/versions/${e.service}`;return async n=>{try{const{pathname:t,searchParams:r}=new URL(n.url);return t===`${o}/commands`&&n.method==="POST"?await p(e,n):t===`${o}/content`&&n.method==="GET"?await v(e,r):d(new s("not_found","There is no such version history route."))}catch(t){return t instanceof s?d(t):l(500,{error:w(t)})}}}i(T,"createVersionsApi");async function p(e,o){const n=await g(o),t=typeof n.call=="string"?n.call:"",r=await e.commands.execute(y(t).name,n.input??{});return l(200,{result:r})}i(p,"command");async function v(e,o){const n=await e.commands.execute("show",{item:o.get("item")??"",version:m(o.get("version")??"")});if(n.content.kind==="link")throw new s("invalid",`Version ${n.version.version} is a link to ${n.content.target}; it has no bytes.`);if(n.content.kind==="git")throw new s("invalid",`Version ${n.version.version} is Git's own state; it has no bytes to open.`);const t={"content-type":n.content.mediaType,"cache-control":"no-store","content-security-policy":"sandbox","x-content-type-options":"nosniff"};return n.content.bytes!==null&&(t["content-length"]=String(n.content.bytes)),new Response(await e.open(n),{status:200,headers:t})}i(v,"content");async function g(e){const o=new s("invalid",`A version history request must be under ${u/1024} KiB.`),n=[];let t=0;if(e.body!==null){const c=e.body.getReader();for(let a=await c.read();!a.done;a=await c.read()){if(t+=a.value.byteLength,t>u)throw await c.cancel(),o;n.push(a.value)}}let r;try{r=JSON.parse(new TextDecoder().decode(b(n,t)))}catch{r=null}if(r===null||typeof r!="object"||Array.isArray(r))throw new s("invalid",'Send a JSON object like {"call": "list", "input": {"item": "notes/essay.md"}}.');return r}i(g,"bodyJson");function b(e,o){const n=new Uint8Array(o);let t=0;for(const r of e)n.set(r,t),t+=r.byteLength;return n}i(b,"join");function d(e){return l(h[e.code],{error:{code:e.code,message:e.message}})}i(d,"refusal");function l(e,o){return new Response(JSON.stringify(o),{status:e,headers:{"content-type":"application/json","cache-control":"no-store"}})}i(l,"jsonValue");export{u as VERSIONS_BODY_BYTES,T as createVersionsApi};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var d=Object.defineProperty;var o=(e,n)=>d(e,"name",{value:n,configurable:!0});import{groupByDay as g}from"./dates.js";function x(e,n){const t=e.versions.length,s=[`${e.item.name} ${t} ${t===1?"version":"versions"}`,""],h=Math.max(2,...e.versions.map(i=>String(i.version).length));for(const i of g(e.versions,n)){s.push(i.day);for(const r of i.versions){const a=[String(r.version).padStart(h),p(r.savedAt,n).padStart(8),v(r.bytes).padStart(8)];r.current&&a.push("current"),r.changed!==void 0&&a.push(m(r.changed)),s.push(` ${a.join(" ")}`.trimEnd())}}return e.complete||s.push("","Earlier versions may exist. This computer could not reach them."),`${s.join(`
|
|
2
|
+
`)}
|
|
3
|
+
`}o(x,"listText");function S(e){return e.restored?`Restored ${e.item.name} to version ${e.version}.
|
|
4
|
+
`:`${e.item.name} already has the content of version ${e.version}.
|
|
5
|
+
`}o(S,"restoreText");const f={refs:"branches moved",stash:"stash changed",staged:"staging changed",operation:"merge or rebase changed",settings:"settings changed"};function m(e){const n=e.map(t=>f[t]).join(", ");return n.charAt(0).toUpperCase()+n.slice(1)}o(m,"changedText");const c=new Map;function p(e,n){let t=c.get(n);return t===void 0&&(t=new Intl.DateTimeFormat("en-US",{timeZone:n,hour:"numeric",minute:"2-digit"}),c.set(n,t)),t.format(e).replace(/\s/gu," ")}o(p,"timeOfDay");const u=["KB","MB","GB","TB"];function v(e){if(e===null)return"";if(e<1024)return`${e} B`;let n=e/1024,t=0;for(;n>=1024&&t<u.length-1;)n/=1024,t+=1;return`${n.toFixed(1)} ${u[t]}`}o(v,"size");export{x as listText,S as restoreText};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { VersionTextHost } from './deliver.js';
|
|
2
|
+
export interface CliResult {
|
|
3
|
+
readonly exitCode: 0 | 1;
|
|
4
|
+
readonly stdout: string;
|
|
5
|
+
readonly stderr: string;
|
|
6
|
+
}
|
|
7
|
+
export interface VersionCliHost extends VersionTextHost {
|
|
8
|
+
resolvePath(text: string): string;
|
|
9
|
+
readonly timeZone: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const CLI_USAGE = "amalgm files versions \u2014 earlier versions of a file, through the running Amalgm runtime\n\nUsage:\n amalgm files versions list <item> [--from DATE] [--to DATE] [--timeZone ZONE] [--json]\n amalgm files versions show <item> <version> [--save] [--json]\n amalgm files versions restore <item> <version> [--json]\n\n<item> is a path or an item's UUID. <version> is a number from list.\nDATE is a day (2026-11-12) or a time (2026-11-12T15:30:00-08:00).\nshow prints text; anything else is saved outside your Amalgm folder and its path is printed.\nrestore saves that version as the file's content again. Nothing is lost: the content\nit replaces stays in the list.\n";
|
|
12
|
+
export declare function runCli(argv: readonly string[], host: VersionCliHost): Promise<CliResult>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var w=Object.defineProperty;var a=(e,n)=>w(e,"name",{value:n,configurable:!0});import{UUID_PATTERN as g}from"../entities/types.js";import{listText as v,restoreText as x}from"./cli-text.js";import{commandDefinition as $,versionArgument as y}from"./commands.js";import{deliver as T}from"./deliver.js";import{refusalOf as A,VersionError as f}from"./errors.js";const d=`amalgm files versions — earlier versions of a file, through the running Amalgm runtime
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
amalgm files versions list <item> [--from DATE] [--to DATE] [--timeZone ZONE] [--json]
|
|
5
|
+
amalgm files versions show <item> <version> [--save] [--json]
|
|
6
|
+
amalgm files versions restore <item> <version> [--json]
|
|
7
|
+
|
|
8
|
+
<item> is a path or an item's UUID. <version> is a number from list.
|
|
9
|
+
DATE is a day (2026-11-12) or a time (2026-11-12T15:30:00-08:00).
|
|
10
|
+
show prints text; anything else is saved outside your Amalgm folder and its path is printed.
|
|
11
|
+
restore saves that version as the file's content again. Nothing is lost: the content
|
|
12
|
+
it replaces stays in the list.
|
|
13
|
+
`,E={list:["json"],show:["save","json"],restore:["json"]};async function b(e,n){const[i,...s]=e;if(i===void 0||i==="help"||i==="--help"||i==="-h")return{exitCode:0,stdout:d,stderr:""};const r=s.includes("--json");let t;try{t=C(i,s,n)}catch(o){return p(o,r,d)}try{return{exitCode:0,stdout:await U(t,n,r),stderr:""}}catch(o){return p(o,r,"")}}a(b,"runCli");async function U(e,n,i){const s=a(t=>`${JSON.stringify(t)}
|
|
14
|
+
`,"line"),{commands:r}=n;switch(e.name){case"list":{const t={timeZone:n.timeZone,...e.input},o=await r.execute("list",t);return i?s(o):v(o,t.timeZone)}case"show":{const t=await r.execute("show",e.input),o=await T(n,t,{save:e.switches.has("save")});return i?s({...t,delivered:o}):D(o)}case"restore":{const t=await r.execute("restore",e.input);return i?s(t):x(t)}}}a(U,"run");function C(e,n,i){const s=$(e),r=E[s.name],t={},o=new Set,m=[];for(let c=0;c<n.length;c+=1){const l=n[c];if(!l.startsWith("--")){m.push(l);continue}const u=l.slice(2);if(r.includes(u))o.add(u);else if(s.options.includes(u)){const h=n[++c];if(h===void 0)throw new f("invalid",`${l} needs a value.`);t[u]=h}else throw new f("invalid",`Unknown option for ${e}: ${l}`)}if(m.length>s.positional.length)throw new f("invalid",`Unexpected argument for ${e}: ${m[s.positional.length]}`);return m.forEach((c,l)=>{const u=s.positional[l];t[u]=u==="item"?j(c,i):y(c)}),{name:s.name,input:t,switches:o}}a(C,"parseCli");const j=a((e,n)=>g.test(e)?e:n.resolvePath(e),"itemArgument");function D(e){switch(e.kind){case"text":return e.text;case"file":return`${e.path}
|
|
15
|
+
`;case"link":return`${e.target}
|
|
16
|
+
`}}a(D,"deliveredText");function p(e,n,i){const s=A(e);return{exitCode:1,stdout:"",stderr:n?`${JSON.stringify({error:s})}
|
|
17
|
+
`:`${s.message}
|
|
18
|
+
${i?`
|
|
19
|
+
${i}`:""}`}}a(p,"refused");export{d as CLI_USAGE,b as runCli};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { FieldShape, JsonObjectSchema } from '../commands/input.js';
|
|
2
|
+
import type { CommandAnnotations } from '../commands/mcp.js';
|
|
3
|
+
import type { Actor } from '../sharing/types.js';
|
|
4
|
+
import type { RestoreResult, ShownVersion, VersionList } from './types.js';
|
|
5
|
+
import type { Versions } from './versions.js';
|
|
6
|
+
export type CommandName = 'list' | 'show' | 'restore';
|
|
7
|
+
export type VersionScope = 'versions:read' | 'versions:write';
|
|
8
|
+
export interface CommandResults {
|
|
9
|
+
readonly list: VersionList;
|
|
10
|
+
readonly show: ShownVersion;
|
|
11
|
+
readonly restore: RestoreResult;
|
|
12
|
+
}
|
|
13
|
+
export interface CommandDefinition {
|
|
14
|
+
readonly name: CommandName;
|
|
15
|
+
readonly scope: VersionScope;
|
|
16
|
+
readonly title: string;
|
|
17
|
+
readonly description: string;
|
|
18
|
+
readonly inputShape: FieldShape;
|
|
19
|
+
readonly positional: readonly string[];
|
|
20
|
+
readonly options: readonly string[];
|
|
21
|
+
readonly annotations: CommandAnnotations;
|
|
22
|
+
inputSchema(): JsonObjectSchema;
|
|
23
|
+
invoke(versions: Versions, caller: Actor, input: unknown): Promise<unknown>;
|
|
24
|
+
}
|
|
25
|
+
export interface Commands {
|
|
26
|
+
execute<N extends CommandName>(name: N, input?: unknown): Promise<CommandResults[N]>;
|
|
27
|
+
}
|
|
28
|
+
export declare const commandDefinitions: readonly CommandDefinition[];
|
|
29
|
+
export declare function commandDefinition(name: string): CommandDefinition;
|
|
30
|
+
export declare const versionArgument: (text: string) => unknown;
|
|
31
|
+
export declare function createCommands(versions: Versions, caller: Actor): Commands;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f=Object.defineProperty;var i=(e,t)=>f(e,"name",{value:t,configurable:!0});import{integer as p,jsonSchema as c,parseInput as v,string as r}from"../commands/input.js";import{VersionError as m}from"./errors.js";const s=r("A path or an item's UUID",!0),l=p("A version number from list",!0),d="a day like 2026-11-12 or a time like 2026-11-12T15:30:00-08:00",w=[a({name:"list",scope:"versions:read",title:"List versions",description:`List a file's earlier versions, newest first. Example: {"item": "notes/essay.md", "from": "2026-11-12"}. from and to keep the versions that were current at some moment between them.`,shape:{item:s,from:r(`The earliest moment: ${d}`),to:r(`The latest moment: ${d}`),timeZone:r("The time zone a day is read in, like America/Los_Angeles. Default: this computer's")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},run:i((e,t,n)=>e.list(t,n),"run")}),a({name:"show",scope:"versions:read",title:"Show a version",description:'Show one earlier version of a file without changing the file. Example: {"item": "notes/essay.md", "version": 3}.',shape:{item:s,version:l},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},run:i((e,t,n)=>e.show(t,n),"run")}),a({name:"restore",scope:"versions:write",title:"Restore a version",description:`Save an earlier version as the file's content again. Nothing is lost: the content it replaces stays in the list. Example: {"item": "notes/essay.md", "version": 3}.`,shape:{item:s,version:l},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},run:i((e,t,n)=>e.restore(t,n),"run")})];function y(e){const t=w.find(n=>n.name===e);if(t===void 0)throw new m("invalid",`Unknown command ${JSON.stringify(e)}. Use list, show or restore.`);return t}i(y,"commandDefinition");const x=i(e=>/^\d+$/.test(e)?Number(e):e,"versionArgument");function A(e,t){return{execute:i((n,o={})=>y(n).invoke(e,t,o),"execute")}}i(A,"createCommands");function a(e){const t=Object.keys(e.shape),n=t.filter(o=>e.shape[o].required);return{name:e.name,scope:e.scope,title:e.title,description:e.description,inputShape:e.shape,positional:n,options:t.filter(o=>!e.shape[o].required),annotations:e.annotations,inputSchema:i(()=>c(e.shape),"inputSchema"),invoke:i((o,h,u)=>e.run(o,h,H(e.shape,u)),"invoke")}}i(a,"define");function H(e,t){try{return v(e,t)}catch(n){throw new m("invalid",`${n.message}.`)}}i(H,"checked");export{y as commandDefinition,w as commandDefinitions,A as createCommands,x as versionArgument};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { VersionRun } from '../history/runs.js';
|
|
2
|
+
import type { LocatedEntity, VersionPorts } from './ports.js';
|
|
3
|
+
import type { VersionContent } from './types.js';
|
|
4
|
+
export declare function heldContent(ports: VersionPorts, entity: LocatedEntity, run: VersionRun, version: number): Promise<VersionContent>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c=Object.defineProperty;var a=(r,n)=>c(r,"name",{value:n,configurable:!0});import{filesMediaType as f}from"../files/media-type.js";import{artifactForRecord as h}from"../transfer/artifacts.js";import{VersionError as s}from"./errors.js";async function u(r,n,l,o){const{row:e}=l.last;if(e.type==="link"){if(e.linkTarget===null)throw new Error(`version ${o} of ${n.entityId} is a link with no target`);return{kind:"link",target:e.linkTarget}}const t=h(e);if(t===null)throw new Error(`version ${o} of ${n.entityId} names no content`);const i=await r.hold(n,t);if(i==="gone")throw new s("gone",`Version ${o} of ${n.row.name} is no longer kept.`);if(i==="unreachable")throw new s("unavailable",`Version ${o} of ${n.row.name} is not on this computer and the cloud cannot be reached. Try again when this computer is online.`);return e.type==="repo.git"?{kind:"git",transportVersion:t.contentHash}:{kind:"bytes",contentHash:t.contentHash,bytes:e.size,mediaType:f(e.name)}}a(u,"heldContent");export{u as heldContent};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ListedVersion } from './types.js';
|
|
2
|
+
export interface DateRange {
|
|
3
|
+
readonly from: number | null;
|
|
4
|
+
readonly to: number | null;
|
|
5
|
+
}
|
|
6
|
+
export declare function parseDateRange(input: {
|
|
7
|
+
readonly from?: string;
|
|
8
|
+
readonly to?: string;
|
|
9
|
+
}, timeZone: string): DateRange;
|
|
10
|
+
export declare function withinRange<V extends Pick<ListedVersion, 'savedAt' | 'replacedAt'>>(versions: readonly V[], range: DateRange, now: number): readonly V[];
|
|
11
|
+
export declare function dayOf(instant: number, timeZone: string): string;
|
|
12
|
+
export declare function groupByDay<V extends Pick<ListedVersion, 'savedAt'>>(versions: readonly V[], timeZone: string): readonly {
|
|
13
|
+
readonly day: string;
|
|
14
|
+
readonly versions: readonly V[];
|
|
15
|
+
}[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var p=Object.defineProperty;var a=(e,n)=>p(e,"name",{value:n,configurable:!0});import{VersionError as c}from"./errors.js";const D=/^(\d{4})-(\d{2})-(\d{2})$/,w=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d{1,3})?)?(Z|[+-]\d{2}:\d{2})$/,d=864e5;function N(e,n){if(!A(n))throw new c("invalid","timeZone must be an IANA zone like America/Los_Angeles.");const r=e.from===void 0?null:m("from",e.from,n),t=e.to===void 0?null:m("to",e.to,n);if(r!==null&&t!==null&&r>=t)throw new c("invalid",`from ${e.from} is after to ${e.to}.`);return{from:r,to:t}}a(N,"parseDateRange");function S(e,n,r){return e.filter(t=>{const o=t.replacedAt??r,s=n.to===null||t.savedAt<n.to,u=n.from===null||t.savedAt>=n.from||o>n.from;return s&&u})}a(S,"withinRange");function l(e,n){const r=f(e,n);return`${i(r.year,4)}-${i(r.month,2)}-${i(r.day,2)}`}a(l,"dayOf");function C(e,n){const r=[];for(const t of e){const o=l(t.savedAt,n),s=r.at(-1);s!==void 0&&s.day===o?s.versions.push(t):r.push({day:o,versions:[t]})}return r}a(C,"groupByDay");function m(e,n,r){const t=D.exec(n);if(t!==null){const[o,s,u]=[Number(t[1]),Number(t[2]),Number(t[3])];if(g(o,s,u))return T(e==="from"?n:v(Date.UTC(o,s-1,u+1)),r)}else if(w.test(n)){const o=Date.parse(n);if(Number.isFinite(o))return e==="from"?o:o+1}throw new c("invalid",`${e} must be a day like 2026-11-12 or a time like 2026-11-12T15:30:00-08:00.`)}a(m,"bound");function T(e,n){const r=Date.parse(`${e}T00:00:00Z`),t=[r-d,r,r+d].map(o=>r-h(o,n)).filter(o=>l(o,n)===e);return t.length===0?r-h(r,n):Math.min(...t)}a(T,"startOfDay");function h(e,n){const r=Math.floor(e/1e3)*1e3,t=f(r,n);return Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second)-r}a(h,"offsetAt");const y=new Map;function f(e,n){let r=y.get(n);r===void 0&&(r=new Intl.DateTimeFormat("en-US",{timeZone:n,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),y.set(n,r));const t={};for(const o of r.formatToParts(e))o.type!=="literal"&&(t[o.type]=Number(o.value));return{year:t.year,month:t.month,day:t.day,hour:t.hour,minute:t.minute,second:t.second}}a(f,"partsOf");function A(e){try{return f(0,e),!0}catch{return!1}}a(A,"knownZone");function g(e,n,r){const t=new Date(Date.UTC(e,n-1,r));return t.getUTCFullYear()===e&&t.getUTCMonth()===n-1&&t.getUTCDate()===r}a(g,"realDay");const v=a(e=>new Date(e).toISOString().slice(0,10),"isoDay"),i=a((e,n)=>String(e).padStart(n,"0"),"pad");export{l as dayOf,C as groupByDay,N as parseDateRange,S as withinRange};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Commands } from './commands.js';
|
|
2
|
+
import type { VersionService } from './services.js';
|
|
3
|
+
import type { ShownVersion } from './types.js';
|
|
4
|
+
export interface VersionDoorHost {
|
|
5
|
+
readonly service: VersionService;
|
|
6
|
+
readonly commands: Commands;
|
|
7
|
+
open(shown: ShownVersion): Promise<ReadableStream<Uint8Array>>;
|
|
8
|
+
}
|
|
9
|
+
export interface VersionTextHost extends VersionDoorHost {
|
|
10
|
+
scratch(name: string, body: ReadableStream<Uint8Array>): Promise<string>;
|
|
11
|
+
}
|
|
12
|
+
export declare const SHOW_INLINE_BYTES: number;
|
|
13
|
+
export type Delivered = {
|
|
14
|
+
readonly kind: 'text';
|
|
15
|
+
readonly text: string;
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: 'file';
|
|
18
|
+
readonly path: string;
|
|
19
|
+
} | {
|
|
20
|
+
readonly kind: 'link';
|
|
21
|
+
readonly target: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function deliver(host: VersionTextHost, shown: ShownVersion, options: {
|
|
24
|
+
readonly save: boolean;
|
|
25
|
+
}): Promise<Delivered>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var f=Object.defineProperty;var r=(t,e)=>f(t,"name",{value:e,configurable:!0});const g=262144,l=r(({item:t,version:e})=>`Version ${e.version} of ${t.name} is Git's own state: its branches, tags, stash, staged changes, unfinished merge or rebase, and settings. Restore puts them back and leaves the working files as they are.
|
|
2
|
+
`,"gitVersionText");async function h(t,e,c){const{content:n,version:a}=e;if(n.kind==="link")return{kind:"link",target:n.target};if(n.kind==="git")return{kind:"text",text:l(e)};const i=await t.open(e),u=n.bytes!==null&&n.bytes<=262144;if(c.save||a.type!=="file.text"||!u)return{kind:"file",path:await t.scratch(a.name,i)};const s=await new Response(i).arrayBuffer(),o=d(new Uint8Array(s));return o!==null?{kind:"text",text:o}:{kind:"file",path:await t.scratch(a.name,new Blob([s]).stream())}}r(h,"deliver");function d(t){try{return new TextDecoder("utf-8",{fatal:!0}).decode(t)}catch{return null}}r(d,"utf8");export{g as SHOW_INLINE_BYTES,h as deliver};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type VersionErrorCode = 'invalid' | 'not_found' | 'forbidden' | 'no_history' | 'cannot_restore' | 'gone' | 'unavailable';
|
|
2
|
+
export declare class VersionError extends Error {
|
|
3
|
+
readonly code: VersionErrorCode;
|
|
4
|
+
constructor(code: VersionErrorCode, message: string);
|
|
5
|
+
}
|
|
6
|
+
export declare const VERSION_ERROR_STATUS: Readonly<Record<VersionErrorCode, number>>;
|
|
7
|
+
export declare function refusalOf(error: unknown): {
|
|
8
|
+
readonly code: VersionErrorCode | 'failed';
|
|
9
|
+
readonly message: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=Object.defineProperty;var s=(e,o)=>n(e,"name",{value:o,configurable:!0});class t extends Error{static{s(this,"VersionError")}code;constructor(o,r){super(r),this.name="VersionError",this.code=o}}const a=Object.freeze({invalid:400,not_found:404,forbidden:403,no_history:409,cannot_restore:409,gone:410,unavailable:503});function c(e){return e instanceof t?{code:e.code,message:e.message}:{code:"failed",message:"Version history request failed."}}s(c,"refusalOf");export{a as VERSION_ERROR_STATUS,t as VersionError,c as refusalOf};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { createVersions } from './versions.js';
|
|
2
|
+
export type { Versions } from './versions.js';
|
|
3
|
+
export { VERSION_ERROR_STATUS, VersionError } from './errors.js';
|
|
4
|
+
export type { VersionErrorCode } from './errors.js';
|
|
5
|
+
export { SERVICE_LABELS, SERVICE_TYPES } from './services.js';
|
|
6
|
+
export type { VersionService } from './services.js';
|
|
7
|
+
export { dayOf, groupByDay, parseDateRange, withinRange } from './dates.js';
|
|
8
|
+
export type { DateRange } from './dates.js';
|
|
9
|
+
export { commandDefinition, commandDefinitions, createCommands } from './commands.js';
|
|
10
|
+
export type { CommandDefinition, CommandName, CommandResults, Commands, VersionScope } from './commands.js';
|
|
11
|
+
export { SHOW_INLINE_BYTES, deliver } from './deliver.js';
|
|
12
|
+
export type { Delivered, VersionDoorHost, VersionTextHost } from './deliver.js';
|
|
13
|
+
export { CLI_USAGE, runCli } from './cli.js';
|
|
14
|
+
export type { CliResult, VersionCliHost } from './cli.js';
|
|
15
|
+
export { createMcpTools } from './mcp.js';
|
|
16
|
+
export { VERSIONS_BODY_BYTES, createVersionsApi } from './api.js';
|
|
17
|
+
export type { Held, LocatedEntity, RestoreDoor, RestoreOutcome, RestoreSave, VersionLog, VersionPorts, VersionRole, } from './ports.js';
|
|
18
|
+
export type { ListInput, ListedVersion, RestoreResult, ShownVersion, VersionContent, VersionInput, VersionItem, VersionList, } from './types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createVersions as e}from"./versions.js";import{VERSION_ERROR_STATUS as m,VersionError as i}from"./errors.js";import{SERVICE_LABELS as E,SERVICE_TYPES as a}from"./services.js";import{dayOf as S,groupByDay as f,parseDateRange as s,withinRange as x}from"./dates.js";import{commandDefinition as _,commandDefinitions as c,createCommands as I}from"./commands.js";import{SHOW_INLINE_BYTES as O,deliver as T}from"./deliver.js";import{CLI_USAGE as B,runCli as C}from"./cli.js";import{createMcpTools as A}from"./mcp.js";import{VERSIONS_BODY_BYTES as N,createVersionsApi as Y}from"./api.js";export{B as CLI_USAGE,E as SERVICE_LABELS,a as SERVICE_TYPES,O as SHOW_INLINE_BYTES,N as VERSIONS_BODY_BYTES,m as VERSION_ERROR_STATUS,i as VersionError,_ as commandDefinition,c as commandDefinitions,I as createCommands,A as createMcpTools,e as createVersions,Y as createVersionsApi,S as dayOf,T as deliver,f as groupByDay,s as parseDateRange,C as runCli,x as withinRange};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Sha256Hex } from '../entities/types.js';
|
|
2
|
+
import type { LinePoint } from '../history/runs.js';
|
|
3
|
+
import type { LocatedEntity, VersionLog } from './ports.js';
|
|
4
|
+
export interface Line {
|
|
5
|
+
readonly points: readonly LinePoint[];
|
|
6
|
+
readonly complete: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function readLine(log: VersionLog, entity: LocatedEntity, sha256Hex: Sha256Hex): Promise<Line>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var h=Object.defineProperty;var s=(e,n)=>h(e,"name",{value:n,configurable:!0});import{playChange as b}from"../clash/bodmas.js";import{assertRecord as g}from"../entities/cloud.js";import{canonicalVersion as y}from"../entities/rules.js";import{pageHolding as I,parseGraphPage as S}from"../entities/graph-pages.js";import{identityOf as v}from"../history/identity.js";import{VersionError as q}from"./errors.js";async function C(e,n,t){const{records:r,head:a}=await e.records(n);if((r.at(-1)?.globalSequence??0)!==a)return{points:[],complete:!1};const i=r.length===0?a===0:r[0].globalSequence===1,o=i&&r[0]?.change.facets.includes("create")===!0,c=i&&!o?await V(e,n,r,t)??await k(e,n,t):null,l=o||c!==null,u=l?r:r.slice(Math.max(0,r.findIndex(m)));if(!l&&!u.some(m))return{points:[],complete:l};const d=c===null?[]:[c];let f=c?.row??null;for(const p of u)f=b(f,p.change,t).row,f!==null&&d.push(w(p.globalSequence,p,f));return{points:await O(e,n,d),complete:l}}s(C,"readLine");async function O(e,n,t){const r=[...new Set(t.flatMap(({row:o})=>o.type==="repo.git"&&o.transportVersion!==null?[o.transportVersion]:[]))],a=r.length===0?new Map:await e.gitParts(n,r),i=s(o=>{const c=a.get(o);if(c===void 0)throw new q("unavailable",`The versions of ${n.row.name} cannot be read right now. Try again when this computer is online.`);return c},"gitParts");return t.map(o=>({...o,identity:v(o.row,i)}))}s(O,"identify");const m=s(e=>e.change.facets.some(n=>n==="create"||n==="content"||n==="retype"),"setsBytes"),w=s((e,n,t)=>({sequence:e,acceptedAt:n.acceptedAt,actorId:n.actorId,originDeviceId:n.originDeviceId,row:t}),"pointOf");async function V(e,n,t,r){const a=await e.origin(n);if(a===null)return null;const i=g(a.row),o=t.length===0?n.row.version:t[0].basedOnState;return y(i,r)===o?{...a,sequence:0,row:i}:null}s(V,"signInBirth");async function k(e,n,t){for await(const r of e.packages(n)){const{replay:a}=r.change;if(a.kind!=="package")continue;const i=await A(e,n,a.pages,t);if(i!==null)return w(0,r,i)}return null}s(k,"findBirth");async function A(e,n,t,r){const a=I(t,[n.row.parentUUID,n.entityId]),i=a<0?t:[t[a],...t.filter((o,c)=>c!==a)];for(const o of i){const c=await e.page(n,o);if(c===null)continue;const l=S(o,c,r).find(u=>u.uuid===n.entityId);if(l!==void 0)return g(l)}return null}s(A,"memberOf");export{C as readLine};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Actor } from '../sharing/types.js';
|
|
2
|
+
import type { VersionPorts } from './ports.js';
|
|
3
|
+
import type { VersionService } from './services.js';
|
|
4
|
+
import type { ListInput, VersionList } from './types.js';
|
|
5
|
+
export declare function listVersions(ports: VersionPorts, service: VersionService, caller: Actor, input: ListInput): Promise<VersionList>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var w=Object.defineProperty;var r=(e,t)=>w(e,"name",{value:t,configurable:!0});import{admit as d}from"./admit.js";import{parseDateRange as g,withinRange as l}from"./dates.js";import{itemOf as p,readVersions as v,toListed as y}from"./read.js";async function x(e,t,s,i){const m=g(i,i.timeZone??e.timeZone()),{entity:n}=await d(e,t,s,i.item),{runs:o,complete:a}=await v(e,n),c=o.map((R,f)=>y(o,f)).reverse();return{item:p(n),versions:l(c,m,e.now()),complete:a}}r(x,"listVersions");export{x as listVersions};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var m=Object.defineProperty;var n=(r,e)=>m(r,"name",{value:e,configurable:!0});import{mcpText as o}from"../commands/mcp.js";import{commandDefinitions as c}from"./commands.js";import{deliver as s}from"./deliver.js";import{refusalOf as u}from"./errors.js";function d(r){return c.map(e=>({name:`${r.service}_versions_${e.name}`,title:e.title,description:e.description,inputSchema:e.inputSchema(),annotations:e.annotations,async handler(t={}){try{return o(await i(r,e.name,t))}catch(a){return{...o(u(a).message),isError:!0}}}}))}n(d,"createMcpTools");async function i(r,e,t){if(e!=="show")return r.commands.execute(e,t);const a=await r.commands.execute("show",t);return{...a,delivered:await s(r,a,{save:!1})}}n(i,"result");export{d as createMcpTools};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { CloudEntityRecord } from '../entities/cloud.js';
|
|
2
|
+
import type { GraphPageRef } from '../entities/graph-pages.js';
|
|
3
|
+
import type { EntityStatus, EntityType, Sha256Hex } from '../entities/types.js';
|
|
4
|
+
import type { LinePoint } from '../history/runs.js';
|
|
5
|
+
import type { AcceptedEntityRecord } from '../records/contracts.js';
|
|
6
|
+
import type { Actor } from '../sharing/types.js';
|
|
7
|
+
import type { TransferArtifact } from '../transfer/artifacts.js';
|
|
8
|
+
import type { VersionContent } from './types.js';
|
|
9
|
+
export interface LocatedEntity {
|
|
10
|
+
readonly entityId: string;
|
|
11
|
+
readonly authorityId: string;
|
|
12
|
+
readonly row: CloudEntityRecord;
|
|
13
|
+
readonly status: EntityStatus;
|
|
14
|
+
}
|
|
15
|
+
export type VersionRole = 'owner' | 'editor' | 'viewer';
|
|
16
|
+
export interface VersionLog {
|
|
17
|
+
records(entity: LocatedEntity): Promise<{
|
|
18
|
+
readonly records: readonly AcceptedEntityRecord[];
|
|
19
|
+
readonly head: number;
|
|
20
|
+
}>;
|
|
21
|
+
origin(entity: LocatedEntity): Promise<Omit<LinePoint, 'sequence' | 'identity'> | null>;
|
|
22
|
+
packages(entity: LocatedEntity): AsyncIterable<AcceptedEntityRecord>;
|
|
23
|
+
page(entity: LocatedEntity, ref: GraphPageRef): Promise<Uint8Array | null>;
|
|
24
|
+
released(entity: LocatedEntity): Promise<number>;
|
|
25
|
+
gitParts(entity: LocatedEntity, transportVersions: readonly string[]): Promise<ReadonlyMap<string, string>>;
|
|
26
|
+
}
|
|
27
|
+
export type Held = 'held' | 'gone' | 'unreachable';
|
|
28
|
+
export interface RestoreSave {
|
|
29
|
+
readonly entity: LocatedEntity;
|
|
30
|
+
readonly content: VersionContent;
|
|
31
|
+
readonly mode: CloudEntityRecord['fileMode'];
|
|
32
|
+
}
|
|
33
|
+
export type RestoreOutcome = 'saved' | 'unchanged' | 'busy' | 'absent';
|
|
34
|
+
export interface RestoreDoor {
|
|
35
|
+
save(input: RestoreSave): Promise<RestoreOutcome>;
|
|
36
|
+
}
|
|
37
|
+
export interface VersionPorts {
|
|
38
|
+
readonly sha256Hex: Sha256Hex;
|
|
39
|
+
now(): number;
|
|
40
|
+
timeZone(): string;
|
|
41
|
+
locate(item: string): Promise<LocatedEntity | null>;
|
|
42
|
+
role(caller: Actor, entity: LocatedEntity): Promise<VersionRole | null>;
|
|
43
|
+
readonly log: VersionLog;
|
|
44
|
+
hold(entity: LocatedEntity, artifact: TransferArtifact): Promise<Held>;
|
|
45
|
+
door(type: EntityType): RestoreDoor | null;
|
|
46
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type VersionRun } from '../history/runs.js';
|
|
2
|
+
import type { LocatedEntity, VersionPorts } from './ports.js';
|
|
3
|
+
import type { ListedVersion, VersionItem } from './types.js';
|
|
4
|
+
export interface ReadVersions {
|
|
5
|
+
readonly runs: readonly VersionRun[];
|
|
6
|
+
readonly complete: boolean;
|
|
7
|
+
readonly released: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function readVersions(ports: VersionPorts, entity: LocatedEntity): Promise<ReadVersions>;
|
|
10
|
+
export declare function versionIndex(read: ReadVersions, version: number, name: string): number;
|
|
11
|
+
export declare function toListed(runs: readonly VersionRun[], index: number): ListedVersion;
|
|
12
|
+
export declare function itemOf(entity: LocatedEntity): VersionItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var d=Object.defineProperty;var i=(e,n)=>d(e,"name",{value:n,configurable:!0});import{gitPartsChanged as l}from"../git/parts.js";import{foldRuns as f,runHolding as u}from"../history/runs.js";import{VersionError as a}from"./errors.js";import{readLine as p}from"./line.js";async function x(e,n){const t=await p(e.log,n,e.sha256Hex);if(t.points.length===0)throw new a("unavailable",`The versions of ${n.row.name} cannot be read right now. Try again when this computer is online.`);const o=await e.log.released(n);return{runs:f(t.points).filter(s=>o===0||s.last.sequence>o),complete:t.complete,released:o}}i(x,"readVersions");function I(e,n,t){const o=u(e.runs,n);if(o!==null)return e.runs.indexOf(o);if(e.released>0&&n<=e.released)throw new a("gone",`Version ${n} of ${t} is no longer kept.`);const r=e.runs[0]?.first.sequence;throw!e.complete&&r!==void 0&&n<r?new a("unavailable",`Version ${n} of ${t} cannot be read right now. Try again when this computer is online.`):new a("not_found",`${t} has no version ${n}.`)}i(I,"versionIndex");function $(e,n){const t=e[n],{row:o}=t.last,r={version:t.first.sequence,savedAt:t.first.acceptedAt,replacedAt:t.endedAt,current:t.endedAt===null,name:o.name,type:o.type,bytes:o.size,savedBy:{actorId:t.first.actorId,deviceId:t.first.originDeviceId}},s=e[n-1];return s?.last.row.type==="repo.git"&&o.type==="repo.git"?{...r,changed:l(c(s.identity),c(t.identity))}:r}i($,"toListed");const c=i(e=>e.slice(e.indexOf(":")+1),"partsOf");function b(e){const{name:n,type:t}=e.row;return{entityId:e.entityId,name:n,type:t,inTrash:e.status==="trashed"}}i(b,"itemOf");export{b as itemOf,x as readVersions,$ as toListed,I as versionIndex};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Actor } from '../sharing/types.js';
|
|
2
|
+
import type { VersionPorts } from './ports.js';
|
|
3
|
+
import type { VersionService } from './services.js';
|
|
4
|
+
import type { RestoreResult, VersionInput } from './types.js';
|
|
5
|
+
export declare function restoreVersion(ports: VersionPorts, service: VersionService, caller: Actor, input: VersionInput): Promise<RestoreResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=Object.defineProperty;var i=(o,a)=>g(o,"name",{value:a,configurable:!0});import{artifactKindForType as u}from"../transfer/artifacts.js";import{admit as V}from"./admit.js";import{heldContent as T}from"./content.js";import{VersionError as l}from"./errors.js";import{itemOf as x,readVersions as _,versionIndex as k}from"./read.js";async function M(o,a,v,n){const{entity:t,role:$}=await V(o,a,v,n.item),{name:e,type:c}=t.row,r=i(p=>new l("cannot_restore",p),"cannot");if($==="viewer")throw new l("forbidden",`You can open ${e} but not change it.`);if(t.status==="trashed")throw r(`${e} is in Trash. Put it back, then restore.`);const m=await _(o,t),s=m.runs[k(m,n.version,e)],w=u(s.last.row.type),d=u(c);if(w!==d)throw r(`Version ${n.version} of ${e} was a ${w} and ${e} is a ${d} now.`);const f=o.door(c);if(f===null)throw r(`Restore is not available for ${e} on this computer.`);const y=await T(o,t,s,n.version),b=await f.save({entity:t,content:y,mode:s.last.row.fileMode}),h={item:x(t),version:s.first.sequence};switch(b){case"saved":return{restored:!0,...h};case"unchanged":return{restored:!1,reason:"already_current",...h};case"busy":throw r(`${e} has a change still being saved. Try again in a moment.`);case"absent":throw r(`${e} is not on this computer.`)}}i(M,"restoreVersion");export{M as restoreVersion};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=Object.freeze({files:new Set(["workspace","folder","repo.git","file.text","file.binary","link","reference"])}),r=Object.freeze({files:"Files"});export{r as SERVICE_LABELS,e as SERVICE_TYPES};
|