---
url: https://salimhamed.github.io/jigs/api/steps/runtime.md
---
# steps/runtime

Read run context and update run resources outside workflow code.

Wrap steps in a factory-owned `"use step"` file. Never call them directly from a workflow.

## Functions

### createRunDirectory()

```ts
function createRunDirectory(metadata): Promise<string>;
```

Create a working directory that survives retries and pauses in this run.

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `metadata` | [`RunMetadata`](../steps.md#runmetadata) |

#### Returns

`Promise`<`string`>

***

### dashboardRunUrl()

```ts
function dashboardRunUrl(runId): string | undefined;
```

The run's page on the dashboard this service hosts, or undefined when the
service was started without one. Never a standalone `workflow web` URL: run
against a live World it opens a second queue worker and steals the jobs the
run is waiting on.

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `runId` | `string` |

#### Returns

`string` | `undefined`

***

### registerResource()

```ts
function registerResource(resource): Promise<RunResource>;
```

Register one resource on the active run.

Repeating kind + identity is idempotent. A new URL for that identity
replaces the old URL; concurrent updates are last-committed-wins. Distinct
identities occupy distinct atomic keys.

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `resource` | [`RunResource`](../jigs.md#runresource) |

#### Returns

`Promise`<[`RunResource`](../jigs.md#runresource)>

***

### releaseRunResources()

```ts
function releaseRunResources(policy, metadata): Promise<ReleaseReport>;
```

Persist an explicit success action, release under the run lock and return the result.

#### Parameters

| Parameter | Type | Description |
| :------ | :------ | :------ |
| `policy` | { `onFailure`: `"release"` | `"keep"`; `onSuccess`: `"release"` | `"keep"`; } | - |
| `policy.onFailure` | `"release"` | `"keep"` | What to do with eligible resources after a failed or cancelled run. |
| `policy.onSuccess` | `"release"` | `"keep"` | What to do with eligible resources after a completed run. |
| `metadata` | [`RunMetadata`](../steps.md#runmetadata) | - |

#### Returns

`Promise`<[`ReleaseReport`](../jigs.md#releasereport)>

***

### removeRunDirectory()

```ts
function removeRunDirectory(metadata): Promise<void>;
```

Remove this run's working directory after its work is finished, never while paused.

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `metadata` | [`RunMetadata`](../steps.md#runmetadata) |

#### Returns

`Promise`<`void`>

***

### resolveReleasePolicy()

```ts
function resolveReleasePolicy(metadata, definition): Promise<{
  onFailure: "release" | "keep";
  onSuccess: "release" | "keep";
}>;
```

Resolve the workflow policy, then the factory policy, then the built-in release/keep default.

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `metadata` | `NamedRunMetadata` |
| `definition` | [`FactoryDefinition`](../jigs.md#factorydefinition) |

#### Returns

`Promise`<{
`onFailure`: `"release"` | `"keep"`;
`onSuccess`: `"release"` | `"keep"`;
}>
