Development

The Ops Platform SDK is an optional package that accelerates the Op development process and enables integration with our powerful platform features. It includes two modules: ux and sdk.

The ux module is a collection of command-line utilities that help you build your own professional Node.js CLI in no time. It includes the following components:

  • question prompts
  • spinners & loading bars
  • colors
  • tree & table layouts, and more...

The sdk module is a set of tools that allow you to:

  • manage state and config for your teams and users
  • access the file-system on your user's host machine
  • track events and analytics for your Op users

SDK Module Docs

Terminology

Config

The SDK provides persistent config so that your op can store data on the host between executions. For example, this can be accessed in Node.js with the sdk.setState and sdk.getState functions.

  • The config is stored in a JSON file at the host path ~/.config/@cto.ai/ops/${username}/${opName}/config.json
  • Configs are persisted if the code is executed multiple times
  • Each op has its own config, and cannot affect any other op's config

State

The SDK provides a mechanism for maintaining state through the different steps of a workflow. Anything stored in the state directory (found with sdk.getStatePath) will be available in later steps. Additionally, the SDK provides key/value storage in the state similar to the config.

  • Locally, the state is stored in the following directory: ~/.config/@cto.ai/ops/${username}/${opName}/${runId}, with the key/value store saved in `state.json therein.
  • Each execution of a workflow is a different run and will have a different state, which will initially be blank.