On this page
Sommatic Docs
Open portal

Apply StoneOS Industry Package

Proposes an industry package for a business unit, previews it and waits for a person with permission to approve.

View as Markdown
Open in
Human in the loop Partial stoneos.industry.apply Version 1.0.0 Execution: async

Proposes a StoneOS industry package for a business unit, creates its preview and returns a suspend signal; the later decision of a person is mapped to applied, rejected, timeout or partial through the orchestrator resume operation.

How it works

  1. Resolves the config and merges it over the incoming payload (config wins). If the result has a resume object, it skips the proposal and maps the decision (last step).
  2. Checks unit and package_id, and that the StoneOS industry service is configured.
  3. Calls the service as a service identity acting on behalf of approver_role (default administrator).
  4. Creates a change with package_id, business_unit_code (from unit), role (default principal), size, jurisdiction and reasons (reason, or a default text naming the package), then requests its preview, which must return installation_id and installation_preview_hash.
  5. Returns { __signal: "SUSPEND", __metadata: { type: "stoneos_industry_change", id, installation_id, preview_hash, expires_in_ms, resume_on } }. The envelope has no port, so the engine routes it to out, which this node does not declare: the branch ends and the run completes.
  6. Resume: the system that holds the decision calls the orchestrator resume operation with workflow_instance_id, node_id, optional graph and input, and resume { change_id, state, port?, approver, applied_apps?, failed_app?, error_code? }. The worker runs again in resume mode and picks the port from resume.port or resume.state; with graph and node_id, a new run starts from the nodes connected to that port, with data as payload.

In a workflow

The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.

{
  "node_id": "node-apply-industry",
  "label": "Apply industry package",
  "operator_slug": "stoneos.industry.apply",
  "operator_version": "1.0.0",
  "config": {
    "unit": "{{ $json.business_unit_code }}",
    "package_id": "<package_id>",
    "role": "principal",
    "reason": "New business unit onboarding",
    "approver_role": "administrator",
    "timeout_ms": 259200000
  }
}

Configuration

unit string Required

Business unit code (expression allowed)

package_id string Required
proposal_id string Optional
role string Optional

Default: principal

Allowed values: principalcomplement

size string Optional
jurisdiction string Optional

Jurisdiction code; defaults to the organization one

reason string Optional
operation string Optional
approver_role string Optional

Default: administrator

timeout_ms integer Optional

Default: 259200000

Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.

Behaviour in the code

What the implementation does with these keys beyond what the schema says.

resume
Not declared. When the config or the incoming payload carries resume, the node maps it to a port instead of proposing a change.
proposal_id
Declared but ignored, like operation.
timeout_ms
Default 72 hours. Only returned as __metadata.expires_in_ms; the orchestrator does not enforce it. timeout comes only from a resume with state timeout.

Output ports

applied default

Resume with state applied and an approver. The only port with ok: true.

Data
{
  "change_id": "chg-xxxxxxxxxxxx",
  "state": "applied",
  "applied_apps": [
    "stoneos-notes",
    "stoneos-todo"
  ],
  "approver": "admin@example.com"
}
rejected

Resume with state rejected and an approver.

Data
{
  "change_id": "chg-xxxxxxxxxxxx",
  "state": "rejected",
  "applied_apps": [],
  "approver": "admin@example.com"
}
timeout

Resume with state timeout; no approver is required.

Data
{
  "change_id": "chg-xxxxxxxxxxxx",
  "state": "timeout",
  "applied_apps": []
}
partial

Resume with state partial and an approver: some apps were applied and failed_app names the one that failed.

Data
{
  "change_id": "chg-xxxxxxxxxxxx",
  "state": "partial",
  "applied_apps": [
    "stoneos-notes"
  ],
  "failed_app": "stoneos-todo",
  "approver": "admin@example.com"
}
error

A proposal step failed, or the resume is invalid or reports an error. data carries only error_code; the message is in the envelope error field, which does not reach the next node.

Data
{
  "error_code": "missing_unit"
}

In expressions

What a later node can read from this node's output with $("Apply StoneOS Industry Package").item.json.<path> (write your node's label instead of Apply StoneOS Industry Package). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through applied, from the output shown in Ports.

ExpressionEditorWorker
$("Apply StoneOS Industry Package").item.json.change_idstring= "chg-xxxxxxxxxxxx"
$("Apply StoneOS Industry Package").item.json.statestring= "applied"
$("Apply StoneOS Industry Package").item.json.applied_appsarray= […] (2)
$("Apply StoneOS Industry Package").item.json.failed_appstringThe worker does not return it: reads as undefined —
$("Apply StoneOS Industry Package").item.json.approverstring= "admin@example.com"
$("Apply StoneOS Industry Package").item.json.error_codestringThe worker does not return it: reads as undefined —

— Editor: The editor suggests it, but the worker does not return it: it reads as undefined.

Errors

Message Port Cause and fix
Missing 'unit' error No business unit code. error_code: missing_unit.
Missing 'package_id' error No package. error_code: missing_package_id.
services.stoneosIndustry.uri is not resolved error The orchestrator has no StoneOS industry service configured. error_code: service_not_configured.
The change was not created error The service answered without a change id. error_code: change_not_created.
The change preview was not created error The preview has no installation_id or installation_preview_hash. error_code: preview_failed.
<HTTP error message> error The service rejected a call; its own error_code is used when it sends one. error_code: request_failed.
Unknown resume state '<port>' error The resume port is not applied, rejected, timeout, partial or error. error_code: unknown_resume_state.
The '<port>' port needs the person who approved error applied, rejected and partial require resume.approver. error_code: approval_missing.
<resume error> error The resume reports port or state error; data keeps the resume fields plus error_code (default apply_failed).

Input contract

unit string Optional
package_id string Optional
proposal_id string Optional
role string Optional
size string Optional
operation string Optional
approver_role string Optional
timeout_ms integer Optional

Output contract

change_id string Optional
state string Optional
applied_apps array<string> Optional
failed_app string Optional
approver string Optional
error_code string Optional

Contracts (JSON Schema)

The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.

{
  "slug": "stoneos.industry.apply",
  "name": "Apply StoneOS Industry Package",
  "category": "hitl",
  "version": "1.0.0",
  "description": "Proposes an industry package for a business unit, previews it and waits for a person with permission to approve. The app applies the change; the worker only proposes, waits and resumes.",
  "capabilities": [
    "industry",
    "configuration",
    "human"
  ],
  "config_schema": {
    "type": "object",
    "required": [
      "unit",
      "package_id"
    ],
    "properties": {
      "unit": {
        "type": "string",
        "title": "Business unit",
        "description": "Business unit code (expression allowed)"
      },
      "package_id": {
        "type": "string",
        "title": "Package"
      },
      "proposal_id": {
        "type": "string",
        "title": "Proposal"
      },
      "role": {
        "type": "string",
        "enum": [
          "principal",
          "complement"
        ],
        "default": "principal"
      },
      "size": {
        "type": "string",
        "title": "Size"
      },
      "jurisdiction": {
        "type": "string",
        "title": "Jurisdiction",
        "description": "Jurisdiction code; defaults to the organization one"
      },
      "reason": {
        "type": "string",
        "title": "Reason"
      },
      "operation": {
        "type": "string",
        "title": "Operation"
      },
      "approver_role": {
        "type": "string",
        "default": "administrator",
        "title": "Approver role"
      },
      "timeout_ms": {
        "type": "integer",
        "default": 259200000
      },
      "execution": {
        "type": "object",
        "title": "Execution Settings",
        "properties": {
          "alwaysOutputData": {
            "type": "boolean",
            "title": "Always Output Data",
            "description": "Always output data, even on error (if configured).",
            "default": false
          },
          "retryOnFail": {
            "type": "boolean",
            "title": "Retry On Fail",
            "description": "Retry the execution if it fails.",
            "default": false
          },
          "maxTries": {
            "type": "integer",
            "title": "Max Retries",
            "description": "Number of retries.",
            "default": 3,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "waitBetweenTries": {
            "type": "integer",
            "title": "Wait Between Retries (ms)",
            "default": 1000,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "continueOnFail": {
            "type": "boolean",
            "title": "Continue On Fail",
            "description": "Do not crash workflow on error.",
            "default": false
          },
          "timeout_ms": {
            "type": "integer",
            "title": "Timeout (ms)",
            "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
            "default": 300000
          }
        }
      }
    }
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "unit": {
        "type": "string"
      },
      "package_id": {
        "type": "string"
      },
      "proposal_id": {
        "type": "string"
      },
      "role": {
        "type": "string"
      },
      "size": {
        "type": "string"
      },
      "operation": {
        "type": "string"
      },
      "approver_role": {
        "type": "string"
      },
      "timeout_ms": {
        "type": "integer"
      }
    }
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "change_id": {
        "type": "string"
      },
      "state": {
        "type": "string"
      },
      "applied_apps": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "failed_app": {
        "type": "string"
      },
      "approver": {
        "type": "string"
      },
      "error_code": {
        "type": "string"
      }
    }
  },
  "ports": [
    {
      "port_id": "applied",
      "label": "Applied",
      "is_default": true,
      "description": "Approved and applied"
    },
    {
      "port_id": "rejected",
      "label": "Rejected",
      "description": "A person rejected the change"
    },
    {
      "port_id": "timeout",
      "label": "Timeout",
      "description": "Nobody decided in time"
    },
    {
      "port_id": "partial",
      "label": "Partial",
      "description": "Applied halfway; the flow decides"
    },
    {
      "port_id": "error",
      "label": "Error",
      "description": "Carries error_code"
    }
  ],
  "execution_mode": "async",
  "tags": [
    "industry",
    "configuration",
    "human"
  ],
  "is_stateful": true,
  "publisher": {
    "identity": "org_sommatic_ai",
    "profile": {
      "name": "Sommatic AI",
      "verified": true,
      "url": "https://me.veripass.com/sommatic",
      "logo_url": null
    }
  }
}

Execution

Execution
async
Stateful
Yes
Retries (retryOnFail)
No
Credentials
Resolved on the server from connection_id; the secret never reaches the workflow.
Capabilities
industryconfigurationhuman
Tags
industryconfigurationhuman

Notes and limits

  • The change request sends workflow_instance_id and node_id empty (the worker reads them from fields the runtime does not set), so the service is not told which run proposed the change; the caller of the resume operation must supply workflow_instance_id, node_id and graph.
  • The continuation is a new run: outputs of the nodes before this one are not available ($("Node") is empty) and $input is the resume input.
  • rejected, timeout and partial have ok: false but still follow their own port. The worker only proposes and waits; applying the package is done by the StoneOS app after approval.

Reviewed against the orchestrator code · 31e874b · 2026-11-26

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs