@idleware/ringi 0.5.0 → 0.6.1
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 +51 -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
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
//
|
|
2
|
-
import * as Heartbeat from '
|
|
3
|
-
import * as Session from '
|
|
4
|
-
import { fail } from '
|
|
5
|
-
import { opt, out } from '
|
|
6
|
-
import { showInbox } from './
|
|
7
|
-
import { scopeLine, taskLine, waiting } from '
|
|
1
|
+
// session: what the operator says in an agent's chat (join, continue, stop, leave) becomes the session's requests.
|
|
2
|
+
import * as Heartbeat from '../../../core/agents/heartbeat/pulse.js';
|
|
3
|
+
import * as Session from '../../../core/agents/sessions/session.js';
|
|
4
|
+
import { fail } from '../../../lib/index.js';
|
|
5
|
+
import { opt, out } from '../args.js';
|
|
6
|
+
import { showInbox } from './index.js';
|
|
7
|
+
import { scopeLine, taskLine, waiting } from '../shared/index.js';
|
|
8
8
|
export const briefing = (s) => {
|
|
9
9
|
const r = Session.briefing(s);
|
|
10
10
|
const auto = r.start.quorum !== null;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Parse one option at a time, keeping positional arguments and repeated values in order.
|
|
2
|
+
import { fail } from '../../lib/index.js';
|
|
3
|
+
const BOOLS = new Set(['task', 'peek', 'all', 'json', 'help', 'once', 'project', 'follow', 'short', 'yes', 'require-grant', 'md', 'archived', 'signed', 'repair', 'handoff', 'clear', 'published']);
|
|
4
|
+
const MULTI = new Set(['m', 'attach', 'set', 'drop']);
|
|
5
|
+
const SHORT = { m: 'm', F: 'file', n: 'n', o: 'out', h: 'help' };
|
|
6
|
+
const option = (a) => {
|
|
7
|
+
if (a.startsWith('--')) {
|
|
8
|
+
const [key, val] = a.slice(2).split(/=(.*)/s);
|
|
9
|
+
return { key, val };
|
|
10
|
+
}
|
|
11
|
+
if (/^-[a-zA-Z]$/.test(a))
|
|
12
|
+
return { key: SHORT[a[1]] ?? fail(`unknown option ${a}`) };
|
|
13
|
+
return null;
|
|
14
|
+
};
|
|
15
|
+
const consume = (argv, o, i) => {
|
|
16
|
+
const parsed = option(argv[i]);
|
|
17
|
+
if (!parsed) {
|
|
18
|
+
o._.push(argv[i]);
|
|
19
|
+
return 1;
|
|
20
|
+
}
|
|
21
|
+
const { key, val } = parsed;
|
|
22
|
+
if (BOOLS.has(key)) {
|
|
23
|
+
o[key] = true;
|
|
24
|
+
return 1;
|
|
25
|
+
}
|
|
26
|
+
const value = val ?? argv[i + 1] ?? fail(`--${key} needs a value`);
|
|
27
|
+
o[key] = MULTI.has(key) ? [...(o[key] ?? []), value] : value;
|
|
28
|
+
return val === undefined ? 2 : 1;
|
|
29
|
+
};
|
|
30
|
+
export const parseArgs = (argv) => {
|
|
31
|
+
const o = { _: [] };
|
|
32
|
+
for (let i = 0; i < argv.length;) {
|
|
33
|
+
if (argv[i] === '--') {
|
|
34
|
+
o._.push(...argv.slice(i + 1));
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
i += consume(argv, o, i);
|
|
38
|
+
}
|
|
39
|
+
return o;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=arg-parse.js.map
|
|
@@ -1,44 +1,11 @@
|
|
|
1
1
|
// args: the command line: options, message text, files to attach, and printing to stdout.
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { checkPath } from '../../core/hub/usecases/room.js';
|
|
5
|
+
import { fail } from '../../lib/index.js';
|
|
6
6
|
export const out = (s = '') => { process.stdout.write(s.endsWith('\n') ? s : `${s}\n`); };
|
|
7
7
|
export const dump = (v) => out(JSON.stringify(v, null, 2));
|
|
8
|
-
|
|
9
|
-
const MULTI = new Set(['m', 'attach', 'set', 'drop']);
|
|
10
|
-
const SHORT = { m: 'm', F: 'file', n: 'n', o: 'out', h: 'help' };
|
|
11
|
-
export const parseArgs = (argv) => {
|
|
12
|
-
const o = { _: [] };
|
|
13
|
-
for (let i = 0; i < argv.length; i++) {
|
|
14
|
-
const a = argv[i];
|
|
15
|
-
let key;
|
|
16
|
-
let val;
|
|
17
|
-
if (a === '--') {
|
|
18
|
-
o._.push(...argv.slice(i + 1));
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
if (a.startsWith('--'))
|
|
22
|
-
[key, val] = a.slice(2).split(/=(.*)/s);
|
|
23
|
-
else if (/^-[a-zA-Z]$/.test(a))
|
|
24
|
-
key = SHORT[a[1]] ?? fail(`unknown option ${a}`);
|
|
25
|
-
else {
|
|
26
|
-
o._.push(a);
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
if (BOOLS.has(key)) {
|
|
30
|
-
o[key] = true;
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
if (val === undefined)
|
|
34
|
-
val = argv[++i] ?? fail(`--${key} needs a value`);
|
|
35
|
-
if (MULTI.has(key))
|
|
36
|
-
o[key] = [...(o[key] ?? []), val];
|
|
37
|
-
else
|
|
38
|
-
o[key] = val;
|
|
39
|
-
}
|
|
40
|
-
return o;
|
|
41
|
-
};
|
|
8
|
+
export { parseArgs } from './arg-parse.js';
|
|
42
9
|
export const opt = (o, key) => typeof o[key] === 'string' ? o[key] : undefined;
|
|
43
10
|
export const list = (o, key) => Array.isArray(o[key]) ? o[key] : [];
|
|
44
11
|
export const flag = (o, key) => o[key] === true;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// commands: one table for the one command line: the operator's commands (operator/), `ringi agent …` for an agent
|
|
2
|
+
// (agent/), and the shared ones (shared/) under both; aliases kept together.
|
|
3
|
+
import { about } from '../../core/hub/usecases/context.js';
|
|
4
|
+
import { agent } from '../../core/agents/sessions/context.js';
|
|
5
|
+
import { fail } from '../../lib/index.js';
|
|
6
|
+
import { card, inbox, ping, take, wait, whoami } from './agent/index.js';
|
|
7
|
+
import { flag, out, parseArgs } from './args.js';
|
|
8
|
+
import { operatorCtx } from './context.js';
|
|
9
|
+
import { helpMarkdown, helpText } from './help.js';
|
|
10
|
+
import { forget, heartbeats, hub, pulse, roomCmd, sessions, where } from './operator/index.js';
|
|
11
|
+
import { join, leave, resume, stop } from './agent/session.js';
|
|
12
|
+
import { add, cat, decide, get, grants, log, profileCmd, proposals, propose, read, reply, send, signals, stamp_, tasks, thread, who } from './shared/index.js';
|
|
13
|
+
import { skill } from './skill/index.js';
|
|
14
|
+
import { watchCommand } from './operator/watch.js';
|
|
15
|
+
const SHARED = { add, send, reply, read, thread, tasks, log, cat, get, who, signals, profile: profileCmd, propose, stamp: stamp_, decide, proposals, grants };
|
|
16
|
+
const AGENT = { ...SHARED, inbox, whoami, status: whoami, card, ping, wait, take };
|
|
17
|
+
const agentCommand = (_, rest) => {
|
|
18
|
+
const [sub = 'whoami', ...more] = rest;
|
|
19
|
+
const fn = AGENT[sub] ?? fail(`unknown: ringi agent ${sub}; see ringi help`);
|
|
20
|
+
return fn(agent(), parseArgs(more));
|
|
21
|
+
};
|
|
22
|
+
const version = () => {
|
|
23
|
+
const b = about();
|
|
24
|
+
out(`ringi ${b.version}; hub contract ${b.contract}; capabilities ${b.capabilities.join(' ')}`);
|
|
25
|
+
};
|
|
26
|
+
const help = (o) => flag(o, 'md') ? void process.stdout.write(helpMarkdown()) : out(helpText());
|
|
27
|
+
const DIRECT = new Map([
|
|
28
|
+
['--version', version], ['-v', version], ['version', version],
|
|
29
|
+
['help', help], ['--help', help], ['-h', help], ['skill', skill], ['agent', agentCommand],
|
|
30
|
+
['hub', hub], ['room', roomCmd], ['where', where], ['sessions', sessions], ['heartbeats', heartbeats],
|
|
31
|
+
['pulse', pulse], ['forget', forget], ['watch', watchCommand], ['join', join], ['continue', resume], ['stop', stop], ['leave', leave]
|
|
32
|
+
]);
|
|
33
|
+
const unknown = (cmd) => {
|
|
34
|
+
if (['inbox', 'whoami', 'ping', 'wait', 'card'].includes(cmd))
|
|
35
|
+
fail(`${cmd} is an agent command: ringi agent ${cmd}`);
|
|
36
|
+
return fail(`unknown command ${cmd}; see ringi help`);
|
|
37
|
+
};
|
|
38
|
+
export const dispatch = (cmd, o, rest) => {
|
|
39
|
+
const direct = DIRECT.get(cmd);
|
|
40
|
+
if (direct)
|
|
41
|
+
return direct(o, rest);
|
|
42
|
+
const shared = SHARED[cmd] ?? unknown(cmd);
|
|
43
|
+
return shared(operatorCtx(o), o);
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// context: who runs a command and in which room, from the command line.
|
|
2
|
+
import * as Context from '../../core/hub/usecases/context.js';
|
|
3
|
+
import { opt } from './args.js';
|
|
4
|
+
export { isRef } from '../../core/hub/usecases/room.js';
|
|
5
|
+
export const operatorCtx = (o) => Context.operator({ hub: opt(o, 'hub'), room: opt(o, 'room') });
|
|
6
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
import { about, agent } from '../app/context.js';
|
|
4
|
-
import { fail, words } from '../lib/index.js';
|
|
5
|
-
import { flag, opt, out, parseArgs } from './args.js';
|
|
6
|
-
import { watch } from '../app/agent.js';
|
|
7
|
-
import { card, inbox, ping, take, wait, whoami } from './agent.js';
|
|
8
|
-
import { operatorCtx } from './context.js';
|
|
9
|
-
import { forget, heartbeats, hub, pulse, roomCmd, sessions, where } from './operator.js';
|
|
10
|
-
import { join, leave, resume, stop } from './session.js';
|
|
11
|
-
import { add, cat, decide, get, grants, log, profileCmd, proposals, propose, read, reply, send, signals, stamp_, tasks, thread, who } from './shared.js';
|
|
12
|
-
import { skill } from './skill.js';
|
|
1
|
+
// help: the command table — every command, who runs it and what it does — as text, and as COMMANDS.md.
|
|
2
|
+
import { about } from '../../core/hub/usecases/context.js';
|
|
13
3
|
// --- commands ---
|
|
14
4
|
// [command, who runs it, what it does]: the one table behind `ringi help` and COMMANDS.md.
|
|
15
5
|
export const TABLE = [
|
|
@@ -20,7 +10,6 @@ export const TABLE = [
|
|
|
20
10
|
['hub amend -m <subject> [--set <key>=<value>]... [--authority <file>] [--attach <file>:profiles/<name>.json]...', 'operator', 'refine the shared contract: version, capabilities, default profile, authority table, profiles'],
|
|
21
11
|
['room list [--archived]', 'operator', 'rooms of the current hub'],
|
|
22
12
|
['room create <id> [--profile <name>] [--quorum <agents>]', 'operator', 'a room for one piece of work, following a profile; becomes the current room; --quorum: its work starts by itself once that many agents joined (1: at once)'],
|
|
23
|
-
['room migrate <id>', 'operator', 'local hubs: join the old room branches without changing message ids or sessions'],
|
|
24
13
|
['room switch <id>', 'operator', 'change the terminal\'s current room; agents stay where they are'],
|
|
25
14
|
['room admit <agent> <public key|file>', 'operator', 'signed hubs: admit the key an agent made on its own machine'],
|
|
26
15
|
['room remove <agent>', 'operator', 'local hubs: take an agent out of the current room'],
|
|
@@ -55,7 +44,7 @@ export const TABLE = [
|
|
|
55
44
|
['agent tasks | log | read | thread | cat | get | who | signals | profile', 'agent', 'reading, as the joined agent'],
|
|
56
45
|
['agent ping <id> [-m <note>] [--next <s>] | agent wait [--max <s>] | agent card -m <text>', 'agent', 'heartbeats; hold the line only when the operator asks; who you are'],
|
|
57
46
|
];
|
|
58
|
-
const helpText = () => {
|
|
47
|
+
export const helpText = () => {
|
|
59
48
|
const groups = [['operator', 'operator: in a terminal, in the current hub and room'], ['session', 'session: in a chat, on the operator\'s words'], ['agent', 'agent: during a turn, in the session\'s own room'], ['both', 'operator in a terminal, or an agent as ringi agent …']];
|
|
60
49
|
const width = 56;
|
|
61
50
|
const line = ([cmd, , what]) => cmd.length > width ? ` ringi ${cmd}\n ${' '.repeat(width + 6)} ${what}` : ` ringi ${cmd.padEnd(width)} ${what}`;
|
|
@@ -68,66 +57,4 @@ export const helpMarkdown = () => ['# ringi commands', '',
|
|
|
68
57
|
'| command | who | what |', '|---|---|---|',
|
|
69
58
|
...TABLE.map(([cmd, w, what]) => `| \`ringi ${cmd.replace(/\|/g, '\\|')}\` | ${w} | ${what} |`), '',
|
|
70
59
|
'Message ids are store revisions (git: commit shas), any unique prefix of 4+ characters. States and roles come from the room\'s profile (`ringi profile`).', ''].join('\n');
|
|
71
|
-
|
|
72
|
-
const AGENT = { ...SHARED, inbox, whoami, status: whoami, card, ping, wait, take };
|
|
73
|
-
// A reader that stops early (`ringi log | head`) closes the pipe: that ends the output, not the command's work.
|
|
74
|
-
const quietPipe = (e) => { if (e.code === 'EPIPE')
|
|
75
|
-
process.exit(process.exitCode ?? 0);
|
|
76
|
-
else
|
|
77
|
-
throw e; };
|
|
78
|
-
export const main = async (argv = process.argv.slice(2)) => {
|
|
79
|
-
if (!process.stdout.listeners('error').includes(quietPipe))
|
|
80
|
-
process.stdout.on('error', quietPipe);
|
|
81
|
-
const [cmd = 'help', ...rest] = argv;
|
|
82
|
-
const o = cmd === 'agent' ? { _: [] } : parseArgs(rest);
|
|
83
|
-
if (['--version', '-v', 'version'].includes(cmd)) {
|
|
84
|
-
const b = about();
|
|
85
|
-
return out(`ringi ${b.version}; hub contract ${b.contract}; capabilities ${b.capabilities.join(' ')}`);
|
|
86
|
-
}
|
|
87
|
-
if (['help', '--help', '-h'].includes(cmd))
|
|
88
|
-
return flag(o, 'md') ? void process.stdout.write(helpMarkdown()) : out(helpText());
|
|
89
|
-
if (cmd === 'skill')
|
|
90
|
-
return skill(o);
|
|
91
|
-
if (cmd === 'agent') {
|
|
92
|
-
const [sub = 'whoami', ...more] = rest;
|
|
93
|
-
const fn = AGENT[sub] ?? fail(`unknown: ringi agent ${sub}; see ringi help`);
|
|
94
|
-
return fn(agent(), parseArgs(more));
|
|
95
|
-
}
|
|
96
|
-
if (cmd === 'hub')
|
|
97
|
-
return hub(o);
|
|
98
|
-
if (cmd === 'room')
|
|
99
|
-
return roomCmd(o);
|
|
100
|
-
if (cmd === 'where')
|
|
101
|
-
return where(o);
|
|
102
|
-
if (cmd === 'sessions')
|
|
103
|
-
return sessions(o);
|
|
104
|
-
if (cmd === 'heartbeats')
|
|
105
|
-
return heartbeats(o);
|
|
106
|
-
if (cmd === 'pulse')
|
|
107
|
-
return pulse(o);
|
|
108
|
-
if (cmd === 'forget')
|
|
109
|
-
return forget(o);
|
|
110
|
-
if (cmd === 'watch') {
|
|
111
|
-
const num = (k) => opt(o, k) === undefined ? undefined : Number(opt(o, k));
|
|
112
|
-
process.exitCode = await watch({ seat: o._[0] ?? fail('usage: ringi watch <room>/<agent> --exec <cmd> [--scope <text>] [--once] [--require-grant] …'),
|
|
113
|
-
exec: opt(o, 'exec') ?? fail('--exec <cmd> is required: the command that starts a headless turn'),
|
|
114
|
-
hub: opt(o, 'hub'), scope: opt(o, 'scope'), once: flag(o, 'once'), requireGrant: flag(o, 'require-grant'), handoff: flag(o, 'handoff'),
|
|
115
|
-
interval: num('interval'), from: opt(o, 'from') ? words(opt(o, 'from')) : undefined, maxHop: num('max-hop'),
|
|
116
|
-
maxRuns: num('max-runs'), window: num('window') }, out);
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (cmd === 'join')
|
|
120
|
-
return join(o);
|
|
121
|
-
if (cmd === 'continue')
|
|
122
|
-
return resume(o);
|
|
123
|
-
if (cmd === 'stop')
|
|
124
|
-
return stop();
|
|
125
|
-
if (cmd === 'leave')
|
|
126
|
-
return leave();
|
|
127
|
-
if (SHARED[cmd])
|
|
128
|
-
return SHARED[cmd](operatorCtx(o), o);
|
|
129
|
-
if (['inbox', 'whoami', 'ping', 'wait', 'card'].includes(cmd))
|
|
130
|
-
fail(`${cmd} is an agent command: ringi agent ${cmd}`);
|
|
131
|
-
fail(`unknown command ${cmd}; see ringi help`);
|
|
132
|
-
};
|
|
133
|
-
//# sourceMappingURL=index.js.map
|
|
60
|
+
//# sourceMappingURL=help.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { parseArgs } from './args.js';
|
|
2
|
+
import { dispatch } from './commands.js';
|
|
3
|
+
import { sandboxHints } from '../../core/agents/sessions/context.js';
|
|
4
|
+
import { Fail, WriteDenied } from '../../lib/index.js';
|
|
5
|
+
export { helpMarkdown, TABLE } from './help.js';
|
|
6
|
+
// A reader that stops early (`ringi log | head`) closes the pipe: that ends the output, not the command's work.
|
|
7
|
+
const quietPipe = (e) => {
|
|
8
|
+
if (e.code === 'EPIPE')
|
|
9
|
+
process.exit(process.exitCode ?? 0);
|
|
10
|
+
else
|
|
11
|
+
throw e;
|
|
12
|
+
};
|
|
13
|
+
// What a failed command says: a refusal as it is (a write the host denied, with what each tool's sandbox needs to
|
|
14
|
+
// allow it), anything else with its stack.
|
|
15
|
+
export const failure = (e) => {
|
|
16
|
+
if (e instanceof WriteDenied)
|
|
17
|
+
return [e.message, ...sandboxHints(e.where).map(h => ` ${h}`)].join('\n');
|
|
18
|
+
return e instanceof Fail ? e.message : e.stack ?? String(e);
|
|
19
|
+
};
|
|
20
|
+
export const main = async (argv = process.argv.slice(2)) => {
|
|
21
|
+
if (!process.stdout.listeners('error').includes(quietPipe))
|
|
22
|
+
process.stdout.on('error', quietPipe);
|
|
23
|
+
const [cmd = 'help', ...rest] = argv;
|
|
24
|
+
const o = cmd === 'agent' ? { _: [] } : parseArgs(rest);
|
|
25
|
+
await dispatch(cmd, o, rest);
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// heartbeat-format: one line per heartbeat, as this machine judges it or as the room publishes it.
|
|
2
|
+
import { short } from '../../../lib/index.js';
|
|
3
|
+
export const publishedLine = (h) => `${h.agent.padEnd(12)} ${(h.waits ? `${h.state} (${h.waits})` : h.state).padEnd(22)} ${h.age}s ago${h.overdue ? ', overdue' : ''} on ${short(h.target)}`;
|
|
4
|
+
export const pulseLine = ({ session: s, tool, beat: b }) => {
|
|
5
|
+
const state = b.waits ? `${b.state} (${b.waits})` : b.state;
|
|
6
|
+
return `${s.agent.padEnd(12)} ${`${s.hub}/${s.room}`.padEnd(24)} ${state.padEnd(22)} alive ${b.alive === null ? '?' : b.alive ? 'yes' : 'no'} quiet ${b.quiet}s${b.cpu === null ? '' : ` cpu ${b.cpu.toFixed(1)}s`} ${tool} ${s.handle}`;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=heartbeat-format.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// heartbeat: `ringi heartbeats` (this machine's sessions, or what a room publishes) and `ringi pulse`.
|
|
2
|
+
import * as Heartbeat from '../../../core/agents/heartbeat/pulse.js';
|
|
3
|
+
import * as Hubs from '../../../core/hub/usecases/hubs.js';
|
|
4
|
+
import * as Rooms from '../../../core/hub/usecases/rooms.js';
|
|
5
|
+
import { dump, flag, opt, out } from '../args.js';
|
|
6
|
+
import { publishedLine, pulseLine } from './heartbeat-format.js';
|
|
7
|
+
const published = (o) => {
|
|
8
|
+
const R = Rooms.roomIn(Hubs.hubOf(opt(o, 'hub')), opt(o, 'room'));
|
|
9
|
+
const hs = Heartbeat.published(R);
|
|
10
|
+
if (flag(o, 'json'))
|
|
11
|
+
return dump(hs);
|
|
12
|
+
if (!hs.length)
|
|
13
|
+
return out(`no heartbeats in ${R.name}`);
|
|
14
|
+
for (const h of hs)
|
|
15
|
+
out(publishedLine(h));
|
|
16
|
+
};
|
|
17
|
+
const local = async (o) => {
|
|
18
|
+
const ps = await Heartbeat.heartbeats();
|
|
19
|
+
if (flag(o, 'json'))
|
|
20
|
+
return dump(ps);
|
|
21
|
+
if (!ps.length)
|
|
22
|
+
return out('no sessions');
|
|
23
|
+
for (const p of ps)
|
|
24
|
+
out(pulseLine(p));
|
|
25
|
+
};
|
|
26
|
+
export const heartbeats = async (o) => {
|
|
27
|
+
if (flag(o, 'published'))
|
|
28
|
+
published(o);
|
|
29
|
+
else
|
|
30
|
+
await local(o);
|
|
31
|
+
};
|
|
32
|
+
export const pulse = async (o) => {
|
|
33
|
+
process.exitCode = await Heartbeat.pulse({ every: Number(opt(o, 'beat') ?? 30), once: flag(o, 'once'), log: s => process.stderr.write(`ringi: ${s}\n`) });
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=heartbeat.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// hub-commands: `ringi hub list | create | switch | add | amend`.
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import * as Hubs from '../../../core/hub/usecases/hubs.js';
|
|
4
|
+
import * as Rooms from '../../../core/hub/usecases/rooms.js';
|
|
5
|
+
import { fail } from '../../../lib/index.js';
|
|
6
|
+
import { attachments, flag, list, opt, out, textOf } from '../args.js';
|
|
7
|
+
export const listHub = (_) => {
|
|
8
|
+
for (const h of Hubs.hubs())
|
|
9
|
+
out(`${h.current ? '*' : ' '} ${h.name.padEnd(12)} ${h.store}, ${h.trust}, contract ${h.contract}, ${h.rooms} room(s)${h.remote ? ` remote ${h.remote}` : ''} ${h.dir}`);
|
|
10
|
+
return;
|
|
11
|
+
};
|
|
12
|
+
export const createHub = (o) => {
|
|
13
|
+
const [, arg] = o._;
|
|
14
|
+
const r = Hubs.create(arg ?? '', { signed: flag(o, 'signed'), url: opt(o, 'url') });
|
|
15
|
+
if (!r.add)
|
|
16
|
+
return out(`created hub ${arg} (${r.H.dir})`);
|
|
17
|
+
return out(`created signed hub ${arg}${r.H.d.store.remote ? `, published to ${r.H.d.store.remote}` : ''}. Its root key stays on this machine (${r.rootKey}).
|
|
18
|
+
Give every machine that joins it, out of band:
|
|
19
|
+
${r.add}`);
|
|
20
|
+
};
|
|
21
|
+
export const switchHub = (o) => {
|
|
22
|
+
const [, arg] = o._;
|
|
23
|
+
Hubs.use(arg ?? fail('usage: ringi hub switch <name>'));
|
|
24
|
+
return out(`current hub: ${arg}; agents keep their own rooms`);
|
|
25
|
+
};
|
|
26
|
+
export const addHub = (o) => {
|
|
27
|
+
const [, arg] = o._;
|
|
28
|
+
const H = Hubs.add(arg ?? '', o._[2] ?? '', { root: opt(o, 'root'), genesis: opt(o, 'genesis') });
|
|
29
|
+
return out(`added signed hub ${arg} from ${o._[2]}: contract ${H.contract.version}, ${Rooms.rooms(H).length} room(s), root pinned`);
|
|
30
|
+
};
|
|
31
|
+
export const amendHub = (o) => {
|
|
32
|
+
const H = Hubs.hubOf(opt(o, 'hub'));
|
|
33
|
+
const files = list(o, 'attach').flatMap(attachments).map(e => ({ path: e.path, content: fs.readFileSync(e.file) }));
|
|
34
|
+
const r = Hubs.amend(H, { text: textOf(o), set: list(o, 'set'), authority: opt(o, 'authority'), files });
|
|
35
|
+
return out(`amended hub ${H.name}: contract ${r.version}; rooms keep their base until ringi room rebase-contract <room>`);
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=hub-commands.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// hub: `ringi hub <subcommand>`, by its table (hub-commands.ts).
|
|
2
|
+
import { fail } from '../../../lib/index.js';
|
|
3
|
+
import { addHub, amendHub, createHub, listHub, switchHub } from './hub-commands.js';
|
|
4
|
+
const COMMANDS = new Map([['list', listHub], ['create', createHub], ['switch', switchHub], ['add', addHub], ['amend', amendHub]]);
|
|
5
|
+
export const hub = (o) => {
|
|
6
|
+
const [sub] = o._;
|
|
7
|
+
const run = COMMANDS.get(sub || 'list') ?? fail(`unknown: hub ${sub}`);
|
|
8
|
+
run(o);
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=hub.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// operator: the commands only the operator runs, as the operator of this machine in its terminal context: hubs, rooms,
|
|
2
|
+
// where things stand, sessions, heartbeats, the pulse and the watcher.
|
|
3
|
+
export { heartbeats, pulse } from './heartbeat.js';
|
|
4
|
+
export { hub } from './hub.js';
|
|
5
|
+
export { roomCmd } from './room.js';
|
|
6
|
+
export { forget, sessionLine, sessions } from './sessions.js';
|
|
7
|
+
export { where } from './where.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// room-lifecycle: `ringi room archive | delete | rebase-contract`.
|
|
2
|
+
import * as Rooms from '../../../core/hub/usecases/rooms.js';
|
|
3
|
+
import { fail, short } from '../../../lib/index.js';
|
|
4
|
+
import { flag, opt, out } from '../args.js';
|
|
5
|
+
export const archiveRoom = (H, arg, o) => {
|
|
6
|
+
// Without an id, the room of the current context.
|
|
7
|
+
const R = Rooms.roomIn(H, arg ?? opt(o, 'room'));
|
|
8
|
+
const name = Rooms.archive(H, R);
|
|
9
|
+
return out(`archived ${R.name} as ${name}: read-only, wakes nobody; its sessions end. Read it with --room ${name}`);
|
|
10
|
+
};
|
|
11
|
+
export const deleteRoom = (H, arg, o) => {
|
|
12
|
+
const R = Rooms.roomIn(H, arg ?? opt(o, 'room'));
|
|
13
|
+
if (!flag(o, 'yes'))
|
|
14
|
+
fail(`deleting ${R.name} in hub ${H.name} erases it and everything kept for it, for good. Run again with --yes, or archive it instead`);
|
|
15
|
+
Rooms.erase(H, R);
|
|
16
|
+
return out(`deleted room ${R.name}: its branch, signals, pins, evidence and readers' state. Sessions bound to it leave it on their next turn`);
|
|
17
|
+
};
|
|
18
|
+
export const rebaseRoomContract = (H, arg, o) => {
|
|
19
|
+
const R = Rooms.roomIn(H, arg ?? fail('usage: ringi room rebase-contract <id>'));
|
|
20
|
+
Rooms.rebase(H, R);
|
|
21
|
+
return out(`room ${R.name} now follows the hub contract at ${short(H.main)} (${H.contract.version})`);
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=room-lifecycle.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// room-list: `ringi room list | create | switch`.
|
|
2
|
+
import { roomsActive } from '../../../core/agents/overview.js';
|
|
3
|
+
import * as Rooms from '../../../core/hub/usecases/rooms.js';
|
|
4
|
+
import { fail, short } from '../../../lib/index.js';
|
|
5
|
+
import { flag, opt, out } from '../args.js';
|
|
6
|
+
export const listRoom = (H, arg, o) => {
|
|
7
|
+
const rs = roomsActive(H, { archived: flag(o, 'archived') });
|
|
8
|
+
for (const r of rs.filter(r => !r.archived))
|
|
9
|
+
out(`${r.current ? '*' : ' '} ${r.name.padEnd(16)} ${r.members} member(s), ${r.active} active session(s), profile ${r.profile} genesis ${short(r.genesis)}`);
|
|
10
|
+
for (const r of rs.filter(r => r.archived))
|
|
11
|
+
out(` ${r.name.padEnd(16)} archived, read-only`);
|
|
12
|
+
if (!rs.length && !flag(o, 'archived'))
|
|
13
|
+
out(`no rooms in hub ${H.name}: ringi room create <id>`);
|
|
14
|
+
return;
|
|
15
|
+
};
|
|
16
|
+
export const createRoom = (H, arg, o) => {
|
|
17
|
+
const quorum = opt(o, 'quorum');
|
|
18
|
+
const r = Rooms.create(H, arg ?? '', { profile: opt(o, 'profile'), quorum: quorum === undefined ? undefined : Number(quorum) });
|
|
19
|
+
if (quorum !== undefined)
|
|
20
|
+
return out(`created room ${arg} in hub ${H.name} with profile ${r.profile}; it is the current room. Its work starts by itself at a quorum of ${quorum} agent(s): in each chat that should take part, say "join ${arg} as <id>"`);
|
|
21
|
+
return out(`created room ${arg} in hub ${H.name} with profile ${r.profile}; it is the current room. In each chat that should take part, say: "join ${arg} as <id>; <what to accept>"`);
|
|
22
|
+
};
|
|
23
|
+
export const switchRoom = (H, arg, o) => {
|
|
24
|
+
const R = Rooms.use(H, arg ?? fail('usage: ringi room switch <id>'));
|
|
25
|
+
return out(`current room: ${H.name}/${R.name}; agents keep their own rooms`);
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=room-list.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// room-members: `ringi room admit | remove`.
|
|
2
|
+
import * as Rooms from '../../../core/hub/usecases/rooms.js';
|
|
3
|
+
import { fail } from '../../../lib/index.js';
|
|
4
|
+
import { opt, out } from '../args.js';
|
|
5
|
+
export const admitRoom = (H, arg, o) => {
|
|
6
|
+
const R = Rooms.roomIn(H, opt(o, 'room'));
|
|
7
|
+
Rooms.admit(H, R, arg ?? fail('usage: ringi room admit <agent> <public key|file>'), o._[2] ?? fail('usage: ringi room admit <agent> <public key|file>'));
|
|
8
|
+
return out(`admitted ${arg} to ${H.name}/${R.name}: its signed messages are accepted from now on; it can join`);
|
|
9
|
+
};
|
|
10
|
+
export const removeRoom = (H, arg, o) => {
|
|
11
|
+
const R = Rooms.roomIn(H, opt(o, 'room'));
|
|
12
|
+
Rooms.remove(H, R, arg ?? fail('usage: ringi room remove <agent>'));
|
|
13
|
+
return out(`removed ${arg} from ${R.name}: it can no longer write or be woken there; returning needs a fresh join`);
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=room-members.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// room: `ringi room <subcommand>`, by its table (room-list, room-members, room-lifecycle).
|
|
2
|
+
import * as Hubs from '../../../core/hub/usecases/hubs.js';
|
|
3
|
+
import { fail } from '../../../lib/index.js';
|
|
4
|
+
import { opt } from '../args.js';
|
|
5
|
+
import { archiveRoom, deleteRoom, rebaseRoomContract } from './room-lifecycle.js';
|
|
6
|
+
import { createRoom, listRoom, switchRoom } from './room-list.js';
|
|
7
|
+
import { admitRoom, removeRoom } from './room-members.js';
|
|
8
|
+
const COMMANDS = new Map([['list', listRoom], ['create', createRoom], ['switch', switchRoom], ['admit', admitRoom], ['remove', removeRoom], ['archive', archiveRoom], ['delete', deleteRoom], ['rebase-contract', rebaseRoomContract]]);
|
|
9
|
+
export const roomCmd = (o) => {
|
|
10
|
+
const [sub, arg] = o._;
|
|
11
|
+
const H = Hubs.hubOf(opt(o, 'hub'));
|
|
12
|
+
const run = COMMANDS.get(sub || 'list') ?? fail(`unknown: room ${sub}`);
|
|
13
|
+
run(H, arg, o);
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=room.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// sessions: `ringi sessions` (the seats this machine holds; `forget <handle>` frees one) and `ringi forget <room>/<log>`
|
|
2
|
+
// (a new baseline for a log after an alarm).
|
|
3
|
+
import * as Hubs from '../../../core/hub/usecases/hubs.js';
|
|
4
|
+
import * as Overview from '../../../core/agents/overview.js';
|
|
5
|
+
import * as Rooms from '../../../core/hub/usecases/rooms.js';
|
|
6
|
+
import { fail } from '../../../lib/index.js';
|
|
7
|
+
import { dump, flag, opt, out } from '../args.js';
|
|
8
|
+
// --- where things stand, sessions, forget ---
|
|
9
|
+
export const sessionLine = (s) => `${s.agent.padEnd(12)} ${s.liveness.padEnd(8)} ${(s.product ?? '?').padEnd(7)} ${s.handle}${s.scope ? ` scope: ${s.scope}` : ''}`;
|
|
10
|
+
export const sessions = (o) => {
|
|
11
|
+
if (o._[0] === 'forget') {
|
|
12
|
+
const handle = o._[1] ?? fail('usage: ringi sessions forget <handle>');
|
|
13
|
+
Overview.forgetSession(handle);
|
|
14
|
+
return out(`forgot session ${handle}; its seat is free`);
|
|
15
|
+
}
|
|
16
|
+
const ss = Overview.sessions();
|
|
17
|
+
if (flag(o, 'json'))
|
|
18
|
+
return dump(ss);
|
|
19
|
+
if (!ss.length)
|
|
20
|
+
return out('no sessions');
|
|
21
|
+
for (const s of ss)
|
|
22
|
+
out(`${s.hub}/${s.room} ${sessionLine(s)}`);
|
|
23
|
+
};
|
|
24
|
+
export const forget = (o) => {
|
|
25
|
+
const [name, id] = (o._[0] ?? '').split('/');
|
|
26
|
+
if (!name || !id)
|
|
27
|
+
fail('usage: ringi forget <room>/<log>');
|
|
28
|
+
const H = Hubs.hubOf(opt(o, 'hub'));
|
|
29
|
+
const n = Rooms.forgetLog(H, Rooms.roomIn(H, name), id);
|
|
30
|
+
out(`forgot the accepted history of ${name}/${id} for ${n} reader(s); the next read accepts what is there now`);
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=sessions.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// watch: the headless watcher the operator starts for an agent's seat (`ringi watch <room>/<agent> --exec …`).
|
|
2
|
+
import { watch } from '../../../core/agents/sessions/agent.js';
|
|
3
|
+
import { fail, words } from '../../../lib/index.js';
|
|
4
|
+
import { flag, opt, out } from '../args.js';
|
|
5
|
+
const numberOption = (o, k) => opt(o, k) === undefined ? undefined : Number(opt(o, k));
|
|
6
|
+
export const watchCommand = async (o) => {
|
|
7
|
+
process.exitCode = await watch({
|
|
8
|
+
seat: o._[0] ?? fail('usage: ringi watch <room>/<agent> --exec <cmd> [--scope <text>] [--once] [--require-grant] …'),
|
|
9
|
+
exec: opt(o, 'exec') ?? fail('--exec <cmd> is required: the command that starts a headless turn'),
|
|
10
|
+
hub: opt(o, 'hub'), scope: opt(o, 'scope'), once: flag(o, 'once'), requireGrant: flag(o, 'require-grant'), handoff: flag(o, 'handoff'),
|
|
11
|
+
interval: numberOption(o, 'interval'), from: opt(o, 'from') ? words(opt(o, 'from')) : undefined, maxHop: numberOption(o, 'max-hop'),
|
|
12
|
+
maxRuns: numberOption(o, 'max-runs'), window: numberOption(o, 'window')
|
|
13
|
+
}, out);
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// where-format: how `ringi where` shows the hub, the room, who is in, open work and the latest messages.
|
|
2
|
+
import { withSizes } from '../../../core/hub/usecases/room.js';
|
|
3
|
+
import { oneLine, render } from '../../../core/hub/usecases/view.js';
|
|
4
|
+
import { short } from '../../../lib/index.js';
|
|
5
|
+
import { flag, out } from '../args.js';
|
|
6
|
+
import { taskLine } from '../shared/index.js';
|
|
7
|
+
import { sessionLine } from './sessions.js';
|
|
8
|
+
export const hubLine = (H) => `hub ${H.name}: ${H.d.store.type} store, ${H.contract.trust} senders, contract ${H.contract.version}, protocol ${H.contract.protocol}${H.contract.capabilities?.length ? `, ${H.contract.capabilities.join(' ')}` : ''}`;
|
|
9
|
+
const quorumLine = (R) => {
|
|
10
|
+
if (R.quorum === null)
|
|
11
|
+
return '';
|
|
12
|
+
const agents = Object.values(R.members).filter(m => m.role !== 'root').length;
|
|
13
|
+
return agents >= R.quorum ? `; started at its quorum of ${R.quorum} agents` : `; waiting for a quorum of ${R.quorum} agents, has ${agents}`;
|
|
14
|
+
};
|
|
15
|
+
const roomLine = (R) => `room ${R.name}${R.archived ? ' (archived, read-only)' : ''}, genesis ${short(R.genesis)}, profile ${R.profile.name}; members: ${Object.entries(R.members).map(([id, i]) => i.role === 'root' ? `${id} (root)` : id).join(', ')}` + quorumLine(R);
|
|
16
|
+
export const printOverview = (w, R) => {
|
|
17
|
+
out(roomLine(R));
|
|
18
|
+
out(w.sessions.length ? `sessions:\n${w.sessions.map(s => ` ${sessionLine(s)}`).join('\n')}` : 'sessions: none joined');
|
|
19
|
+
out(w.work.length ? `open work:\n${w.work.map(t => ` ${taskLine(t)}`).join('\n')}` : 'open work: none');
|
|
20
|
+
if (w.proposals.length)
|
|
21
|
+
out(`open proposals:\n${w.proposals.map(x => ` ${short(x.proposal.id)} ${x.state} → ${x.decider} ${x.proposal.subject}`).join('\n')}`);
|
|
22
|
+
};
|
|
23
|
+
export const showMessage = (R, o, all, m) => out(flag(o, 'short') ? ` ${oneLine(m)}` : `\n${render(all, m, { max: 2000, files: () => withSizes(R, m) })}`);
|
|
24
|
+
//# sourceMappingURL=where-format.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// where: `ringi where`, where things stand for the operator, and `--follow` for what lands next.
|
|
2
|
+
import { config } from '../../../core/hub/usecases/context.js';
|
|
3
|
+
import * as Hubs from '../../../core/hub/usecases/hubs.js';
|
|
4
|
+
import * as Overview from '../../../core/agents/overview.js';
|
|
5
|
+
import { sleep } from '../../../lib/index.js';
|
|
6
|
+
import { flag, opt, out } from '../args.js';
|
|
7
|
+
import { hubLine, printOverview, showMessage } from './where-format.js';
|
|
8
|
+
const follow = async (H, R, o, seen) => {
|
|
9
|
+
out('following; new messages appear as they land (Ctrl-C to stop)');
|
|
10
|
+
for (;;) {
|
|
11
|
+
await sleep(Number(opt(o, 'interval') ?? 2) * 1000);
|
|
12
|
+
const now = Overview.arrived(H, R, seen);
|
|
13
|
+
for (const m of now.messages)
|
|
14
|
+
showMessage(R, o, now.all, m);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export const where = async (o) => {
|
|
18
|
+
const H = Hubs.hubOf(opt(o, 'hub'));
|
|
19
|
+
const w = Overview.where(H, opt(o, 'room') ?? config().room);
|
|
20
|
+
out(hubLine(H));
|
|
21
|
+
const R = w.room;
|
|
22
|
+
if (!R)
|
|
23
|
+
return out('no current room: ringi room create <id> | ringi room switch <id>');
|
|
24
|
+
printOverview(w, R);
|
|
25
|
+
const n = Number(opt(o, 'n') ?? (flag(o, 'short') ? 10 : 5));
|
|
26
|
+
out(`last ${Math.min(n, w.messages.length)} of ${w.messages.length} messages:`);
|
|
27
|
+
for (const m of w.messages.slice(-n))
|
|
28
|
+
showMessage(R, o, w.all, m);
|
|
29
|
+
if (flag(o, 'follow'))
|
|
30
|
+
await follow(H, R, o, new Set(w.all.keys()));
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=where.js.map
|