@cliangdev/conductor 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/claude/commands/conductor/workflow.md +95 -12
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +38 -0
- package/dist/commands/config.js.map +1 -1
- package/dist/daemon/job-runner.d.ts +81 -0
- package/dist/daemon/job-runner.d.ts.map +1 -0
- package/dist/daemon/job-runner.js +533 -0
- package/dist/daemon/job-runner.js.map +1 -0
- package/dist/daemon/run-lifecycle.d.ts +7 -0
- package/dist/daemon/run-lifecycle.d.ts.map +1 -1
- package/dist/daemon/run-lifecycle.js +26 -0
- package/dist/daemon/run-lifecycle.js.map +1 -1
- package/dist/daemon/run-queue.d.ts +6 -1
- package/dist/daemon/run-queue.d.ts.map +1 -1
- package/dist/daemon/run-queue.js +42 -3
- package/dist/daemon/run-queue.js.map +1 -1
- package/dist/daemon/runner.d.ts +16 -0
- package/dist/daemon/runner.d.ts.map +1 -1
- package/dist/daemon/runner.js +25 -19
- package/dist/daemon/runner.js.map +1 -1
- package/dist/daemon/watcher.d.ts.map +1 -1
- package/dist/daemon/watcher.js +7 -1
- package/dist/daemon/watcher.js.map +1 -1
- package/dist/lib/config.d.ts +4 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +5 -1
- package/dist/lib/config.js.map +1 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +65 -6
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/tools/documents.d.ts +11 -0
- package/dist/mcp/tools/documents.d.ts.map +1 -1
- package/dist/mcp/tools/documents.js +22 -2
- package/dist/mcp/tools/documents.js.map +1 -1
- package/dist/mcp/tools/integrations.d.ts +1 -0
- package/dist/mcp/tools/integrations.d.ts.map +1 -1
- package/dist/mcp/tools/integrations.js +3 -0
- package/dist/mcp/tools/integrations.js.map +1 -1
- package/dist/mcp/tools/workflows.d.ts +12 -0
- package/dist/mcp/tools/workflows.d.ts.map +1 -1
- package/dist/mcp/tools/workflows.js +21 -0
- package/dist/mcp/tools/workflows.js.map +1 -1
- package/package.json +1 -1
|
@@ -37,8 +37,10 @@ If ambiguous, ask:
|
|
|
37
37
|
Run these in parallel before designing anything:
|
|
38
38
|
|
|
39
39
|
```
|
|
40
|
-
1. list_integration_tools
|
|
41
|
-
2. list_workflows
|
|
40
|
+
1. list_integration_tools → what data sources/actions are already connected + their operations
|
|
41
|
+
2. list_workflows → existing workflows (for naming/area conventions)
|
|
42
|
+
3. list_connector_catalog → integrations NOT yet connected, for recommending a fit
|
|
43
|
+
4. list_workflow_secrets → which ${{ secrets.X }} keys already exist (never their values)
|
|
42
44
|
```
|
|
43
45
|
|
|
44
46
|
Then ask the user (use AskUserQuestion for structured choices where applicable):
|
|
@@ -50,11 +52,21 @@ Then ask the user (use AskUserQuestion for structured choices where applicable):
|
|
|
50
52
|
- Work Item status change → `on: conductor.work_item.status_changed:`
|
|
51
53
|
- Manual run button → `on: workflow_dispatch:`
|
|
52
54
|
3. **What data or actions does it need?** (use `list_integration_tools` output to suggest connected options)
|
|
53
|
-
4. **Where do results go?** Discord
|
|
55
|
+
4. **Where do results go?** Discord/Slack post, create a Conductor issue, HTTP POST, etc.
|
|
54
56
|
|
|
55
57
|
If `list_integration_tools` shows relevant connected integrations, name them explicitly:
|
|
56
58
|
> "I can see Google Search Console is connected (operations: search_analytics, top_queries, top_pages). Should I use that as the data source?"
|
|
57
59
|
|
|
60
|
+
If the goal needs a data source or outbound action that **isn't** connected yet, check
|
|
61
|
+
`list_connector_catalog` and name the specific connector rather than falling back to a raw `http`
|
|
62
|
+
step silently:
|
|
63
|
+
> "Posting to Discord needs the Discord connector — it's not connected yet. Connect it under
|
|
64
|
+
> **Settings → Integrations**, or I can use a raw `http` step with a webhook secret instead."
|
|
65
|
+
|
|
66
|
+
If the design will reference `${{ secrets.SOME_KEY }}`, confirm it's in the `list_workflow_secrets`
|
|
67
|
+
result before designing around it — don't assume a secret exists because the user mentioned it.
|
|
68
|
+
Secrets are added under **Settings → Secrets**.
|
|
69
|
+
|
|
58
70
|
---
|
|
59
71
|
|
|
60
72
|
## Step 2 — Design
|
|
@@ -92,19 +104,30 @@ steps:
|
|
|
92
104
|
| Step type | `uses` value | When to use |
|
|
93
105
|
|-----------|-------------|-------------|
|
|
94
106
|
| Integration | `integration` | Connected data source (GSC, PostHog, RevenueCat, GCP Billing) |
|
|
107
|
+
| Action | `action` | Outbound side effect via a connector with the ACTION capability (e.g. `discord post_message`) |
|
|
95
108
|
| HTTP | `http` | Any REST API call; custom integrations |
|
|
96
109
|
| Docker | `docker://image` | Run a script or CLI tool in a container |
|
|
110
|
+
| Agent | `agent` | Hand a task to a named AI agent (Settings → Agents) |
|
|
111
|
+
| Claude Code | `claude-code` | Headless Claude Code (`claude -p`), full tool-calling loop, optional Conductor MCP access |
|
|
97
112
|
| Condition | `condition` | Branch to different jobs based on a runtime value |
|
|
98
113
|
| Kestra | `kestra` | Delegate to an existing Kestra flow |
|
|
99
114
|
|
|
115
|
+
Prefer `uses: action` over a raw `http` step with a webhook-secret whenever an action connector
|
|
116
|
+
exists for the target — same reasoning as preferring `integration` over `http` for reads:
|
|
117
|
+
credentials stay off the connector, never in the YAML.
|
|
118
|
+
|
|
100
119
|
### Reference: Interpolation
|
|
101
120
|
|
|
102
121
|
| Expression | Value |
|
|
103
122
|
|------------|-------|
|
|
104
123
|
| `${{ event.FIELD }}` | Trigger event payload field |
|
|
105
124
|
| `${{ secrets.SECRET_NAME }}` | Project secret (custom secrets only; integrations don't need this) |
|
|
125
|
+
| `${{ inputs.KEY }}` | A manual-dispatch input value (see `on.workflow_dispatch.inputs`) |
|
|
106
126
|
| `${{ steps.STEP_ID.outputs.KEY }}` | Output from a step in the current job |
|
|
127
|
+
| `${{ steps.STEP_ID.result }}` | Terminal result of a prior step: `success` / `failure` / `skipped` |
|
|
107
128
|
| `${{ needs.JOB_ID.outputs.KEY }}` | Output from a completed upstream job |
|
|
129
|
+
| `${{ needs.JOB_ID.result }}` | Terminal result of an upstream job: `success` / `failure` / `skipped` |
|
|
130
|
+
| `${{ needs.JOB_ID.artifacts.NAME }}` | Signed download URL for an artifact an upstream job produced |
|
|
108
131
|
| `${{ loop.iteration }}` | Current loop iteration (1-based) |
|
|
109
132
|
|
|
110
133
|
### Annotated example — Weekly SEO report
|
|
@@ -131,14 +154,70 @@ jobs:
|
|
|
131
154
|
runs-on: conductor
|
|
132
155
|
steps:
|
|
133
156
|
- id: notify
|
|
134
|
-
uses:
|
|
157
|
+
uses: action
|
|
135
158
|
with:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
159
|
+
connector: discord
|
|
160
|
+
action: post_message
|
|
161
|
+
input:
|
|
162
|
+
content: "📊 Weekly SEO Report\nTop pages: ${{ needs.fetch_seo.outputs.data }}"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Resilience patterns
|
|
168
|
+
|
|
169
|
+
These are the skill's key value-add for digest/report-style workflows: don't let one failed
|
|
170
|
+
collector job silently kill the whole report.
|
|
171
|
+
|
|
172
|
+
**`if: always()` / `if: failure()` on downstream jobs.** A digest job should usually still post even
|
|
173
|
+
if one collector failed — pair with `needs.JOB.result` to mark that section unavailable instead of
|
|
174
|
+
skipping the whole digest:
|
|
175
|
+
|
|
176
|
+
```yaml
|
|
177
|
+
digest:
|
|
178
|
+
needs: [collect_gsc, collect_posthog]
|
|
179
|
+
if: always()
|
|
180
|
+
steps:
|
|
181
|
+
- uses: action
|
|
182
|
+
with:
|
|
183
|
+
connector: discord
|
|
184
|
+
action: post_message
|
|
185
|
+
input:
|
|
186
|
+
content: "GSC (${{ needs.collect_gsc.result }}): ${{ needs.collect_gsc.outputs.data }}"
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Step-level `continue-on-error`.** Let one optional step fail without failing the job; branch later
|
|
190
|
+
steps on `${{ steps.ID.result }}`:
|
|
191
|
+
|
|
192
|
+
```yaml
|
|
193
|
+
- id: optional_lint
|
|
194
|
+
type: http
|
|
195
|
+
url: https://lint.example.com/check
|
|
196
|
+
continue-on-error: true
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Dispatch `inputs` for parameterized/backfill runs.** Declare `on.workflow_dispatch.inputs` so a
|
|
200
|
+
manual re-run (e.g. `dispatch_workflow` with `inputs: {date: "2026-06-01"}`) can target a specific
|
|
201
|
+
date/env rather than always running "now":
|
|
202
|
+
|
|
203
|
+
```yaml
|
|
204
|
+
on:
|
|
205
|
+
workflow_dispatch:
|
|
206
|
+
inputs:
|
|
207
|
+
date: { description: "Backfill date (YYYY-MM-DD)", required: false }
|
|
140
208
|
```
|
|
141
209
|
|
|
210
|
+
Reference it as `${{ inputs.date }}` anywhere in the workflow.
|
|
211
|
+
|
|
212
|
+
## Artifacts
|
|
213
|
+
|
|
214
|
+
For whole-file handoff between jobs (a build binary, a rendered report, a dataset) — not the small
|
|
215
|
+
string values `outputs:` is for — a `docker` or `claude-code` step declares `artifacts: [{name, path}]`
|
|
216
|
+
and a downstream job declares `consumes: [name]`. Reach for this when a job needs to hand a real file
|
|
217
|
+
to another job rather than a string. Note: `docker` artifact producers require `runs-on: self-hosted`
|
|
218
|
+
(the Conductor-hosted docker path doesn't support artifact upload); `claude-code` supports artifacts
|
|
219
|
+
on any runtime.
|
|
220
|
+
|
|
142
221
|
---
|
|
143
222
|
|
|
144
223
|
## Step 3 — Creation Loop
|
|
@@ -174,9 +253,10 @@ publish_workflow(workflowId)
|
|
|
174
253
|
|
|
175
254
|
### 3d. Test dispatch (optional)
|
|
176
255
|
|
|
177
|
-
dispatch_workflow(workflowId)
|
|
256
|
+
dispatch_workflow(workflowId, inputs?)
|
|
178
257
|
|
|
179
|
-
Offer to trigger a test run immediately so the user can see it work.
|
|
258
|
+
Offer to trigger a test run immediately so the user can see it work. Pass `inputs` if the workflow
|
|
259
|
+
declares `on.workflow_dispatch.inputs` (e.g. a backfill date) — otherwise omit it. Returns workflowId + runId.
|
|
180
260
|
|
|
181
261
|
After dispatching, call get_workflow_run once to check the run started:
|
|
182
262
|
|
|
@@ -184,6 +264,9 @@ get_workflow_run(workflowId, runId)
|
|
|
184
264
|
|
|
185
265
|
Don't poll — one check is enough since runs are async. Include the status in the final report to the user. A RUNNING or SUCCESS status means the workflow is live and executing.
|
|
186
266
|
|
|
267
|
+
For a scheduled or event-triggered workflow (no immediate dispatch to check), use
|
|
268
|
+
`list_workflow_runs(workflowId)` later to see whether it has actually fired since going live.
|
|
269
|
+
|
|
187
270
|
---
|
|
188
271
|
|
|
189
272
|
## Step 4 — Report to User
|
|
@@ -267,10 +350,10 @@ publish_workflow(workflowId) // DRAFT → PUBLISHED
|
|
|
267
350
|
These rules apply regardless of the user's request. Never deviate from them.
|
|
268
351
|
|
|
269
352
|
1. **Always call `list_integration_tools` before designing** — never guess what integrations are available from secret key names or conversation context.
|
|
270
|
-
2. **Use `uses: integration` for any connected integration
|
|
353
|
+
2. **Use `uses: integration` for reads and `uses: action` for outbound side effects** on any connected integration — credentials must never appear in workflow YAML.
|
|
271
354
|
3. **Always call `get_workflow` after `create_workflow`** — close the observability loop before publishing.
|
|
272
355
|
4. **DRAFT is the safe buffer** — only call `publish_workflow` when the design is fully confirmed.
|
|
273
356
|
5. **Fix publish errors in place** — call `update_workflow` and retry; never call `create_workflow` a second time for the same workflow.
|
|
274
|
-
6. **
|
|
357
|
+
6. **Never invent connector IDs** — use `list_integration_tools` for what's connected, `list_connector_catalog` for what's available but not yet connected. Same for secrets: verify with `list_workflow_secrets` before designing around a `${{ secrets.X }}` reference.
|
|
275
358
|
7. **Register a custom skill before binding it** — for a statechart `skill` step whose id is not a built-in or
|
|
276
359
|
already registered (`list_skills`), call `register_skill` first, or Publish will reject the definition.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAyBnC,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoIrD"}
|
package/dist/commands/config.js
CHANGED
|
@@ -10,6 +10,11 @@ function redactApiKey(apiKey) {
|
|
|
10
10
|
return '***';
|
|
11
11
|
return `${apiKey.slice(0, 4)}...${apiKey.slice(-4)}`;
|
|
12
12
|
}
|
|
13
|
+
function redactToken(token) {
|
|
14
|
+
if (!token)
|
|
15
|
+
return 'not set';
|
|
16
|
+
return redactApiKey(token);
|
|
17
|
+
}
|
|
13
18
|
export function registerConfig(program) {
|
|
14
19
|
const config = program
|
|
15
20
|
.command('config')
|
|
@@ -43,6 +48,7 @@ Examples:
|
|
|
43
48
|
projectName: cfg.projectName,
|
|
44
49
|
email: cfg.email,
|
|
45
50
|
apiKey: redactApiKey(cfg.apiKey),
|
|
51
|
+
claudeCodeOauthToken: redactToken(cfg.claudeCodeOauthToken),
|
|
46
52
|
};
|
|
47
53
|
process.stdout.write(JSON.stringify(output, null, 2) + '\n');
|
|
48
54
|
process.exit(0);
|
|
@@ -53,6 +59,7 @@ Examples:
|
|
|
53
59
|
console.log(`projectName: ${cfg.projectName}`);
|
|
54
60
|
console.log(`email: ${cfg.email}`);
|
|
55
61
|
console.log(`apiKey: ${redactApiKey(cfg.apiKey)}`);
|
|
62
|
+
console.log(`claudeCodeOauthToken: ${redactToken(cfg.claudeCodeOauthToken)}`);
|
|
56
63
|
});
|
|
57
64
|
config
|
|
58
65
|
.command('use <env>')
|
|
@@ -102,5 +109,36 @@ Examples:
|
|
|
102
109
|
writeConfig(cfg);
|
|
103
110
|
console.log(`API URL updated to: ${url}`);
|
|
104
111
|
});
|
|
112
|
+
config
|
|
113
|
+
.command('set-claude-code-oauth-token <token>')
|
|
114
|
+
.description('Store a Claude Code subscription token (from `claude setup-token`) for the claude-code workflow step')
|
|
115
|
+
.addHelpText('after', `
|
|
116
|
+
Examples:
|
|
117
|
+
conductor config set-claude-code-oauth-token sk-ant-oat01-...`)
|
|
118
|
+
.action((token) => {
|
|
119
|
+
const cfg = readConfig();
|
|
120
|
+
if (!cfg) {
|
|
121
|
+
console.error('No config found — run conductor login first');
|
|
122
|
+
process.exit(1);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
cfg.claudeCodeOauthToken = token;
|
|
126
|
+
writeConfig(cfg);
|
|
127
|
+
console.log(`Claude Code OAuth token saved: ${redactToken(token)}`);
|
|
128
|
+
});
|
|
129
|
+
config
|
|
130
|
+
.command('unset-claude-code-oauth-token')
|
|
131
|
+
.description('Remove the stored Claude Code subscription token')
|
|
132
|
+
.action(() => {
|
|
133
|
+
const cfg = readConfig();
|
|
134
|
+
if (!cfg) {
|
|
135
|
+
console.error('No config found — run conductor login first');
|
|
136
|
+
process.exit(1);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
delete cfg.claudeCodeOauthToken;
|
|
140
|
+
writeConfig(cfg);
|
|
141
|
+
console.log('Claude Code OAuth token removed.');
|
|
142
|
+
});
|
|
105
143
|
}
|
|
106
144
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAO1D,MAAM,OAAO,GAA2B;IACtC,IAAI,EAAE;QACJ,MAAM,EAAE,4DAA4D;QACpE,WAAW,EAAE,6DAA6D;KAC3E;CACF,CAAA;AAED,SAAS,YAAY,CAAC,MAAc;IAClC,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,KAAK,CAAA;IACpC,OAAO,GAAG,MAAM,CAAC,KAA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AC,GAAG,CAAC,CAAA;QAChB,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Config } from '../lib/config.js';
|
|
2
|
+
/**
|
|
3
|
+
* Pointer-only daemon event for the per-job dispatch protocol ("protocol 2").
|
|
4
|
+
* Carries no secrets/env — the daemon fetches the interpolated dispatch
|
|
5
|
+
* payload (env, steps, run token) at pickup. The events API delivers
|
|
6
|
+
* {eventId, type, payload: {...}}; the watcher flattens the payload into
|
|
7
|
+
* this top-level shape before enqueueing.
|
|
8
|
+
*/
|
|
9
|
+
export interface WorkflowJobEvent {
|
|
10
|
+
eventId: string;
|
|
11
|
+
type: string;
|
|
12
|
+
protocol: 2;
|
|
13
|
+
workflowRunId: string;
|
|
14
|
+
jobId: string;
|
|
15
|
+
jobRunId: string;
|
|
16
|
+
projectId: string;
|
|
17
|
+
workflowName: string;
|
|
18
|
+
}
|
|
19
|
+
/** One declared producer artifact — {@link DispatchStep.artifacts}. */
|
|
20
|
+
export interface DispatchArtifact {
|
|
21
|
+
name: string;
|
|
22
|
+
path: string;
|
|
23
|
+
}
|
|
24
|
+
/** One resolved consumed artifact — {@link DispatchPayload.consumedArtifacts}. */
|
|
25
|
+
export interface ConsumedArtifact {
|
|
26
|
+
name: string;
|
|
27
|
+
downloadUrl: string;
|
|
28
|
+
}
|
|
29
|
+
export interface DispatchStep {
|
|
30
|
+
stepIndex: number;
|
|
31
|
+
workerJobId: string;
|
|
32
|
+
stepId: string;
|
|
33
|
+
stepName: string;
|
|
34
|
+
stepType: string;
|
|
35
|
+
prompt?: string;
|
|
36
|
+
env?: Record<string, string>;
|
|
37
|
+
timeoutMinutes?: number;
|
|
38
|
+
conductorMcp?: boolean;
|
|
39
|
+
allowedTools?: string;
|
|
40
|
+
maxTurns?: number;
|
|
41
|
+
inputsJson?: string;
|
|
42
|
+
outputSchemaJson?: string;
|
|
43
|
+
/** This step's declared `artifacts:` (docker/claude-code only). Optional/additive. */
|
|
44
|
+
artifacts?: DispatchArtifact[];
|
|
45
|
+
}
|
|
46
|
+
export interface DispatchPayload {
|
|
47
|
+
jobRunId: string;
|
|
48
|
+
protocol: number;
|
|
49
|
+
image?: string;
|
|
50
|
+
env: Record<string, string>;
|
|
51
|
+
steps: DispatchStep[];
|
|
52
|
+
runToken: string;
|
|
53
|
+
callbacks: {
|
|
54
|
+
logChunkUrlTemplate: string;
|
|
55
|
+
stepCompleteUrlTemplate: string;
|
|
56
|
+
};
|
|
57
|
+
/** Internal base URL for this run's artifact endpoints. Present iff any step declares artifacts. */
|
|
58
|
+
artifactsUrl?: string;
|
|
59
|
+
/** This job's `consumes:` artifacts, pre-resolved to signed download URLs. Optional/additive. */
|
|
60
|
+
consumedArtifacts?: ConsumedArtifact[];
|
|
61
|
+
}
|
|
62
|
+
export declare const DEFAULT_RUNNER_IMAGE = "ghcr.io/cliangdev/conductor-runner:3";
|
|
63
|
+
export declare const DEFAULT_TIMEOUT_MINUTES = 30;
|
|
64
|
+
/** Fills a `{workerJobId}` placeholder in a callback URL template. Templates
|
|
65
|
+
* with no placeholder (e.g. a run-scoped log-chunk URL) are returned as-is. */
|
|
66
|
+
export declare function fillTemplate(template: string, workerJobId: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* Assembles the container env contract for a single step: job-level payload
|
|
69
|
+
* env, overridden by step-level env, overridden by the CONDUCTOR_* contract
|
|
70
|
+
* vars. `ANTHROPIC_API_KEY` is stripped unconditionally — self-hosted jobs
|
|
71
|
+
* must never carry it, even if it leaked into the payload's env — since it
|
|
72
|
+
* silently overrides subscription auth in `claude -p`.
|
|
73
|
+
*/
|
|
74
|
+
export declare function buildStepEnv(payload: DispatchPayload, step: DispatchStep, event: WorkflowJobEvent, config: Config, stepCompleteUrl: string, logChunkUrl: string): Record<string, string>;
|
|
75
|
+
/**
|
|
76
|
+
* Handles a single `workflow.job` event end-to-end: fetches the interpolated
|
|
77
|
+
* dispatch payload, runs each step sequentially (stopping at the first
|
|
78
|
+
* failure), posts the job-level completion, then acks the event.
|
|
79
|
+
*/
|
|
80
|
+
export declare function runWorkflowJob(event: WorkflowJobEvent, config: Config): Promise<void>;
|
|
81
|
+
//# sourceMappingURL=job-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-runner.d.ts","sourceRoot":"","sources":["../../src/daemon/job-runner.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAM9C;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,CAAC,CAAA;IACX,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,uEAAuE;AACvE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED,kFAAkF;AAClF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,YAAY,CAAC,EA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