@idleware/ringi 0.5.0 → 0.6.0
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/package.json +1 -1
- package/target/dts/adapters/fs/index.d.ts +2 -0
- package/target/dts/adapters/fs/lock.d.ts +1 -0
- package/target/dts/adapters/fs/write.d.ts +5 -0
- package/target/dts/adapters/host-posix/group-state.d.ts +7 -0
- package/target/dts/adapters/host-posix/groups.d.ts +1 -0
- package/target/dts/adapters/host-posix/index.d.ts +2 -0
- package/target/dts/adapters/host-posix/launch.d.ts +7 -0
- package/target/dts/adapters/host-posix/probes.d.ts +5 -0
- package/target/dts/adapters/host-posix/stats.d.ts +9 -0
- package/target/dts/adapters/keys-file/index.d.ts +2 -0
- package/target/dts/adapters/state-fs/index.d.ts +5 -0
- package/target/dts/adapters/tool-claude/index.d.ts +2 -0
- package/target/dts/adapters/tool-codex/index.d.ts +2 -0
- package/target/dts/adapters/tool-cursor/index.d.ts +2 -0
- package/target/dts/adapters/tool-traces/index.d.ts +3 -0
- package/target/dts/adapters/transport-git/branches.d.ts +43 -0
- package/target/dts/adapters/transport-git/files.d.ts +2 -0
- package/target/dts/adapters/transport-git/index.d.ts +32 -0
- package/target/dts/adapters/transport-git/marks.d.ts +20 -0
- package/target/dts/adapters/transport-git/remote/admit.d.ts +7 -0
- package/target/dts/adapters/transport-git/remote/alarms.d.ts +3 -0
- package/target/dts/adapters/transport-git/remote/bootstrap.d.ts +7 -0
- package/target/dts/adapters/transport-git/remote/branch-commit.d.ts +3 -0
- package/target/dts/adapters/transport-git/remote/branch-control.d.ts +15 -0
- package/target/dts/adapters/transport-git/remote/branch-scan.d.ts +2 -0
- package/target/dts/adapters/transport-git/remote/branch.d.ts +5 -0
- package/target/dts/adapters/transport-git/remote/cache.d.ts +3 -0
- package/target/dts/adapters/transport-git/remote/commits.d.ts +2 -0
- package/target/dts/adapters/transport-git/remote/forget.d.ts +2 -0
- package/target/dts/adapters/transport-git/remote/git.d.ts +26 -0
- package/target/dts/adapters/transport-git/remote/heartbeat-facts.d.ts +1 -0
- package/target/dts/adapters/transport-git/remote/heartbeat-name.d.ts +6 -0
- package/target/dts/adapters/transport-git/remote/heartbeat-object.d.ts +10 -0
- package/target/dts/adapters/transport-git/remote/heartbeat-push.d.ts +2 -0
- package/target/dts/adapters/transport-git/remote/heartbeat.d.ts +7 -0
- package/target/dts/adapters/transport-git/remote/keys.d.ts +13 -0
- package/target/dts/adapters/transport-git/remote/main.d.ts +11 -0
- package/target/dts/adapters/transport-git/remote/process.d.ts +20 -0
- package/target/dts/adapters/transport-git/remote/push-retry.d.ts +2 -0
- package/target/dts/adapters/transport-git/remote/push-validate.d.ts +2 -0
- package/target/dts/adapters/transport-git/remote/push.d.ts +16 -0
- package/target/dts/adapters/transport-git/remote/roster.d.ts +7 -0
- package/target/dts/adapters/transport-git/remote/signals.d.ts +15 -0
- package/target/dts/adapters/transport-git/remote/signature.d.ts +5 -0
- package/target/dts/adapters/transport-git/remote/sync-heartbeat.d.ts +2 -0
- package/target/dts/adapters/transport-git/remote/sync-rooms.d.ts +6 -0
- package/target/dts/adapters/transport-git/remote/sync-tags.d.ts +8 -0
- package/target/dts/adapters/transport-git/remote/sync.d.ts +2 -0
- package/target/dts/adapters/transport-git/remote/types.d.ts +64 -0
- package/target/dts/adapters/transport-git/remote.d.ts +17 -0
- package/target/dts/adapters/transport-git/repo.d.ts +31 -0
- package/target/dts/adapters/transport-git/run.d.ts +21 -0
- package/target/dts/adapters/transport-git/signing.d.ts +4 -0
- package/target/dts/adapters/transport-git/tags.d.ts +15 -0
- package/target/dts/adapters/transport-git/transport.d.ts +7 -0
- package/target/dts/adapters/transport-kafka/index.d.ts +2 -0
- package/target/dts/adapters/transport-temporal/index.d.ts +2 -0
- package/target/dts/cli.d.ts +2 -1
- package/target/dts/{cli/agent.d.ts → clients/cli/agent/index.d.ts} +3 -3
- package/target/dts/{cli → clients/cli/agent}/session.d.ts +2 -2
- package/target/dts/clients/cli/arg-parse.d.ts +2 -0
- package/target/dts/{cli → clients/cli}/args.d.ts +2 -2
- package/target/dts/clients/cli/commands.d.ts +2 -0
- package/target/dts/clients/cli/context.d.ts +4 -0
- package/target/dts/{cli/index.d.ts → clients/cli/help.d.ts} +1 -3
- package/target/dts/clients/cli/index.d.ts +4 -0
- package/target/dts/clients/cli/operator/heartbeat-format.d.ts +5 -0
- package/target/dts/clients/cli/operator/heartbeat.d.ts +3 -0
- package/target/dts/clients/cli/operator/hub-commands.d.ts +6 -0
- package/target/dts/clients/cli/operator/hub.d.ts +2 -0
- package/target/dts/clients/cli/operator/index.d.ts +5 -0
- package/target/dts/clients/cli/operator/room-lifecycle.d.ts +5 -0
- package/target/dts/clients/cli/operator/room-list.d.ts +5 -0
- package/target/dts/clients/cli/operator/room-members.d.ts +4 -0
- package/target/dts/clients/cli/operator/room.d.ts +2 -0
- package/target/dts/clients/cli/operator/sessions.d.ts +5 -0
- package/target/dts/clients/cli/operator/watch.d.ts +2 -0
- package/target/dts/clients/cli/operator/where-format.d.ts +7 -0
- package/target/dts/clients/cli/operator/where.d.ts +2 -0
- package/target/dts/clients/cli/shared/budget.d.ts +7 -0
- package/target/dts/clients/cli/shared/files.d.ts +4 -0
- package/target/dts/clients/cli/shared/index.d.ts +7 -0
- package/target/dts/clients/cli/shared/messages.d.ts +7 -0
- package/target/dts/clients/cli/shared/profile.d.ts +4 -0
- package/target/dts/clients/cli/shared/session.d.ts +6 -0
- package/target/dts/clients/cli/shared/signals.d.ts +3 -0
- package/target/dts/clients/cli/shared/work.d.ts +6 -0
- package/target/dts/clients/cli/skill/index.d.ts +3 -0
- package/target/dts/{cli/skill.d.ts → clients/cli/skill/targets.d.ts} +1 -2
- package/target/dts/composition/index.d.ts +2 -0
- package/target/dts/{heartbeat → core/agents/heartbeat}/index.d.ts +2 -4
- package/target/dts/{app/heartbeat.d.ts → core/agents/heartbeat/pulse.d.ts} +5 -6
- package/target/dts/core/agents/heartbeat/singleton.d.ts +3 -0
- package/target/dts/core/agents/heartbeat/tools.d.ts +6 -0
- package/target/dts/{app → core/agents}/overview.d.ts +12 -6
- package/target/dts/core/agents/ports/host.d.ts +47 -0
- package/target/dts/core/agents/ports/index.d.ts +9 -0
- package/target/dts/core/agents/ports/tools.d.ts +18 -0
- package/target/dts/core/agents/sessions/agent.d.ts +70 -0
- package/target/dts/core/agents/sessions/binding.d.ts +9 -0
- package/target/dts/core/agents/sessions/context.d.ts +8 -0
- package/target/dts/{runtime/session.d.ts → core/agents/sessions/index.d.ts} +2 -9
- package/target/dts/core/agents/sessions/join.d.ts +20 -0
- package/target/dts/core/agents/sessions/resume.d.ts +2 -0
- package/target/dts/core/agents/sessions/session.d.ts +46 -0
- package/target/dts/core/agents/sessions/wait.d.ts +38 -0
- package/target/dts/core/agents/turns/budgets.d.ts +5 -0
- package/target/dts/core/agents/turns/dispatch.d.ts +9 -0
- package/target/dts/core/agents/turns/exhaustion.d.ts +11 -0
- package/target/dts/core/agents/turns/grants.d.ts +4 -0
- package/target/dts/core/agents/turns/index.d.ts +4 -0
- package/target/dts/core/agents/turns/limits.d.ts +2 -0
- package/target/dts/core/agents/turns/messages.d.ts +10 -0
- package/target/dts/core/agents/turns/pings.d.ts +5 -0
- package/target/dts/core/agents/turns/plan.d.ts +3 -0
- package/target/dts/core/agents/turns/poll.d.ts +8 -0
- package/target/dts/core/agents/turns/results.d.ts +3 -0
- package/target/dts/core/agents/turns/seat.d.ts +2 -0
- package/target/dts/core/agents/turns/types.d.ts +59 -0
- package/target/dts/core/hub/decisions/budget.d.ts +15 -0
- package/target/dts/core/hub/decisions/check.d.ts +6 -0
- package/target/dts/core/hub/decisions/index.d.ts +5 -0
- package/target/dts/core/hub/decisions/proposal.d.ts +38 -0
- package/target/dts/core/hub/decisions/usage.d.ts +12 -0
- package/target/dts/{runtime/reader.d.ts → core/hub/history/index.d.ts} +12 -6
- package/target/dts/core/hub/ports/index.d.ts +16 -0
- package/target/dts/core/hub/ports/state.d.ts +12 -0
- package/target/dts/{store/index.d.ts → core/hub/ports/store.d.ts} +48 -18
- package/target/dts/core/hub/protocol/index.d.ts +5 -0
- package/target/dts/{protocol/index.d.ts → core/hub/protocol/model.d.ts} +0 -25
- package/target/dts/core/hub/protocol/order.d.ts +2 -0
- package/target/dts/core/hub/protocol/reading.d.ts +8 -0
- package/target/dts/core/hub/protocol/text.d.ts +11 -0
- package/target/dts/core/hub/protocol/threads.d.ts +5 -0
- package/target/dts/core/hub/rooms/compat.d.ts +5 -0
- package/target/dts/core/hub/rooms/hubs.d.ts +14 -0
- package/target/dts/core/hub/rooms/index.d.ts +53 -0
- package/target/dts/core/hub/rooms/messages.d.ts +8 -0
- package/target/dts/core/hub/rooms/rooms.d.ts +10 -0
- package/target/dts/core/hub/signals/check.d.ts +3 -0
- package/target/dts/core/hub/signals/effective.d.ts +3 -0
- package/target/dts/core/hub/signals/index.d.ts +5 -0
- package/target/dts/core/hub/signals/marks.d.ts +4 -0
- package/target/dts/core/hub/signals/model.d.ts +28 -0
- package/target/dts/core/hub/signals/pins.d.ts +5 -0
- package/target/dts/{hub/signals.d.ts → core/hub/signals/write.d.ts} +1 -1
- package/target/dts/core/hub/usecases/actor.d.ts +6 -0
- package/target/dts/{app → core/hub/usecases}/budget.d.ts +5 -18
- package/target/dts/core/hub/usecases/config.d.ts +6 -0
- package/target/dts/{app → core/hub/usecases}/context.d.ts +3 -8
- package/target/dts/{app → core/hub/usecases}/hubs.d.ts +1 -1
- package/target/dts/core/hub/usecases/propose.d.ts +17 -0
- package/target/dts/{app → core/hub/usecases}/room.d.ts +8 -34
- package/target/dts/{app → core/hub/usecases}/rooms.d.ts +2 -6
- package/target/dts/core/hub/usecases/roster.d.ts +5 -0
- package/target/dts/core/hub/usecases/send.d.ts +21 -0
- package/target/dts/core/hub/usecases/staging.d.ts +8 -0
- package/target/dts/{app → core/hub/usecases}/view.d.ts +4 -4
- package/target/dts/{domain/profiles.d.ts → core/hub/work/index.d.ts} +3 -7
- package/target/dts/core/hub/work/parse.d.ts +2 -0
- package/target/dts/core/hub/work/task.d.ts +6 -0
- package/target/dts/core/signing/index.d.ts +35 -0
- package/target/dts/index.d.ts +8 -8
- package/target/dts/lib/fail.d.ts +8 -0
- package/target/dts/lib/index.d.ts +3 -11
- package/target/dts/lib/json.d.ts +1 -0
- package/target/esm/adapters/fs/index.js +5 -0
- package/target/esm/adapters/fs/lock.js +83 -0
- package/target/esm/adapters/fs/write.js +25 -0
- package/target/esm/adapters/host-posix/group-state.js +24 -0
- package/target/esm/adapters/host-posix/groups.js +43 -0
- package/target/esm/adapters/host-posix/index.js +35 -0
- package/target/esm/adapters/host-posix/launch.js +80 -0
- package/target/esm/adapters/host-posix/probes.js +66 -0
- package/target/esm/adapters/host-posix/stats.js +27 -0
- package/target/esm/adapters/keys-file/index.js +68 -0
- package/target/esm/adapters/state-fs/index.js +79 -0
- package/target/esm/adapters/tool-claude/index.js +32 -0
- package/target/esm/adapters/tool-codex/index.js +38 -0
- package/target/esm/adapters/tool-cursor/index.js +8 -0
- package/target/esm/adapters/tool-traces/index.js +18 -0
- package/target/esm/adapters/transport-git/branches.js +155 -0
- package/target/esm/adapters/transport-git/files.js +48 -0
- package/target/esm/adapters/transport-git/index.js +128 -0
- package/target/esm/adapters/transport-git/marks.js +88 -0
- package/target/esm/adapters/transport-git/remote/admit.js +71 -0
- package/target/esm/adapters/transport-git/remote/alarms.js +30 -0
- package/target/esm/adapters/transport-git/remote/bootstrap.js +47 -0
- package/target/esm/adapters/transport-git/remote/branch-commit.js +36 -0
- package/target/esm/adapters/transport-git/remote/branch-control.js +37 -0
- package/target/esm/adapters/transport-git/remote/branch-scan.js +28 -0
- package/target/esm/adapters/transport-git/remote/branch.js +37 -0
- package/target/esm/adapters/transport-git/remote/cache.js +23 -0
- package/target/esm/adapters/transport-git/remote/commits.js +25 -0
- package/target/esm/adapters/transport-git/remote/forget.js +35 -0
- package/target/esm/adapters/transport-git/remote/git.js +58 -0
- package/target/esm/adapters/transport-git/remote/heartbeat-facts.js +35 -0
- package/target/esm/adapters/transport-git/remote/heartbeat-name.js +19 -0
- package/target/esm/adapters/transport-git/remote/heartbeat-object.js +40 -0
- package/target/esm/adapters/transport-git/remote/heartbeat-push.js +44 -0
- package/target/esm/adapters/transport-git/remote/heartbeat.js +44 -0
- package/target/esm/adapters/transport-git/remote/keys.js +75 -0
- package/target/esm/adapters/transport-git/remote/main.js +41 -0
- package/target/esm/adapters/transport-git/remote/process.js +37 -0
- package/target/esm/adapters/transport-git/remote/push-retry.js +46 -0
- package/target/esm/adapters/transport-git/remote/push-validate.js +39 -0
- package/target/esm/adapters/transport-git/remote/push.js +62 -0
- package/target/esm/adapters/transport-git/remote/roster.js +48 -0
- package/target/esm/adapters/transport-git/remote/signals.js +63 -0
- package/target/esm/adapters/transport-git/remote/signature.js +56 -0
- package/target/esm/adapters/transport-git/remote/sync-heartbeat.js +26 -0
- package/target/esm/adapters/transport-git/remote/sync-rooms.js +38 -0
- package/target/esm/adapters/transport-git/remote/sync-tags.js +48 -0
- package/target/esm/adapters/transport-git/remote/sync.js +38 -0
- package/target/esm/adapters/transport-git/remote/types.js +10 -0
- package/target/esm/adapters/transport-git/remote.js +17 -0
- package/target/esm/adapters/transport-git/repo.js +115 -0
- package/target/esm/adapters/transport-git/run.js +57 -0
- package/target/esm/adapters/transport-git/signing.js +44 -0
- package/target/esm/adapters/transport-git/tags.js +21 -0
- package/target/esm/adapters/transport-git/transport.js +29 -0
- package/target/esm/adapters/transport-kafka/index.js +4 -0
- package/target/esm/adapters/transport-temporal/index.js +4 -0
- package/target/esm/cli.js +5 -4
- package/target/esm/{cli/agent.js → clients/cli/agent/index.js} +8 -7
- package/target/esm/{cli → clients/cli/agent}/session.js +7 -7
- package/target/esm/clients/cli/arg-parse.js +41 -0
- package/target/esm/{cli → clients/cli}/args.js +3 -36
- package/target/esm/clients/cli/commands.js +45 -0
- package/target/esm/clients/cli/context.js +6 -0
- package/target/esm/{cli/index.js → clients/cli/help.js} +4 -77
- package/target/esm/clients/cli/index.js +27 -0
- package/target/esm/clients/cli/operator/heartbeat-format.js +8 -0
- package/target/esm/clients/cli/operator/heartbeat.js +35 -0
- package/target/esm/clients/cli/operator/hub-commands.js +37 -0
- package/target/esm/clients/cli/operator/hub.js +10 -0
- package/target/esm/clients/cli/operator/index.js +8 -0
- package/target/esm/clients/cli/operator/room-lifecycle.js +23 -0
- package/target/esm/clients/cli/operator/room-list.js +27 -0
- package/target/esm/clients/cli/operator/room-members.js +15 -0
- package/target/esm/clients/cli/operator/room.js +15 -0
- package/target/esm/clients/cli/operator/sessions.js +32 -0
- package/target/esm/clients/cli/operator/watch.js +15 -0
- package/target/esm/clients/cli/operator/where-format.js +24 -0
- package/target/esm/clients/cli/operator/where.js +32 -0
- package/target/esm/clients/cli/shared/budget.js +50 -0
- package/target/esm/clients/cli/shared/files.js +26 -0
- package/target/esm/clients/cli/shared/index.js +10 -0
- package/target/esm/clients/cli/shared/messages.js +41 -0
- package/target/esm/clients/cli/shared/profile.js +17 -0
- package/target/esm/clients/cli/shared/session.js +8 -0
- package/target/esm/clients/cli/shared/signals.js +21 -0
- package/target/esm/clients/cli/shared/work.js +26 -0
- package/target/esm/clients/cli/skill/index.js +40 -0
- package/target/esm/clients/cli/skill/targets.js +20 -0
- package/target/esm/composition/index.js +34 -0
- package/target/esm/{heartbeat → core/agents/heartbeat}/index.js +14 -12
- package/target/esm/{app/heartbeat.js → core/agents/heartbeat/pulse.js} +31 -55
- package/target/esm/core/agents/heartbeat/singleton.js +38 -0
- package/target/esm/core/agents/heartbeat/tools.js +24 -0
- package/target/esm/{app → core/agents}/overview.js +15 -9
- package/target/esm/core/agents/ports/host.js +4 -0
- package/target/esm/core/agents/ports/index.js +7 -0
- package/target/esm/core/agents/ports/tools.js +5 -0
- package/target/esm/{app → core/agents/sessions}/agent.js +11 -43
- package/target/esm/core/agents/sessions/binding.js +43 -0
- package/target/esm/core/agents/sessions/context.js +11 -0
- package/target/esm/core/agents/sessions/index.js +59 -0
- package/target/esm/core/agents/sessions/join.js +55 -0
- package/target/esm/core/agents/sessions/resume.js +54 -0
- package/target/esm/core/agents/sessions/session.js +28 -0
- package/target/esm/core/agents/sessions/wait.js +47 -0
- package/target/esm/core/agents/turns/budgets.js +48 -0
- package/target/esm/core/agents/turns/dispatch.js +40 -0
- package/target/esm/core/agents/turns/exhaustion.js +16 -0
- package/target/esm/core/agents/turns/grants.js +36 -0
- package/target/esm/core/agents/turns/index.js +33 -0
- package/target/esm/core/agents/turns/limits.js +11 -0
- package/target/esm/core/agents/turns/messages.js +32 -0
- package/target/esm/core/agents/turns/pings.js +30 -0
- package/target/esm/core/agents/turns/plan.js +29 -0
- package/target/esm/core/agents/turns/poll.js +48 -0
- package/target/esm/core/agents/turns/results.js +40 -0
- package/target/esm/core/agents/turns/seat.js +44 -0
- package/target/esm/core/agents/turns/types.js +3 -0
- package/target/esm/{domain/index.js → core/hub/capabilities.js} +3 -3
- package/target/esm/core/hub/decisions/budget.js +40 -0
- package/target/esm/core/hub/decisions/check.js +43 -0
- package/target/esm/core/hub/decisions/index.js +10 -0
- package/target/esm/core/hub/decisions/proposal.js +73 -0
- package/target/esm/core/hub/decisions/usage.js +39 -0
- package/target/esm/core/hub/history/index.js +90 -0
- package/target/esm/core/hub/ports/index.js +10 -0
- package/target/esm/core/hub/ports/state.js +5 -0
- package/target/esm/core/hub/ports/store.js +10 -0
- package/target/esm/{protocol → core/hub/protocol}/files.js +4 -2
- package/target/esm/core/hub/protocol/index.js +9 -0
- package/target/esm/core/hub/protocol/model.js +15 -0
- package/target/esm/core/hub/protocol/order.js +39 -0
- package/target/esm/core/hub/protocol/reading.js +29 -0
- package/target/esm/core/hub/protocol/text.js +95 -0
- package/target/esm/core/hub/protocol/threads.js +52 -0
- package/target/esm/core/hub/rooms/compat.js +42 -0
- package/target/esm/core/hub/rooms/hubs.js +92 -0
- package/target/esm/core/hub/rooms/index.js +23 -0
- package/target/esm/core/hub/rooms/messages.js +47 -0
- package/target/esm/core/hub/rooms/rooms.js +84 -0
- package/target/esm/core/hub/signals/check.js +33 -0
- package/target/esm/core/hub/signals/effective.js +31 -0
- package/target/esm/core/hub/signals/index.js +23 -0
- package/target/esm/core/hub/signals/marks.js +30 -0
- package/target/esm/core/hub/signals/model.js +5 -0
- package/target/esm/core/hub/signals/pins.js +21 -0
- package/target/esm/{hub/signals.js → core/hub/signals/write.js} +4 -4
- package/target/esm/core/hub/usecases/actor.js +3 -0
- package/target/esm/core/hub/usecases/budget.js +78 -0
- package/target/esm/core/hub/usecases/config.js +5 -0
- package/target/esm/core/hub/usecases/context.js +13 -0
- package/target/esm/core/hub/usecases/hubs.js +95 -0
- package/target/esm/core/hub/usecases/propose.js +39 -0
- package/target/esm/core/hub/usecases/room.js +82 -0
- package/target/esm/{app → core/hub/usecases}/rooms.js +11 -63
- package/target/esm/core/hub/usecases/roster.js +47 -0
- package/target/esm/core/hub/usecases/send.js +78 -0
- package/target/esm/core/hub/usecases/staging.js +60 -0
- package/target/esm/{app → core/hub/usecases}/view.js +33 -33
- package/target/esm/core/hub/work/index.js +13 -0
- package/target/esm/core/hub/work/parse.js +37 -0
- package/target/esm/core/hub/work/task.js +68 -0
- package/target/esm/core/signing/index.js +4 -0
- package/target/esm/index.js +7 -6
- package/target/esm/lib/fail.js +18 -0
- package/target/esm/lib/index.js +20 -195
- package/target/esm/lib/json.js +81 -0
- package/target/dts/app/agent.d.ts +0 -109
- package/target/dts/app/session.d.ts +0 -65
- package/target/dts/cli/context.d.ts +0 -6
- package/target/dts/cli/operator.d.ts +0 -10
- package/target/dts/cli/shared.d.ts +0 -27
- package/target/dts/domain/decisions.d.ts +0 -65
- package/target/dts/domain/signals.d.ts +0 -37
- package/target/dts/heartbeat/platform.d.ts +0 -15
- package/target/dts/heartbeat/tools.d.ts +0 -11
- package/target/dts/home/index.d.ts +0 -21
- package/target/dts/hub/index.d.ts +0 -72
- package/target/dts/runtime/watch.d.ts +0 -17
- package/target/dts/store/git/index.d.ts +0 -92
- package/target/dts/store/git/remote.d.ts +0 -95
- package/target/dts/store/kafka/index.d.ts +0 -2
- package/target/dts/store/temporal/index.d.ts +0 -2
- package/target/esm/app/budget.js +0 -95
- package/target/esm/app/context.js +0 -16
- package/target/esm/app/hubs.js +0 -76
- package/target/esm/app/room.js +0 -181
- package/target/esm/app/session.js +0 -99
- package/target/esm/cli/context.js +0 -8
- package/target/esm/cli/operator.js +0 -185
- package/target/esm/cli/shared.js +0 -159
- package/target/esm/cli/skill.js +0 -54
- package/target/esm/domain/decisions.js +0 -178
- package/target/esm/domain/profiles.js +0 -96
- package/target/esm/domain/signals.js +0 -134
- package/target/esm/heartbeat/platform.js +0 -83
- package/target/esm/heartbeat/tools.js +0 -68
- package/target/esm/home/index.js +0 -88
- package/target/esm/hub/index.js +0 -224
- package/target/esm/protocol/index.js +0 -219
- package/target/esm/runtime/reader.js +0 -65
- package/target/esm/runtime/session.js +0 -116
- package/target/esm/runtime/watch.js +0 -321
- package/target/esm/store/git/index.js +0 -719
- package/target/esm/store/git/remote.js +0 -928
- package/target/esm/store/index.js +0 -15
- package/target/esm/store/kafka/index.js +0 -3
- package/target/esm/store/temporal/index.js +0 -3
- /package/target/dts/{domain/index.d.ts → core/hub/capabilities.d.ts} +0 -0
- /package/target/dts/{protocol → core/hub/protocol}/files.d.ts +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AuthorityAt } from '../decisions/index.ts';
|
|
2
|
+
import type { Profile } from '../work/index.ts';
|
|
3
|
+
export type RoomModel = {
|
|
4
|
+
name: string;
|
|
5
|
+
genesis: string;
|
|
6
|
+
profile: Profile;
|
|
7
|
+
members: Record<string, unknown>;
|
|
8
|
+
authorityAt: AuthorityAt;
|
|
9
|
+
};
|
|
10
|
+
export type SignalRecord = {
|
|
11
|
+
ref: string;
|
|
12
|
+
object: string;
|
|
13
|
+
name: string;
|
|
14
|
+
actor: string;
|
|
15
|
+
target: string;
|
|
16
|
+
tagger: string;
|
|
17
|
+
text: string;
|
|
18
|
+
};
|
|
19
|
+
export type Checked = {
|
|
20
|
+
ref: string;
|
|
21
|
+
actor: string;
|
|
22
|
+
signal: string;
|
|
23
|
+
target: string;
|
|
24
|
+
ok: boolean;
|
|
25
|
+
why?: string;
|
|
26
|
+
};
|
|
27
|
+
export declare const MARKS: string[];
|
|
28
|
+
export declare const signalName: (id: string, signal: string) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { All, Message } from '../protocol/index.ts';
|
|
2
|
-
import type { Room } from '
|
|
2
|
+
import type { Room } from '../rooms/index.ts';
|
|
3
3
|
export declare const mark: (R: Room, who: string, m: Message, name: string) => boolean;
|
|
4
4
|
export declare const emit: (R: Room, who: string, all: All, m: Message) => number;
|
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
import * as D from '../
|
|
2
|
-
import type { Entry } from '../protocol/files.ts';
|
|
1
|
+
import * as D from '../decisions/index.ts';
|
|
3
2
|
import type { Message } from '../protocol/index.ts';
|
|
4
|
-
import type { Actor } from './
|
|
3
|
+
import type { Actor } from './actor.ts';
|
|
5
4
|
import type { GrantView, ProposalView } from './view.ts';
|
|
6
|
-
export type ProposeInput = {
|
|
7
|
-
text: string;
|
|
8
|
-
decider: string;
|
|
9
|
-
reviewers?: string[];
|
|
10
|
-
budget?: string;
|
|
11
|
-
due?: string;
|
|
12
|
-
supersedes?: string;
|
|
13
|
-
files?: Entry[];
|
|
14
|
-
};
|
|
15
|
-
export declare const propose: ({ R, me }: Actor, x: ProposeInput) => {
|
|
16
|
-
id: string;
|
|
17
|
-
to: string[];
|
|
18
|
-
budget: D.Budget | null;
|
|
19
|
-
};
|
|
20
5
|
export declare const stamp: ({ R, me }: Actor, ref: string, s: string, text: string) => {
|
|
21
6
|
proposal: Message;
|
|
22
7
|
id: string;
|
|
@@ -33,4 +18,6 @@ export declare const proposals: ({ R, me }: Actor, { all: everything }?: {
|
|
|
33
18
|
views: ProposalView[];
|
|
34
19
|
};
|
|
35
20
|
export declare const grants: ({ R, me }: Actor) => GrantView[];
|
|
36
|
-
export {
|
|
21
|
+
export { propose } from './propose.ts';
|
|
22
|
+
export type { ProposeInput } from './propose.ts';
|
|
23
|
+
export { DECISIONS, STAMPS, budgetText } from '../decisions/index.ts';
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { config } from '../
|
|
2
|
-
import type {
|
|
3
|
-
import type { Actor } from './room.ts';
|
|
4
|
-
export type Ctx = Actor & {
|
|
5
|
-
s?: Session;
|
|
6
|
-
};
|
|
1
|
+
import { config } from '../rooms/index.ts';
|
|
2
|
+
import type { Actor } from './actor.ts';
|
|
7
3
|
export declare const operator: ({ hub, room }?: {
|
|
8
4
|
hub?: string;
|
|
9
5
|
room?: string;
|
|
10
|
-
}) =>
|
|
11
|
-
export declare const agent: () => Ctx;
|
|
6
|
+
}) => Actor;
|
|
12
7
|
export declare const about: () => {
|
|
13
8
|
version: string;
|
|
14
9
|
home: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as D from '../decisions/index.ts';
|
|
2
|
+
import type { Entry } from '../protocol/files.ts';
|
|
3
|
+
import type { Actor } from './actor.ts';
|
|
4
|
+
export type ProposeInput = {
|
|
5
|
+
text: string;
|
|
6
|
+
decider: string;
|
|
7
|
+
reviewers?: string[];
|
|
8
|
+
budget?: string;
|
|
9
|
+
due?: string;
|
|
10
|
+
supersedes?: string;
|
|
11
|
+
files?: Entry[];
|
|
12
|
+
};
|
|
13
|
+
export declare const propose: ({ R, me }: Actor, x: ProposeInput) => {
|
|
14
|
+
id: string;
|
|
15
|
+
to: string[];
|
|
16
|
+
budget: D.Budget | null;
|
|
17
|
+
};
|
|
@@ -1,38 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import type { Room } from '../
|
|
4
|
-
import type { Entry } from '../protocol/files.ts';
|
|
1
|
+
import * as Signals from '../signals/index.ts';
|
|
2
|
+
import type { Task } from '../work/index.ts';
|
|
3
|
+
import type { Room } from '../rooms/index.ts';
|
|
5
4
|
import type { All, Message } from '../protocol/index.ts';
|
|
6
|
-
import type {
|
|
5
|
+
import type { Actor } from './actor.ts';
|
|
7
6
|
import type { TaskView } from './view.ts';
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
export declare const isRef: (R: Room) => (x: string) => boolean;
|
|
13
|
-
export type SendInput = {
|
|
14
|
-
text: string;
|
|
15
|
-
to?: string[];
|
|
16
|
-
re?: string;
|
|
17
|
-
reply?: boolean;
|
|
18
|
-
all?: boolean;
|
|
19
|
-
task?: boolean;
|
|
20
|
-
state?: string;
|
|
21
|
-
assign?: string[];
|
|
22
|
-
roles?: string;
|
|
23
|
-
grant?: string;
|
|
24
|
-
files?: Entry[];
|
|
25
|
-
};
|
|
26
|
-
export type Sent = {
|
|
27
|
-
id: string;
|
|
28
|
-
to: string[];
|
|
29
|
-
files: number;
|
|
30
|
-
};
|
|
31
|
-
export declare const FILE_MAX: number;
|
|
32
|
-
export declare const staged: ({ R, me }: Actor) => Staged[];
|
|
33
|
-
export declare const stage: ({ R, me }: Actor, files: Entry[]) => Staged[];
|
|
34
|
-
export declare const unstage: (a: Actor, paths: string[] | null) => Staged[];
|
|
35
|
-
export declare const send: ({ R, me }: Actor, x: SendInput) => Sent;
|
|
7
|
+
export * from './actor.ts';
|
|
8
|
+
export * from './staging.ts';
|
|
9
|
+
export * from './send.ts';
|
|
36
10
|
export declare const marks: (R: Room, all: All) => Map<string, Record<string, string[]>>;
|
|
37
11
|
export declare const message: ({ R, me }: Actor, ref: string) => {
|
|
38
12
|
all: All;
|
|
@@ -77,5 +51,5 @@ export declare const signals: ({ R, me }: Actor, { repair }?: {
|
|
|
77
51
|
alarms: string[];
|
|
78
52
|
repaired: number | null;
|
|
79
53
|
};
|
|
80
|
-
export { withSizes } from '../
|
|
54
|
+
export { withSizes } from '../rooms/index.ts';
|
|
81
55
|
export { checkPath } from '../protocol/files.ts';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { Hub, Room } from '../
|
|
1
|
+
import type { Hub, Room } from '../rooms/index.ts';
|
|
2
|
+
export { admit, forgetLog, remove } from './roster.ts';
|
|
2
3
|
export declare const roomIn: (H: Hub, name?: string | null) => Room;
|
|
3
4
|
export type RoomView = {
|
|
4
5
|
name: string;
|
|
5
6
|
current: boolean;
|
|
6
7
|
archived: boolean;
|
|
7
8
|
members: number;
|
|
8
|
-
active: number;
|
|
9
9
|
profile: string;
|
|
10
10
|
genesis: string;
|
|
11
11
|
};
|
|
@@ -19,10 +19,6 @@ export declare const create: (H: Hub, name: string, { profile, quorum }?: {
|
|
|
19
19
|
profile: string;
|
|
20
20
|
};
|
|
21
21
|
export declare const use: (H: Hub, name: string) => Room;
|
|
22
|
-
export declare const migrate: (H: Hub, name: string) => string;
|
|
23
|
-
export declare const admit: (H: Hub, R: Room, who: string, key: string) => void;
|
|
24
|
-
export declare const remove: (H: Hub, R: Room, who: string) => void;
|
|
25
22
|
export declare const archive: (H: Hub, R: Room) => string;
|
|
26
23
|
export declare const erase: (H: Hub, R: Room) => void;
|
|
27
24
|
export declare const rebase: (H: Hub, R: Room) => void;
|
|
28
|
-
export declare const forgetLog: (H: Hub, R: Room, id: string) => number;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Hub, Room } from '../rooms/index.ts';
|
|
2
|
+
export declare const notSigned: (H: Hub, what: string) => void;
|
|
3
|
+
export declare const admit: (H: Hub, R: Room, who: string, key: string) => void;
|
|
4
|
+
export declare const remove: (H: Hub, R: Room, who: string) => void;
|
|
5
|
+
export declare const forgetLog: (H: Hub, R: Room, id: string) => number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Entry } from '../protocol/files.ts';
|
|
2
|
+
import type { Actor } from './actor.ts';
|
|
3
|
+
export type SendInput = {
|
|
4
|
+
text: string;
|
|
5
|
+
to?: string[];
|
|
6
|
+
re?: string;
|
|
7
|
+
reply?: boolean;
|
|
8
|
+
all?: boolean;
|
|
9
|
+
task?: boolean;
|
|
10
|
+
state?: string;
|
|
11
|
+
assign?: string[];
|
|
12
|
+
roles?: string;
|
|
13
|
+
grant?: string;
|
|
14
|
+
files?: Entry[];
|
|
15
|
+
};
|
|
16
|
+
export type Sent = {
|
|
17
|
+
id: string;
|
|
18
|
+
to: string[];
|
|
19
|
+
files: number;
|
|
20
|
+
};
|
|
21
|
+
export declare const send: ({ R, me }: Actor, x: SendInput) => Sent;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Entry } from '../protocol/files.ts';
|
|
2
|
+
import type { Staged } from '../history/index.ts';
|
|
3
|
+
import type { Actor } from './actor.ts';
|
|
4
|
+
export declare const staged: ({ R, me }: Actor) => Staged[];
|
|
5
|
+
export declare const stage: ({ R, me }: Actor, files: Entry[]) => Staged[];
|
|
6
|
+
export declare const shrink: ({ R, me }: Actor, keep: (s: Staged) => boolean) => Staged[];
|
|
7
|
+
export declare const unstage: (a: Actor, paths: string[] | null) => Staged[];
|
|
8
|
+
export declare const outgoing: (stagedNow: Staged[], explicit: Entry[]) => Entry[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Budget, Proposal, Usage } from '../
|
|
2
|
-
import type { Task } from '../
|
|
1
|
+
import type { Budget, Proposal, Usage } from '../decisions/index.ts';
|
|
2
|
+
import type { Task } from '../work/index.ts';
|
|
3
3
|
import type { All, FileRef, Message } from '../protocol/index.ts';
|
|
4
4
|
export declare const render: (all: All, m: Message, { max, files }?: {
|
|
5
5
|
max?: number;
|
|
@@ -26,8 +26,8 @@ export declare const asJson: (m: Message) => {
|
|
|
26
26
|
path: string;
|
|
27
27
|
size: number | null;
|
|
28
28
|
}[];
|
|
29
|
-
refused: import("../protocol/
|
|
30
|
-
trailers: import("../protocol/
|
|
29
|
+
refused: import("../protocol/model.ts").Refused[];
|
|
30
|
+
trailers: import("../protocol/model.ts").Trailers;
|
|
31
31
|
};
|
|
32
32
|
export type TaskView = {
|
|
33
33
|
id: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Message } from '../protocol/index.ts';
|
|
2
2
|
export declare const PROFILE_SCHEMA = "ringi-profile/1";
|
|
3
3
|
export declare const DEFAULT_PROFILE = "a2a-1";
|
|
4
4
|
export declare const PROFILES_CAPABILITY = "profiles/1";
|
|
@@ -31,9 +31,5 @@ export type Task = {
|
|
|
31
31
|
grant: string | null;
|
|
32
32
|
effects: Map<string, string[]>;
|
|
33
33
|
};
|
|
34
|
-
export
|
|
35
|
-
export
|
|
36
|
-
export declare const taskFor: (all: All, m: Message, profile: Profile) => Message | null;
|
|
37
|
-
export declare const taskOf: (all: All, root: Message, profile: Profile) => Task;
|
|
38
|
-
export declare const tasksIn: (all: All, profile: Profile) => Task[];
|
|
39
|
-
export declare const isOpen: (t: Task, profile: Profile) => boolean;
|
|
34
|
+
export * from './parse.ts';
|
|
35
|
+
export * from './task.ts';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { All, Message } from '../protocol/index.ts';
|
|
2
|
+
import type { Profile, Task } from './index.ts';
|
|
3
|
+
export declare const taskFor: (all: All, m: Message, profile: Profile) => Message | null;
|
|
4
|
+
export declare const taskOf: (all: All, root: Message, profile: Profile) => Task;
|
|
5
|
+
export declare const tasksIn: (all: All, profile: Profile) => Task[];
|
|
6
|
+
export declare const isOpen: (t: Task, profile: Profile) => boolean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare const key: unique symbol;
|
|
2
|
+
export type KeyRef = string & {
|
|
3
|
+
readonly [key]: true;
|
|
4
|
+
};
|
|
5
|
+
export type PublicIdentity = {
|
|
6
|
+
key: string;
|
|
7
|
+
fingerprint: string;
|
|
8
|
+
};
|
|
9
|
+
export type SignRequest = {
|
|
10
|
+
key: KeyRef;
|
|
11
|
+
payload: Uint8Array;
|
|
12
|
+
namespace: string;
|
|
13
|
+
interaction: 'allowed' | 'forbidden';
|
|
14
|
+
deadline: number;
|
|
15
|
+
};
|
|
16
|
+
export type Signature = {
|
|
17
|
+
format: string;
|
|
18
|
+
bytes: Uint8Array;
|
|
19
|
+
fingerprint: string;
|
|
20
|
+
namespace: string;
|
|
21
|
+
};
|
|
22
|
+
export type SigningReason = 'unavailable' | 'denied' | 'interaction-required' | 'timeout';
|
|
23
|
+
export type SigningFault = Error & {
|
|
24
|
+
reason: SigningReason;
|
|
25
|
+
};
|
|
26
|
+
export interface Signer {
|
|
27
|
+
publicIdentity(key: KeyRef): PublicIdentity;
|
|
28
|
+
sign(request: SignRequest): Signature;
|
|
29
|
+
}
|
|
30
|
+
export type SigningContext = {
|
|
31
|
+
signer: Signer;
|
|
32
|
+
resolve(hub: string, principal: string, create?: boolean): KeyRef;
|
|
33
|
+
custody?(hub: string, principal: string): string | null;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
package/target/dts/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export * from './
|
|
3
|
-
export *
|
|
4
|
-
export * as
|
|
5
|
-
export
|
|
6
|
-
export {
|
|
7
|
-
export { openHub, openRoom, createHub, contractAt } from './hub/index.ts';
|
|
8
|
-
export type { Hub, Room, Contract } from './hub/index.ts';
|
|
1
|
+
import './composition/index.ts';
|
|
2
|
+
export * from './core/hub/protocol/index.ts';
|
|
3
|
+
export * from './core/hub/work/index.ts';
|
|
4
|
+
export * as decide from './core/hub/decisions/index.ts';
|
|
5
|
+
export * as signals from './core/hub/signals/index.ts';
|
|
6
|
+
export type { Store, Transport, Descriptor, StoredRoom, StoredMessage, SignalRecord, Rev } from './core/hub/ports/store.ts';
|
|
7
|
+
export { openHub, openRoom, createHub, contractAt } from './core/hub/rooms/index.ts';
|
|
8
|
+
export type { Hub, Room, Contract } from './core/hub/rooms/index.ts';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class Fail extends Error {
|
|
2
|
+
}
|
|
3
|
+
export declare const fail: (msg: string) => never;
|
|
4
|
+
export declare const errno: (e: unknown) => string | undefined;
|
|
5
|
+
export declare class WriteDenied extends Fail {
|
|
6
|
+
readonly where: string;
|
|
7
|
+
constructor(where: string, detail: string);
|
|
8
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
}
|
|
3
|
-
export declare const fail: (msg: string) => never;
|
|
1
|
+
export declare const notesTo: (fn: (line: string) => void) => void;
|
|
4
2
|
export declare const note: (s: string) => void;
|
|
5
3
|
export declare const sleep: (ms: number) => Promise<void>;
|
|
6
4
|
export declare const when: (t: number) => string;
|
|
@@ -8,11 +6,5 @@ export declare const bytes: (n: number) => string;
|
|
|
8
6
|
export declare const short: (id: string) => string;
|
|
9
7
|
export declare const stamp: () => string;
|
|
10
8
|
export declare const words: (v: unknown) => string[];
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export declare const strictJson: <T = unknown>(text: string, label?: string) => T;
|
|
14
|
-
export declare const locked: <T>(file: string, fn: () => T, timeout?: number) => T;
|
|
15
|
-
export declare const SANDBOX: RegExp;
|
|
16
|
-
export declare const cannotWrite: (where: string, detail: string) => never;
|
|
17
|
-
export declare const guardWrite: <T>(where: string, fn: () => T) => T;
|
|
18
|
-
export declare const mkdirIn: (where: string, d: string) => void;
|
|
9
|
+
export * from './fail.ts';
|
|
10
|
+
export * from './json.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const strictJson: <T = unknown>(text: string, label?: string) => T;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// fs: files and locks for the adapters that keep state on this machine: the inter-process lock (lock.ts), writes a
|
|
2
|
+
// sandbox may refuse and JSON written in one step (write.ts).
|
|
3
|
+
export * from './lock.js';
|
|
4
|
+
export * from './write.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// lock: the inter-process lock.
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import { errno, fail } from '../../lib/fail.js';
|
|
4
|
+
// A lock is a file holding its owner (pid and a random token), created by hard-linking a file already written: it
|
|
5
|
+
// never exists without its owner and never replaces another lock. All acquisitions and the recovery of a dead
|
|
6
|
+
// owner's lock pass one gate, so two contenders cannot both clear a lock just taken by a third. A lock is taken from
|
|
7
|
+
// someone else only when that owner's process is gone, never by age; an unreadable owner is never taken over; only
|
|
8
|
+
// the owner releases it. A gate abandoned by a dead process needs the operator: recovering the recoverer would need
|
|
9
|
+
// yet another gate.
|
|
10
|
+
const ownerAlive = (pid) => {
|
|
11
|
+
try {
|
|
12
|
+
process.kill(pid, 0);
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
return errno(e) !== 'ESRCH';
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const ownerOf = (f) => {
|
|
20
|
+
try {
|
|
21
|
+
return fs.readFileSync(f, 'utf8');
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const deadOwner = (t) => {
|
|
28
|
+
const pid = Number(String(t ?? '').split('.')[0]);
|
|
29
|
+
return Number.isInteger(pid) && pid > 0 && !ownerAlive(pid);
|
|
30
|
+
};
|
|
31
|
+
const claim = (f, token) => {
|
|
32
|
+
const tmp = `${f}.${token}.tmp`;
|
|
33
|
+
fs.writeFileSync(tmp, token, { flag: 'wx', mode: 0o600 });
|
|
34
|
+
try {
|
|
35
|
+
fs.linkSync(tmp, f);
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
if (errno(e) === 'EEXIST')
|
|
40
|
+
return false;
|
|
41
|
+
throw e;
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
fs.rmSync(tmp, { force: true });
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const release = (f, token) => {
|
|
48
|
+
if (ownerOf(f) === token)
|
|
49
|
+
fs.rmSync(f, { force: true });
|
|
50
|
+
};
|
|
51
|
+
const lockWait = new Int32Array(new SharedArrayBuffer(4));
|
|
52
|
+
// One try through the gate: clear a dead owner's lock, then claim it.
|
|
53
|
+
const attempt = (file, gate, token) => {
|
|
54
|
+
if (!claim(gate, token)) {
|
|
55
|
+
if (deadOwner(ownerOf(gate)))
|
|
56
|
+
fail(`${gate} was abandoned; if no ringi process runs, remove it`);
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
if (deadOwner(ownerOf(file)))
|
|
61
|
+
fs.rmSync(file, { force: true });
|
|
62
|
+
return claim(file, token);
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
release(gate, token);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
export const locked = (file, fn, timeout = 120000) => {
|
|
69
|
+
const token = `${process.pid}.${Math.random().toString(36).slice(2)}`;
|
|
70
|
+
const until = Date.now() + timeout;
|
|
71
|
+
while (!attempt(file, `${file}.recover`, token)) {
|
|
72
|
+
if (Date.now() >= until)
|
|
73
|
+
fail(`${file} is held by another process or an unknown owner; if no ringi process runs, remove it`);
|
|
74
|
+
Atomics.wait(lockWait, 0, 0, 25);
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
return fn();
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
release(file, token);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=lock.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// write: writing where a sandbox may refuse, with the one message that says what to do.
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import { Fail, WriteDenied, errno } from '../../lib/fail.js';
|
|
4
|
+
export const SANDBOX = /Operation not permitted|Permission denied|Read-only file system|EPERM|EACCES|EROFS/;
|
|
5
|
+
export const cannotWrite = (where, detail) => { throw new WriteDenied(where, detail); };
|
|
6
|
+
export const guardWrite = (where, fn) => {
|
|
7
|
+
try {
|
|
8
|
+
return fn();
|
|
9
|
+
}
|
|
10
|
+
catch (e) {
|
|
11
|
+
if (e instanceof Fail)
|
|
12
|
+
throw e;
|
|
13
|
+
if (['EPERM', 'EACCES', 'EROFS'].includes(errno(e) ?? ''))
|
|
14
|
+
cannotWrite(where, `${errno(e)} on ${e.path ?? 'a file'}`);
|
|
15
|
+
throw e;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export const mkdirIn = (where, d) => { guardWrite(where, () => fs.mkdirSync(d, { recursive: true, mode: 0o700 })); };
|
|
19
|
+
// A JSON file replaced in one step: a reader sees the old file or the new one.
|
|
20
|
+
export const writeJsonAtomic = (file, v) => {
|
|
21
|
+
const tmp = `${file}.${process.pid}`;
|
|
22
|
+
fs.writeFileSync(tmp, JSON.stringify(v, null, 2));
|
|
23
|
+
fs.renameSync(tmp, file);
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=write.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// group-state: process-group membership and whether its observed members have finished; only Z is a zombie.
|
|
2
|
+
export const procMember = (text) => {
|
|
3
|
+
const close = text.lastIndexOf(')');
|
|
4
|
+
if (!/^\d+ \(/.test(text) || close < 0)
|
|
5
|
+
return null;
|
|
6
|
+
const fields = text.slice(close + 1).trim().split(/\s+/);
|
|
7
|
+
const group = Number(fields[2]), state = fields[0];
|
|
8
|
+
return /^[A-Za-z]$/.test(state) && Number.isSafeInteger(group) && group >= 0 ? { group, state } : null;
|
|
9
|
+
};
|
|
10
|
+
export const psMember = (text) => {
|
|
11
|
+
const match = /^\s*(\d+)\s+([A-Za-z][^\s]*)\s*$/.exec(text);
|
|
12
|
+
if (!match)
|
|
13
|
+
return null;
|
|
14
|
+
const group = Number(match[1]);
|
|
15
|
+
return Number.isSafeInteger(group) ? { group, state: match[2][0] } : null;
|
|
16
|
+
};
|
|
17
|
+
// No matching row, or an unreadable row that might belong to this group, cannot prove it is quiescent.
|
|
18
|
+
export const groupRunning = (group, members) => {
|
|
19
|
+
const own = members.filter(m => m?.group === group);
|
|
20
|
+
if (own.some(m => m.state !== 'Z'))
|
|
21
|
+
return true;
|
|
22
|
+
return own.length && members.every(m => m !== null) ? false : null;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=group-state.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// groups: a turn's POSIX group is settled once every observed member is a zombie; failed probes stay conservative.
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import { spawnSync } from 'node:child_process';
|
|
4
|
+
import { groupRunning, procMember, psMember } from './group-state.js';
|
|
5
|
+
const exists = (group) => {
|
|
6
|
+
try {
|
|
7
|
+
process.kill(-group, 0);
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
catch (e) {
|
|
11
|
+
return e.code !== 'ESRCH';
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const procMembers = () => {
|
|
15
|
+
try {
|
|
16
|
+
return fs.readdirSync('/proc').filter(p => /^\d+$/.test(p)).flatMap(pid => {
|
|
17
|
+
try {
|
|
18
|
+
return [procMember(fs.readFileSync(`/proc/${pid}/stat`, 'utf8'))];
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
return e.code === 'ENOENT' || e.code === 'ESRCH' ? [] : [null];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const psMembers = () => {
|
|
30
|
+
const result = spawnSync('ps', ['-A', '-o', 'pgid=,stat='], { encoding: 'utf8', timeout: 1000 });
|
|
31
|
+
return result.status === 0 ? result.stdout.split('\n').filter(line => line.trim()).map(psMember) : null;
|
|
32
|
+
};
|
|
33
|
+
export const groupAlive = (group) => {
|
|
34
|
+
if (!exists(group))
|
|
35
|
+
return false;
|
|
36
|
+
const proc = process.platform === 'linux' ? procMembers() : null;
|
|
37
|
+
const known = proc && groupRunning(group, proc);
|
|
38
|
+
if (known !== null)
|
|
39
|
+
return known;
|
|
40
|
+
const rows = psMembers(), observed = rows && groupRunning(group, rows);
|
|
41
|
+
return observed ?? exists(group);
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=groups.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// host-posix: macOS/Linux process facts and launch control behind ProcessHost (core/agents/ports/host.ts). Its handles belong
|
|
2
|
+
// only to this instance. A bounded observation never grants authority to stop an otherwise running process.
|
|
3
|
+
import { fail } from '../../lib/fail.js';
|
|
4
|
+
import { treeCpu } from './stats.js';
|
|
5
|
+
import { launch } from './launch.js';
|
|
6
|
+
import { alive, ancestors, snapshot, supported } from './probes.js';
|
|
7
|
+
const systemClock = { wall: () => Date.now(), monotonic: () => performance.now() };
|
|
8
|
+
const observe = (done, deadline, clock) => {
|
|
9
|
+
if (deadline !== undefined && !Number.isFinite(deadline))
|
|
10
|
+
fail('a process observation deadline must be finite');
|
|
11
|
+
const held = setInterval(() => { }, 1000);
|
|
12
|
+
if (deadline === undefined)
|
|
13
|
+
return done.finally(() => clearInterval(held));
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
const timer = setTimeout(() => { clearInterval(held); resolve(null); }, Math.max(0, deadline - clock.monotonic()));
|
|
16
|
+
const clear = () => { clearTimeout(timer); clearInterval(held); };
|
|
17
|
+
done.then(value => { clear(); resolve(value); }, error => { clear(); reject(error); });
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
export const hostPosix = (clock = systemClock) => {
|
|
21
|
+
const processes = new WeakMap();
|
|
22
|
+
const own = (handle) => processes.get(handle) ?? fail('this process handle belongs to another host');
|
|
23
|
+
return {
|
|
24
|
+
supported, clock, alive, ancestors, snapshot,
|
|
25
|
+
inspect: (pid, rows = snapshot()) => ({ alive: supported ? alive(pid) : null, cpu: treeCpu(pid, rows) }),
|
|
26
|
+
start: request => {
|
|
27
|
+
const handle = {};
|
|
28
|
+
processes.set(handle, launch(request, clock));
|
|
29
|
+
return handle;
|
|
30
|
+
},
|
|
31
|
+
stop: handle => own(handle).stop(),
|
|
32
|
+
awaitQuiescence: (handle, deadline) => observe(own(handle).done, deadline, clock),
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=index.js.map
|