Skip to content

feat(TaskAutomation): Initial release - #2364

Open
steverobertsuk wants to merge 14 commits into
Roll20:masterfrom
steverobertsuk:sr/task-automation-v1-0-0
Open

steverobertsuk wants to merge 14 commits into
Roll20:masterfrom
steverobertsuk:sr/task-automation-v1-0-0

Conversation

@steverobertsuk

Copy link
Copy Markdown
Contributor

Initial release of TaskAutomation

Added

  • Tasks described as validated JSON, with drafts, numbered published revisions, import/export (including in parts), cloning, archiving and permanent deletion with a confirmation. Runs keep the revision they started with.
  • Steps: waits for a duration or until a time, waits for events with a timeout, conditions, counted, while, until and GM-approved forever loops, calls to other tasks (awaited or detached), parallel branches joined by all, anySuccess or race with explicit merge rules, variables, signals and stop.
  • Actions: chat (say, emote, describe, whisper, GM commands), token properties, multi-sided token sides, status markers (with counters), attributes (set, adjust, read; optional sheet workers), pings, visual effects, jukebox play/stop/volume, starting, pausing and cancelling other runs, commands to other Mods and trusted Mod adapters.
  • Triggers: buttons and commands, one-off times, fixed-rate and fixed-delay intervals, daily and weekly times at a fixed UTC offset, token, attribute, turn order, turn tracker, player page and player presence events, task lifecycle events, signals and opt-in chat, with cooldown, debounce, burst caps and per-object coalescing.
  • One timer for all work, with bounded draining; an idle game has no timer.
  • Restart recovery: runs carry on from their saved step, interrupted actions are confirmed or sent for review instead of being repeated, observation gaps are recorded, and one summary is whispered.
  • Missed-work handling with skip, runOnce, catchUpBounded, review and expire, counted without replaying every missed time, and incidents with previews and single-use confirmations.
  • Concurrency policies (allow, skipIfRunning, queue, replace), a circuit breaker, ancestry limits and an emergency stop.
  • A GM-only dashboard handout with pause, resume, cancel, decision and recovery buttons; an optional player view; a GM-only Help handout.
  • GM-only by default; tasks can be shared with listed players, who can only use them on tokens they control.
  • TaskAutomation.registerAdapter, registerAction, registerTrigger, emit, signal and start for other Mods, with a reference adapter.
  • Seven worked examples plus the montage as templates and JSON files, a JSON Schema, and guides for authoring, operations and adapters.

script.json listed 4.0.1 as the current version, but no 4.0.1 folder
was ever added, so One-Click installs of it failed. The 4.0.0 folder
had also been overwritten with later 4.x code.

Restore 4.0.0/ to the code released as 4.0.0 (e53c26b) and add 4.0.1/
with the code released as 4.0.1 (72dcd80), so every listed version
installs what it says.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Version 5 is written as ES modules and bundled with Rollup, in line
with Hexploration and the other reworked Mods. Add the build, version
bump and locale sync scripts, Prettier settings, and the npm package
that runs them. The released version folders and the generated
script.json are excluded from formatting.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
TokenController was reported as not working with Jumpgate and is no
longer supported by its author. Rewrite it as version 5:

- One !tokencontroller command, with !tc and !token-control kept so
  version 4 macros still work.
- Routes from step codes, drawings (Jumpgate pathv2 and Legacy path)
  or recorded moves, run as loop, ping-pong or once.
- Square, hex, isometric, dimetric and gridless pages, using grid
  geometry measured in a Jumpgate game and the page grid offset.
- Combat detection from the turn tracker, a manual switch or both;
  lock modes (Roll20's lock, undo moves, hold still); single-file or
  formation following.
- Help and Command Deck handouts, settings as One-Click options, and
  messages in 24 languages (English for now, others to follow).
- Version 4 games are upgraded on startup, and the v4 usage guide,
  which players could see, is removed.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Cover the pure grid, route and state modules directly, and run the
built bundle in a Roll20 sandbox stub with a controllable clock to
exercise patrols, following, locks, combat, recording, drawings and
the version 4 upgrade. Grid tests include positions Roll20 snapped
tokens to in a Jumpgate game.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Add a README for GMs, a changelog covering every release, a developer
guide, a map of where each feature lives, and an in-game test plan
for Jumpgate and Legacy games.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Build the bundle and its 5.0.0 snapshot, and update script.json with
the new version, authors, options and the full list of earlier
versions.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Tasks are validated JSON definitions with published revisions; runs pin a
revision and keep persistent frames, so they survive API restarts.

- One scheduler owns the only timer: a min-heap of jobs, one re-armed
  timeout, generation guards and bounded draining.
- Steps: waits, awaited events, conditions, count/while/until/forever
  loops, calls, cooperative parallel branches with joins, and the action
  catalogue (chat, tokens, sides, markers, attributes, pings, effects,
  jukebox, other-Mod commands and trusted adapters).
- Triggers: manual, one-off, fixed-rate/fixed-delay intervals, daily and
  weekly at a fixed UTC offset, token/attribute/turn order/page/player
  events, signals and opt-in chat, with cooldown, debounce and burst caps.
- Missed work after downtime or pauses follows skip, runOnce,
  catchUpBounded, review or expire, counted arithmetically.
- An action journal reconciles interrupted effects on restart; uncertain
  non-idempotent effects go to GM review instead of repeating.
- GM-only by default, with narrowly published player tasks, effect-time
  control checks, revision-bound links and single-use confirmations.
- A throttled GM dashboard handout, an optional player view and a Help
  handout; seven worked examples plus the montage fixture as templates.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Covers the scheduler and heap, expressions, recurrence, the validator and
state migrations directly, and runs the built bundle in a Roll20 stub with
fake timers for the worked examples, engine behaviour, restart fault
injection, permissions, injection and the dashboard. Every end-to-end test
asserts that the Mod never held more than one timer.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
scripts/write-schema.mjs generates schema/task-definition.schema.json from
the same step catalogue the runtime validator uses. A test checks every
example against it with Ajv and fails when the committed file is stale.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
User guide and command reference, task authoring reference, the worked
examples with expected results, the recovery and operations guide, the
adapter author guide, developer notes, a file map and the live testing
checklist.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Found in live testing on Jumpgate:

- Every published task showed "+draft" because the draft's next revision
  number was compared with the current one. Definitions now track whether
  the draft has unpublished changes.
- Run errors named tokens by ID (-P55Gb… is not a multi-sided token);
  they now use the token's name.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Live testing showed TokenMod drops --ids from commands sent by other Mods
unless its players-can-ids option is on, so the other-Mod example only
shows "sent (not confirmed)" with TokenMod's defaults. The template
description, README, worked examples and testing checklist now say so.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant