ScriptTap

Resources for AI

ScriptTap Resources for AI

Generic, schema-first references for AI tools that build downloadable ScriptTap V2 .scripttap.json packages.

Canonical Source

The exact canonical schema is the ultimate source of truth. For the same revision, Bridge /health.commandContract and the website contract publish identical command rules. Compare Bridge commandContractSha256 with website commandContractSourceSha256; never mix an older installed app's schema with a newer website revision. Narrative guidance, examples and suggestions never override the exact schema. Package envelopes and package-local Call identity use an explicitly documented transport mapping.

For user-facing overviews, the feature guides explain where AI packages fit alongside no-root automation, OCR, image matching, screen reads, routines, and shortcuts.

Builder Prompt

ai_prompt.txt is the bootstrap prompt and official resource index for creating one downloadable `.scripttap.json` package. When downloadable file output is unavailable, AI tools may return one copyable JSON object. The walkthrough resource is for requested manual UI directions or cases where safe JSON generation is not possible.

Incomplete or user-needed commands should use short useful nicknames prefixed with exact lowercase `ai!` so the user can find required edits after import.

Function Reference

Start with the compact import-only command index. Follow its links for the exact schema, selected-mode allowed/required/forbidden fields, nested constraints and generic examples for every current command. Base-catalog optionality is not permission to include a field in every mode. Inactive fields must be omitted entirely, even if blank, false, zero or null. Required fields remain present; incomplete values are admitted only where the exact rule allows them.

ai_functions_v1.txt explains the behavior and common mistakes for 63 current authoring command types. Eight additional legacy wire types remain readable for compatibility but must not be used for new commands.

Best Practices

ai_best_practices_v1.txt offers optional strategies for screen reads, search areas, assets, variables and flow. These are suggestions, not necessarily the best fit for every request. The exact schema always wins.

Variable letters are case-insensitive and canonicalize to lowercase: D1 and d1 are the same variable. Identity is declaration order, one lowercase letter, exact type, and LOCAL/THREAD scope; numeric suffixes, ranges, capacities, and initialized slots are not validation facts. One writer declares the whole typed family, and every suffix or array slot sharing that letter uses its type in the visible scope. For example, Integer d[] means D1/d1 cannot be Decimal there. Counts control attempted initialization or writes only, and runtime storage is sparse.

Commands with typed-zero reads use Integer 0, Decimal 0, Boolean False, Hex 000000, String empty, or Time 00:00:00. Other commands reject invalid setup or skip sparse slots. Counts do not universally fall back to zero, and invalid writes do not authorize partial publication: use the exact command-specific range, atomic batch, failure and status-output rules in the function reference. Runtime reasons remain in Run Logs without an extra result record. variableShared:false/true is the sole LOCAL/THREAD wire encoding.

User Walkthrough

ai_user_walkthrough_v1.txt covers manual ScriptTap UI directions for users who ask for step-by-step script creation, asset capture, command entry, and Routine setup guidance instead of an importable JSON package.

JSON Contract

ai_json_contract_v1.json is generated from ScriptTap's canonical machine contract. It identifies 63 current authoring types, 8 legacy compatibility types, and 1 internal/generated type, contains exact schemas for all 72 supported wire types, and defines all 20 Bridge routes.

Each route includes transport:{parameters,body,encoding}, distinguishing query filters, bodyless operations, and exact UTF-8 JSON mutations. Bodyless operations, including Duplicate, reject even an empty JSON object; asset base64 fields are JSON data, not raw-binary request support.

A successful Bridge save or package import means public schema, syntax, ordinary paired-block balance, Call topology, and storage admission passed, the change was accepted into canonical RAM, and background persistence was queued. It does not mean the SSD write or Validation V2 is complete, or that the script is ready to run. Manual imports schedule Validation V2 immediately; accepted Bridge full-script create, replace, and transaction operations use a restartable 20-second quiet period. Bridge does not expose validation status; reads are observational and never start, retry, or mutate validation.

babyIfAttached, babyIfParentId, and babyIfSource are app-generated relationship fields. AI packages should omit them and should not invent standalone GetPixelColor Result rows. ScriptTap generates Result rows and linked Baby IF blocks; imported relationship fields are checked by Validation V2 after acceptance.

Validation metadata, status, issues, revision, index, phase, or owner state never appears in JSON, .sts, cloud, export, archive, public packages, or website downloads. Use confidence fields for fuzzy RGB/image matching; function-level tolerance fields are not public package fields.

In UI Find and Delay Until UI Element, the target-square beside Query opens the EditorSelector Select UI Element mode. Choosing a visible Accessibility-exposed node fills Query, Target, Match=Exact, and Nth. If an app does not expose the target node, use OCR, image matching, or pixel checks instead.

Bridge Script Upload

Before delivering a downloadable package, save the offline Python preflight as scripttap_validate.py and run python3 scripttap_validate.py finished.scripttap.json. It uses the same canonical command data, reports exact error paths and never contacts an app or network. Correct errors and re-run on the final bytes. It checks the listed canonical-contract and package-structure rules, not actual Android import, executable completeness, storage, asset bytes or granted permissions. Generic command examples are snippets/drafts, not standalone runnable packages.

The active current Bridge token is the single authentication authority for every route and method. Send that same token through X-ScriptTap-Bridge-Token, Authorization: Bearer, ?t=, or ?token=. Headers are preferred because URLs may be copied or logged.

The single live Bridge script-upload path is POST /scripts/transaction. Each scripts[] member requires clientId and one complete script. Set addressedScriptId to an exact live ID from GET /scripts when replacing a script; omit it when creating a script. scriptId is not a transaction-member field. For large uploads, assemble every member into one UTF-8 transaction file and send that file as one request body. Each call has one independent terminal result; separate calls are never retried or merged.

GET /health publishes the shared current-token rule under authentication, the exact generated contract under commandContract, its version and SHA-256 under commandContractSchemaVersion and commandContractSha256, and the same 20 typed routes under routeInventory. scriptUpload repeats the authentication rule with transaction guidance and examples.

ScriptTap imports public `.scripttap.json` script packages and can export user-directed `.scripttap.zip` packages for AI review. AI-created `.sts` files, image bytes, base64, screenshots, Routine records, launcher shortcut credentials, cloud state, account data, bridge tokens, Firebase data, and runtime logs do not belong in AI package output.