@miller-tech/uap 1.133.2 → 1.135.1
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/dist/.tsbuildinfo +1 -1
- package/dist/bin/cli.js +4 -1
- package/dist/bin/cli.js.map +1 -1
- package/dist/cli/config-command.d.ts +49 -0
- package/dist/cli/config-command.d.ts.map +1 -0
- package/dist/cli/config-command.js +465 -0
- package/dist/cli/config-command.js.map +1 -0
- package/dist/cli/config-wizard.d.ts +13 -0
- package/dist/cli/config-wizard.d.ts.map +1 -0
- package/dist/cli/config-wizard.js +134 -0
- package/dist/cli/config-wizard.js.map +1 -0
- package/dist/cli/deliver.js +11 -2
- package/dist/cli/deliver.js.map +1 -1
- package/dist/cli/guided-setup.d.ts.map +1 -1
- package/dist/cli/guided-setup.js +11 -0
- package/dist/cli/guided-setup.js.map +1 -1
- package/dist/cli/policy.d.ts.map +1 -1
- package/dist/cli/policy.js +34 -0
- package/dist/cli/policy.js.map +1 -1
- package/dist/cli/setup.d.ts +1 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +22 -0
- package/dist/cli/setup.js.map +1 -1
- package/dist/config/policy-recommendations.d.ts +29 -0
- package/dist/config/policy-recommendations.d.ts.map +1 -0
- package/dist/config/policy-recommendations.js +108 -0
- package/dist/config/policy-recommendations.js.map +1 -0
- package/dist/config/settings-registry.d.ts +65 -0
- package/dist/config/settings-registry.d.ts.map +1 -0
- package/dist/config/settings-registry.js +334 -0
- package/dist/config/settings-registry.js.map +1 -0
- package/dist/dashboard/controls.d.ts +66 -0
- package/dist/dashboard/controls.d.ts.map +1 -0
- package/dist/dashboard/controls.js +188 -0
- package/dist/dashboard/controls.js.map +1 -0
- package/dist/dashboard/data-service.d.ts +20 -0
- package/dist/dashboard/data-service.d.ts.map +1 -1
- package/dist/dashboard/data-service.js +47 -0
- package/dist/dashboard/data-service.js.map +1 -1
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +81 -5
- package/dist/dashboard/server.js.map +1 -1
- package/dist/delivery/convergence-loop.d.ts +5 -0
- package/dist/delivery/convergence-loop.d.ts.map +1 -1
- package/dist/delivery/convergence-loop.js +11 -0
- package/dist/delivery/convergence-loop.js.map +1 -1
- package/dist/delivery/run-state.d.ts +12 -0
- package/dist/delivery/run-state.d.ts.map +1 -1
- package/dist/delivery/run-state.js +58 -1
- package/dist/delivery/run-state.js.map +1 -1
- package/docs/DASHBOARD_UPLIFT_SPEC.md +171 -0
- package/docs/INDEX.md +2 -0
- package/docs/guides/POLICY_SELECTION.md +98 -0
- package/docs/reference/CONFIGURATION_REFERENCE.md +688 -0
- package/package.json +1 -1
- package/src/policies/enforcers/__pycache__/_common.cpython-312.pyc +0 -0
- package/tools/agents/scripts/__pycache__/toolcall_path_normalizer.cpython-312.pyc +0 -0
- package/tools/agents/scripts/anthropic_proxy.py +164 -12
- package/web/dash/core.js +398 -0
- package/web/dash/styles.css +307 -0
- package/web/dash/tab-deliver.js +12 -0
- package/web/dash/tab-memory.js +12 -0
- package/web/dash/tab-models.js +12 -0
- package/web/dash/tab-policies.js +12 -0
- package/web/dash/tabs.js +581 -0
- package/web/dashboard.html +12 -1303
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UAP Settings Registry — the single source of truth for every user-facing
|
|
3
|
+
* setting UAP exposes.
|
|
4
|
+
*
|
|
5
|
+
* This one catalog powers three things so they can never drift:
|
|
6
|
+
* - `uap config` (list / get / set / explain / doctor)
|
|
7
|
+
* - the `uap setup --profile custom` expert wizard
|
|
8
|
+
* - the generated `docs/reference/CONFIGURATION_REFERENCE.md`
|
|
9
|
+
*
|
|
10
|
+
* Two kinds of setting:
|
|
11
|
+
* - kind 'json' — a field in `.uap.json` (persistent, first-class). `path` is
|
|
12
|
+
* the dotted location; `uap config set` writes it via modifyUapConfig.
|
|
13
|
+
* - kind 'env' — an environment variable. `target: 'proxyEnv'` persists to
|
|
14
|
+
* `.uap/proxy.env` (loaded by the inference proxy); `target: 'shell'` is a
|
|
15
|
+
* runtime toggle read from the process env by hooks/CLI, so `set` prints the
|
|
16
|
+
* export line to add rather than pretending to persist it.
|
|
17
|
+
*
|
|
18
|
+
* Adding a setting here automatically surfaces it in the CLI, the wizard, and
|
|
19
|
+
* the docs. Keep descriptions plain-language (what it does) and recommendations
|
|
20
|
+
* actionable (what to pick and when).
|
|
21
|
+
*/
|
|
22
|
+
export const CATEGORIES = [
|
|
23
|
+
{ id: 'delivery', title: 'Delivery & enforcement', blurb: 'Whether coding routes through `uap deliver` and how hard the gates block.' },
|
|
24
|
+
{ id: 'verification', title: 'Verification gates', blurb: 'Proving generated code actually builds and runs before "done".' },
|
|
25
|
+
{ id: 'routing', title: 'Model routing', blurb: 'Which model handles planning, execution, and review.' },
|
|
26
|
+
{ id: 'recipes', title: 'Serving recipes & escalation', blurb: 'Confidence/fusion recipes and the judge model that grades a local model.' },
|
|
27
|
+
{ id: 'memory', title: 'Memory', blurb: 'Short-term recall, long-term semantic memory, and pattern RAG.' },
|
|
28
|
+
{ id: 'concurrency', title: 'Concurrency & model slots', blurb: 'How many agents/inference slots run in parallel before backpressure.' },
|
|
29
|
+
{ id: 'collaboration', title: 'Multi-agent collaboration', blurb: 'The shared coordination board and file-overlap protection.' },
|
|
30
|
+
{ id: 'orchestration', title: 'Orchestrator & hands-free', blurb: 'Long-task autonomy: decompose, resume, and loop-to-100%.' },
|
|
31
|
+
{ id: 'reactor', title: 'Reactor (auto-apply)', blurb: 'Per-prompt injection of the matching experts, skills, and patterns.' },
|
|
32
|
+
{ id: 'design', title: 'Design system', blurb: 'DESIGN.md interrogation and the hard token gate for UI work.' },
|
|
33
|
+
{ id: 'worktree', title: 'Worktree workflow', blurb: 'Branch-per-feature isolation and auto-cleanup.' },
|
|
34
|
+
{ id: 'proxy', title: 'Inference proxy tuning', blurb: 'Guardrails and context limits for a local model behind the proxy.' },
|
|
35
|
+
{ id: 'dashboard', title: 'Dashboard', blurb: 'The live analytics server and its mutation token.' },
|
|
36
|
+
{ id: 'optimization', title: 'Token & time optimization', blurb: 'Context budgets, caching, batching, and parallelism.' },
|
|
37
|
+
{ id: 'general', title: 'General', blurb: 'Project metadata and CLI behavior.' },
|
|
38
|
+
];
|
|
39
|
+
// A tuned local model with real gates is the reference environment for the
|
|
40
|
+
// recommendations below; cloud-model users can relax the guardrail-heavy knobs.
|
|
41
|
+
export const SETTINGS = [
|
|
42
|
+
// ── Delivery & enforcement ────────────────────────────────────────────────
|
|
43
|
+
{
|
|
44
|
+
key: 'delivery.enforcement', kind: 'json', type: 'enum', enumValues: ['block', 'advisory', 'off'],
|
|
45
|
+
default: 'block', category: 'delivery',
|
|
46
|
+
description: 'How the delivery gate treats a direct source edit outside `uap deliver`. `block` refuses it (exit 2), `advisory` warns but allows, `off` disables the gate. (The `UAP_ENFORCE_DELIVERY` env var overrides this at runtime.)',
|
|
47
|
+
recommendation: '`block` for hands-free/local-model work so every change is gated and verified; `advisory` when a capable human/Opus is driving and you want warnings without friction.',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
key: 'delivery.localMode', kind: 'json', type: 'enum', enumValues: ['advisory', 'deliver', 'block'],
|
|
51
|
+
default: 'advisory', category: 'delivery',
|
|
52
|
+
description: 'How local-model sessions are routed through delivery. `deliver` runs builds through the convergence loop; `block` forbids raw edits; `advisory` warns.',
|
|
53
|
+
recommendation: '`deliver` when a local model does the writing (routes it through the verified loop); `advisory` for exploratory work.',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: 'UAP_ENFORCE_DELIVERY', kind: 'env', type: 'enum', enumValues: ['block', 'advisory', 'off'],
|
|
57
|
+
default: 'block', category: 'delivery', target: 'shell',
|
|
58
|
+
description: 'Runtime override of the delivery gate read by the hooks/enforcers from the shell env. Takes precedence over `delivery.enforcement`.',
|
|
59
|
+
recommendation: 'Leave UNSET so it defaults to `block`. Exporting `advisory` globally leaks into every shell and silently disables the gate + the delivery-enforcement tests — set it inline per-command if you must.',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
key: 'UAP_DELIVER_BYPASS', kind: 'env', type: 'boolean', default: false, category: 'delivery', target: 'shell',
|
|
63
|
+
description: 'When set to 1 for a single command, exempts that one sanctioned manual edit from the delivery gate.',
|
|
64
|
+
recommendation: 'Use inline (`UAP_DELIVER_BYPASS=1 <cmd>`) for a one-off edit; never export it.',
|
|
65
|
+
},
|
|
66
|
+
// ── Verification gates ────────────────────────────────────────────────────
|
|
67
|
+
{
|
|
68
|
+
key: 'delivery.runtimeVerify', kind: 'json', type: 'boolean', default: false, category: 'verification',
|
|
69
|
+
description: 'Installs the runtime-verify Stop-hook: at end of turn it actually runs the changed code (headless / vm-dom / child-process) and blocks stopping on a genuine runtime failure.',
|
|
70
|
+
recommendation: 'Enable for any project with a runnable artifact — it catches "declared done but never ran". Safe on empty projects (it skips when nothing is runnable).',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
key: 'UAP_VERIFY_ON_STOP', kind: 'env', type: 'boolean', default: true, category: 'verification', target: 'shell',
|
|
74
|
+
description: 'Master switch for the runtime execution gate in the Stop hook. `0` bypasses it.',
|
|
75
|
+
recommendation: 'Leave on (default). Set `0` only to unblock a session where the runtime gate misfires.',
|
|
76
|
+
},
|
|
77
|
+
// ── Model routing ─────────────────────────────────────────────────────────
|
|
78
|
+
{
|
|
79
|
+
key: 'multiModel.enabled', kind: 'json', type: 'boolean', default: false, category: 'routing',
|
|
80
|
+
description: 'Turns on multi-model routing (distinct planner/executor/reviewer models) instead of a single model for everything.',
|
|
81
|
+
recommendation: 'Enable to pair a cheap local executor with a strong cloud reviewer. Configure via `uap model routing use <preset>`.',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
key: 'multiModel.routingStrategy', kind: 'json', type: 'enum',
|
|
85
|
+
enumValues: ['cost-optimized', 'performance-first', 'balanced', 'adaptive'],
|
|
86
|
+
default: 'balanced', category: 'routing',
|
|
87
|
+
description: 'How the router trades cost against capability when picking a model per task.',
|
|
88
|
+
recommendation: '`cost-optimized` for local-first setups, `performance-first` for all-cloud hot paths, `balanced`/`adaptive` otherwise.',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
key: 'ANTHROPIC_PASSTHROUGH_MODELS', kind: 'env', type: 'string', default: '', category: 'routing', target: 'proxyEnv',
|
|
92
|
+
description: 'Comma-separated model IDs the proxy forwards to Anthropic instead of serving locally. The sentinel `__local_only__` forces every model ID onto the local Qwen.',
|
|
93
|
+
recommendation: 'Set automatically by `uap model routing use`. Use `__local_only__` for a fully offline setup; list cloud IDs for a hybrid local+cloud routing preset.',
|
|
94
|
+
},
|
|
95
|
+
// ── Serving recipes & escalation ──────────────────────────────────────────
|
|
96
|
+
{
|
|
97
|
+
key: 'recipes.enabled', kind: 'json', type: 'boolean', default: false, category: 'recipes',
|
|
98
|
+
description: 'Enables serving-layer recipes (confidence escalation, fusion, ratings) in front of the local model.',
|
|
99
|
+
recommendation: 'Enable for a local model when you have a stronger judge model available — it materially lifts output quality.',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
key: 'recipes.recipe', kind: 'json', type: 'enum',
|
|
103
|
+
enumValues: ['auto', 'single', 'confidence', 'fusion', 'ratings', 'remom'],
|
|
104
|
+
default: 'auto', category: 'recipes',
|
|
105
|
+
description: 'Which recipe to apply. `confidence` escalates only low-confidence turns to the judge; `fusion` samples N and judges; `auto` picks per-signal.',
|
|
106
|
+
recommendation: '`auto` is the safe default; `confidence` for the best cost/quality trade when the judge is expensive.',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
key: 'recipes.confidenceThreshold', kind: 'json', type: 'number', min: 0, max: 1, default: 0.5, category: 'recipes',
|
|
110
|
+
description: 'Below this confidence, a turn is escalated to the judge model.',
|
|
111
|
+
recommendation: '0.5 to start; raise toward 0.7 to escalate more often (higher quality, higher cost).',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
key: 'recipes.fusionN', kind: 'json', type: 'number', int: true, min: 2, max: 6, default: 3, category: 'recipes',
|
|
115
|
+
description: 'How many candidate samples the fusion recipe generates before the judge picks/merges.',
|
|
116
|
+
recommendation: '3 balances quality and cost; 5 for hard tasks if you can afford the samples.',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
key: 'recipes.allowSelfJudge', kind: 'json', type: 'boolean', default: false, category: 'recipes',
|
|
120
|
+
description: 'Allows the generating model to also act as its own judge (generator == evaluator).',
|
|
121
|
+
recommendation: 'Keep `false` — a distinct, stronger judge is what adds the lift. Only allow self-judge if no separate judge is available.',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
key: 'recipes.judge.model', kind: 'json', type: 'string', default: null, category: 'recipes',
|
|
125
|
+
description: 'The model ID used to grade/escalate. Must be distinct from and stronger than the executor to help.',
|
|
126
|
+
recommendation: 'Point at your strongest available model (e.g. an Opus/Sonnet cloud ID) even if the executor is local.',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
key: 'PROXY_ESCALATE_API_KEY', kind: 'env', type: 'string', default: null, category: 'recipes', target: 'proxyEnv', secret: true,
|
|
130
|
+
description: 'API key for the judge/escalation model endpoint.',
|
|
131
|
+
recommendation: 'Store only in `.uap/proxy.env` (chmod 600) — never in `.uap.json`. `uap config set` writes it there.',
|
|
132
|
+
},
|
|
133
|
+
// ── Memory ────────────────────────────────────────────────────────────────
|
|
134
|
+
{
|
|
135
|
+
key: 'memory.longTerm.enabled', kind: 'json', type: 'boolean', default: true, category: 'memory',
|
|
136
|
+
description: 'Enables long-term semantic memory (vector recall across sessions) via Qdrant.',
|
|
137
|
+
recommendation: 'Keep on — cross-session recall is a core value. Requires a running Qdrant (`uap memory start`).',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
key: 'memory.longTerm.provider', kind: 'json', type: 'enum',
|
|
141
|
+
enumValues: ['qdrant', 'chroma', 'pinecone', 'github', 'qdrant-cloud', 'serverless', 'none'],
|
|
142
|
+
default: 'qdrant', category: 'memory',
|
|
143
|
+
description: 'The long-term memory backend.',
|
|
144
|
+
recommendation: '`qdrant` (local) for privacy/speed; `qdrant-cloud` or `github` if you want memory to follow you across machines.',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
key: 'memory.shortTerm.maxEntries', kind: 'json', type: 'number', default: 50, category: 'memory',
|
|
148
|
+
description: 'How many recent short-term entries are retained/injected per session.',
|
|
149
|
+
recommendation: '50 is a good default; raise for long, context-heavy sessions if token budget allows.',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
key: 'memory.patternRag.enabled', kind: 'json', type: 'boolean', default: false, category: 'memory',
|
|
153
|
+
description: 'Enables pattern RAG — semantic retrieval of the 23 execution patterns to steer the agent.',
|
|
154
|
+
recommendation: 'Enable for local models (patterns compensate for weaker planning); optional for frontier models.',
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
key: 'QDRANT_URL', kind: 'env', type: 'string', default: 'http://localhost:6333', category: 'memory', target: 'shell',
|
|
158
|
+
description: 'Qdrant endpoint for long-term/pattern memory.',
|
|
159
|
+
recommendation: 'Leave default for local Qdrant; point at your cloud cluster URL for `qdrant-cloud`.',
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
key: 'QDRANT_API_KEY', kind: 'env', type: 'string', default: null, category: 'memory', target: 'shell', secret: true,
|
|
163
|
+
description: 'API key for a cloud Qdrant cluster.',
|
|
164
|
+
recommendation: 'Only needed for `qdrant-cloud`. Keep it in your shell env / secret store, not in `.uap.json`.',
|
|
165
|
+
},
|
|
166
|
+
// ── Concurrency & model slots ─────────────────────────────────────────────
|
|
167
|
+
{
|
|
168
|
+
key: 'modelConcurrency.slots', kind: 'json', type: 'number', int: true, min: 1, default: null, category: 'concurrency',
|
|
169
|
+
description: 'How many inference slots the local server exposes; the lease system caps parallel agents to this.',
|
|
170
|
+
recommendation: 'Set to your llama.cpp `--parallel` value so fan-out never exhausts the server. Leave null to auto-probe.',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
key: 'modelConcurrency.headroom', kind: 'json', type: 'number', int: true, min: 0, default: null, category: 'concurrency',
|
|
174
|
+
description: 'Slots to hold back from the budget so the interactive session never starves behind background agents.',
|
|
175
|
+
recommendation: 'Reserve 1 on small servers so foreground work stays responsive.',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
key: 'modelConcurrency.adaptive', kind: 'json', type: 'boolean', default: true, category: 'concurrency',
|
|
179
|
+
description: 'AIMD backpressure: shrinks the effective slot budget on exhaustion signals (429/timeouts) and recovers over time.',
|
|
180
|
+
recommendation: 'Keep on — it prevents overload cascades when many agents run at once.',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
key: 'UAP_MAX_PARALLEL', kind: 'env', type: 'number', default: 4, category: 'concurrency', target: 'shell',
|
|
184
|
+
description: 'Upper bound on parallel agent/tool fan-out regardless of slot budget.',
|
|
185
|
+
recommendation: 'Match to CPU/GPU capacity; 4 is a safe default, lower it on constrained hosts.',
|
|
186
|
+
},
|
|
187
|
+
// ── Multi-agent collaboration ─────────────────────────────────────────────
|
|
188
|
+
{
|
|
189
|
+
key: 'collaboration.mode', kind: 'json', type: 'enum', enumValues: ['auto', 'always', 'off'],
|
|
190
|
+
default: 'auto', category: 'collaboration',
|
|
191
|
+
description: 'The shared coordination board + live file-overlap protection. `always` injects the board every turn; `auto` only when peers are active; `off` disables it.',
|
|
192
|
+
recommendation: '`auto` for solo work, `always` when multiple agents/worktrees run concurrently so they compound instead of colliding.',
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
key: 'coordination.deployBatching', kind: 'json', type: 'boolean', default: true, category: 'collaboration',
|
|
196
|
+
description: 'Batches git/deploy actions across agents to avoid conflicting concurrent pushes.',
|
|
197
|
+
recommendation: 'Keep on for multi-agent setups.',
|
|
198
|
+
},
|
|
199
|
+
// ── Orchestrator & hands-free ─────────────────────────────────────────────
|
|
200
|
+
{
|
|
201
|
+
key: 'handsfree.enabled', kind: 'json', type: 'boolean', default: false, category: 'orchestration',
|
|
202
|
+
description: 'Forces any model to keep working until a multi-epic completion ledger is 100% done, instead of stopping early.',
|
|
203
|
+
recommendation: 'Enable for large autonomous builds; leave off for interactive/exploratory sessions.',
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
key: 'handsfree.intensity', kind: 'json', type: 'enum', enumValues: ['gentle', 'normal', 'aggressive'],
|
|
207
|
+
default: 'normal', category: 'orchestration',
|
|
208
|
+
description: 'How hard hands-free pushes back against early stops before the ledger is complete.',
|
|
209
|
+
recommendation: '`normal` for most work; `aggressive` for unattended overnight runs; `gentle` if the model over-persists on dead ends.',
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
key: 'UAP_HANDSFREE_STAGNATION_LIMIT', kind: 'env', type: 'number', default: 8, category: 'orchestration', target: 'shell',
|
|
213
|
+
description: 'Consecutive no-progress turns before hands-free breaks the loop instead of pushing on.',
|
|
214
|
+
recommendation: 'Lower (e.g. 5) if runs waste turns stuck; raise for genuinely long-horizon tasks.',
|
|
215
|
+
},
|
|
216
|
+
// ── Reactor ───────────────────────────────────────────────────────────────
|
|
217
|
+
{
|
|
218
|
+
key: 'reactor.enabled', kind: 'json', type: 'boolean', default: true, category: 'reactor',
|
|
219
|
+
description: 'Per-prompt injection of the experts, skills, and patterns that match what you just asked — so relevant capability is on the bench before the agent starts.',
|
|
220
|
+
recommendation: 'Keep on. Disable only to debug prompt bloat or measure the reactor\'s own contribution.',
|
|
221
|
+
},
|
|
222
|
+
// ── Design system ─────────────────────────────────────────────────────────
|
|
223
|
+
{
|
|
224
|
+
key: 'design.enabled', kind: 'json', type: 'boolean', default: false, category: 'design',
|
|
225
|
+
description: 'Turns on DESIGN.md: the agent interrogates and lints UI work against your design brief.',
|
|
226
|
+
recommendation: 'Enable for any project with a UI so design work starts from intent, not a guess.',
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
key: 'design.tokenGate', kind: 'json', type: 'boolean', default: false, category: 'design',
|
|
230
|
+
description: 'Hard-blocks UI edits that hardcode off-token colors or off-scale spacing.',
|
|
231
|
+
recommendation: 'Enable once your DESIGN.md tokens are stable — it keeps the UI on-system automatically.',
|
|
232
|
+
},
|
|
233
|
+
// ── Worktree workflow ─────────────────────────────────────────────────────
|
|
234
|
+
{
|
|
235
|
+
key: 'worktrees.enabled', kind: 'json', type: 'boolean', default: true, category: 'worktree',
|
|
236
|
+
description: 'Branch-per-feature isolation: edits happen in `.worktrees/NNN-slug/`, never the working tree, with auto-PR.',
|
|
237
|
+
recommendation: 'Keep on for any team or multi-agent workflow; it is the safety net against clobbering `main`.',
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
key: 'worktrees.branchPrefix', kind: 'json', type: 'string', default: 'feature/', category: 'worktree',
|
|
241
|
+
description: 'Prefix for auto-created worktree branches.',
|
|
242
|
+
recommendation: 'Match your team\'s branch convention (e.g. `feat/`, `fix/`).',
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
key: 'worktrees.autoCleanup', kind: 'json', type: 'boolean', default: true, category: 'worktree',
|
|
246
|
+
description: 'Removes a worktree automatically once its branch is merged/unchanged.',
|
|
247
|
+
recommendation: 'Keep on to avoid a pile of stale worktrees.',
|
|
248
|
+
},
|
|
249
|
+
// ── Inference proxy tuning (curated high-impact subset) ────────────────────
|
|
250
|
+
{
|
|
251
|
+
key: 'PROXY_CONTEXT_WINDOW', kind: 'env', type: 'number', default: 65536, category: 'proxy', target: 'proxyEnv',
|
|
252
|
+
description: 'The context window the proxy advertises/enforces for the local model. Must match the server\'s KV allocation.',
|
|
253
|
+
recommendation: 'Set to your llama.cpp per-slot context size. Too high overflows KV; too low truncates history.',
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
key: 'PROXY_CONCURRENCY_LIMIT', kind: 'env', type: 'number', default: null, category: 'proxy', target: 'proxyEnv',
|
|
257
|
+
description: 'Max concurrent upstream generations the proxy admits before queuing.',
|
|
258
|
+
recommendation: 'Match to the server\'s parallel slots so the proxy queues instead of overloading the model.',
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
key: 'PROXY_LOOP_BREAKER', kind: 'env', type: 'boolean', default: true, category: 'proxy', target: 'proxyEnv',
|
|
262
|
+
description: 'Breaks no-progress generation loops by forcing a single non-streaming call.',
|
|
263
|
+
recommendation: 'Keep on for local models — it is a core reliability guardrail.',
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
key: 'PROXY_STUCK_BREAK', kind: 'env', type: 'boolean', default: true, category: 'proxy', target: 'proxyEnv',
|
|
267
|
+
description: 'When the model self-reports "stuck" but keeps repeating the same failing tool, releases it to a prose exit.',
|
|
268
|
+
recommendation: 'Keep on for local models; harmless for cloud models (rarely triggers).',
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
key: 'PROXY_RECON_CONVERGENCE_THRESHOLD', kind: 'env', type: 'number', default: 40, category: 'proxy', target: 'proxyEnv',
|
|
272
|
+
description: 'After this many read-only (no-write) turns, the proxy forces synthesis/`deliver` so the model stops exploring forever.',
|
|
273
|
+
recommendation: '40 is balanced; lower it (e.g. 20) if local sessions over-explore before writing.',
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
key: 'PROXY_RECIPE', kind: 'env', type: 'enum', enumValues: ['auto', 'single', 'confidence', 'fusion', 'ratings', 'remom'],
|
|
277
|
+
default: 'auto', category: 'proxy', target: 'proxyEnv',
|
|
278
|
+
description: 'The serving recipe the proxy applies (mirror of `recipes.recipe`, consumed by the proxy process).',
|
|
279
|
+
recommendation: 'Keep in sync with `recipes.recipe`; `uap setup`/`uap config` write both.',
|
|
280
|
+
},
|
|
281
|
+
// ── Dashboard ─────────────────────────────────────────────────────────────
|
|
282
|
+
{
|
|
283
|
+
key: 'UAP_DASHBOARD_TOKEN', kind: 'env', type: 'string', default: null, category: 'dashboard', target: 'shell', secret: true,
|
|
284
|
+
description: 'The token required for dashboard policy-mutation routes (enable/disable/stage/level). Read routes stay open.',
|
|
285
|
+
recommendation: 'Set a strong token if the dashboard binds beyond localhost (`--host 0.0.0.0`); otherwise a generated per-session token is used.',
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
key: 'UAP_DASH_REFRESH_MS', kind: 'env', type: 'number', default: 2000, category: 'dashboard', target: 'shell',
|
|
289
|
+
description: 'Dashboard data refresh interval in milliseconds (floor 250).',
|
|
290
|
+
recommendation: '2000 is fine; lower for a more live feel at higher CPU cost.',
|
|
291
|
+
},
|
|
292
|
+
// ── Token & time optimization ─────────────────────────────────────────────
|
|
293
|
+
{
|
|
294
|
+
key: 'costOptimization.enabled', kind: 'json', type: 'boolean', default: true, category: 'optimization',
|
|
295
|
+
description: 'Enables token budgets, response caching, and embedding batching to cut token spend.',
|
|
296
|
+
recommendation: 'Keep on — it is free savings with no quality cost.',
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
key: 'timeOptimization.parallelExecution.maxParallelDroids', kind: 'json', type: 'number', default: 4, category: 'optimization',
|
|
300
|
+
description: 'Max expert droids run in parallel during a task.',
|
|
301
|
+
recommendation: 'Match to host capacity; 4 is a safe default.',
|
|
302
|
+
},
|
|
303
|
+
// ── General ───────────────────────────────────────────────────────────────
|
|
304
|
+
{
|
|
305
|
+
key: 'project.defaultBranch', kind: 'json', type: 'string', default: 'main', category: 'general',
|
|
306
|
+
description: 'The branch PRs target and worktrees branch from.',
|
|
307
|
+
recommendation: 'Set to your repo\'s default branch (`main` or `master`).',
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
key: 'UAP_NO_SELF_UPDATE', kind: 'env', type: 'boolean', default: false, category: 'general', target: 'shell',
|
|
311
|
+
description: 'Disables the automatic global-CLI version check/self-update on `uap setup`.',
|
|
312
|
+
recommendation: 'Set in CI or pinned environments where you manage the UAP version yourself.',
|
|
313
|
+
},
|
|
314
|
+
];
|
|
315
|
+
// ── Lookup helpers ──────────────────────────────────────────────────────────
|
|
316
|
+
const BY_KEY = new Map(SETTINGS.map((s) => [s.key.toLowerCase(), s]));
|
|
317
|
+
/** Case-insensitive exact lookup by key. */
|
|
318
|
+
export function getSetting(key) {
|
|
319
|
+
return BY_KEY.get(key.toLowerCase());
|
|
320
|
+
}
|
|
321
|
+
/** All settings in a category, in registry order. */
|
|
322
|
+
export function settingsByCategory(id) {
|
|
323
|
+
return SETTINGS.filter((s) => s.category === id);
|
|
324
|
+
}
|
|
325
|
+
/** Fuzzy match for `config get/set/explain` when the key isn't exact. */
|
|
326
|
+
export function findSettings(query) {
|
|
327
|
+
const q = query.toLowerCase();
|
|
328
|
+
return SETTINGS.filter((s) => s.key.toLowerCase().includes(q));
|
|
329
|
+
}
|
|
330
|
+
/** The category metadata for an id. */
|
|
331
|
+
export function category(id) {
|
|
332
|
+
return CATEGORIES.find((c) => c.id === id);
|
|
333
|
+
}
|
|
334
|
+
//# sourceMappingURL=settings-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-registry.js","sourceRoot":"","sources":["../../src/config/settings-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAsDH,MAAM,CAAC,MAAM,UAAU,GAA+B;IACpD,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,wBAAwB,EAAE,KAAK,EAAE,2EAA2E,EAAE;IACvI,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,gEAAgE,EAAE;IAC5H,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,sDAAsD,EAAE;IACxG,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,8BAA8B,EAAE,KAAK,EAAE,0EAA0E,EAAE;IAC3I,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,gEAAgE,EAAE;IAC1G,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE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CAAC;AACnD,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,MAAM,CAAC,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAC9B,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACjE,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,QAAQ,CAAC,EAAqB;IAC5C,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboard control handlers — the WRITE surface behind the dashboard's
|
|
3
|
+
* mutation-token gate (see server.ts `mutationAuthorized`). Each handler wraps
|
|
4
|
+
* an existing importable service so the dashboard can start/stop/delete UAP
|
|
5
|
+
* lifecycle objects (tasks, epics/ledger, orchestrator, deliver runs, agents).
|
|
6
|
+
* Handlers throw Error with a clear message on bad input; server.ts maps that
|
|
7
|
+
* to a 400/500 JSON response.
|
|
8
|
+
*/
|
|
9
|
+
import type { DeliverRunState } from '../delivery/run-state.js';
|
|
10
|
+
type Body = Record<string, unknown>;
|
|
11
|
+
export declare function handleTaskCreate(body: Body): {
|
|
12
|
+
id: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function handleTaskUpdate(id: string, body: Body): {
|
|
15
|
+
id: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function handleTaskClose(id: string, body: Body): {
|
|
18
|
+
id: string;
|
|
19
|
+
status: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function handleTaskDelete(id: string): {
|
|
22
|
+
id: string;
|
|
23
|
+
deleted: boolean;
|
|
24
|
+
};
|
|
25
|
+
export declare function handleTaskClaim(id: string, body: Body): {
|
|
26
|
+
id: string;
|
|
27
|
+
claimed: boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare function handleLedgerItem(cwd: string, id: string, body: Body): {
|
|
30
|
+
id: string;
|
|
31
|
+
status: string;
|
|
32
|
+
};
|
|
33
|
+
export declare function handleLedgerReset(cwd: string): {
|
|
34
|
+
reset: boolean;
|
|
35
|
+
};
|
|
36
|
+
export declare function handleLedgerInit(cwd: string, body: Body): {
|
|
37
|
+
mission: string;
|
|
38
|
+
items: number;
|
|
39
|
+
};
|
|
40
|
+
export declare function handleOrchestratorToggle(cwd: string, body: Body): {
|
|
41
|
+
state: string;
|
|
42
|
+
};
|
|
43
|
+
export declare function handleAgentDeregister(id: string): {
|
|
44
|
+
id: string;
|
|
45
|
+
deregistered: boolean;
|
|
46
|
+
};
|
|
47
|
+
export declare function handleAgentCleanStale(): {
|
|
48
|
+
cleaned: number;
|
|
49
|
+
};
|
|
50
|
+
export declare function listDeliverRuns(cwd: string): DeliverRunState[];
|
|
51
|
+
export declare function handleDeliverLaunch(cwd: string, body: Body): {
|
|
52
|
+
launched: boolean;
|
|
53
|
+
pid?: number;
|
|
54
|
+
};
|
|
55
|
+
export declare function handleDeliverCancel(cwd: string, runId: string): {
|
|
56
|
+
runId: string;
|
|
57
|
+
cancelRequested: boolean;
|
|
58
|
+
interrupted: boolean;
|
|
59
|
+
};
|
|
60
|
+
export declare function handleDeliverResume(cwd: string, runId: string): {
|
|
61
|
+
runId: string;
|
|
62
|
+
resumed: boolean;
|
|
63
|
+
pid?: number;
|
|
64
|
+
};
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=controls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../src/dashboard/controls.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EA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E,MAAM,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,CAIvF;AACD,wBAAgB,qBAAqB,IAAI;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAG3D;AAGD,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,CAM9D;AACD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAShG;AACD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,CAgCjI;AACD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAKjH"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboard control handlers — the WRITE surface behind the dashboard's
|
|
3
|
+
* mutation-token gate (see server.ts `mutationAuthorized`). Each handler wraps
|
|
4
|
+
* an existing importable service so the dashboard can start/stop/delete UAP
|
|
5
|
+
* lifecycle objects (tasks, epics/ledger, orchestrator, deliver runs, agents).
|
|
6
|
+
* Handlers throw Error with a clear message on bad input; server.ts maps that
|
|
7
|
+
* to a 400/500 JSON response.
|
|
8
|
+
*/
|
|
9
|
+
import { spawn } from 'child_process';
|
|
10
|
+
import { TaskService } from '../tasks/service.js';
|
|
11
|
+
import { initLedger, markItem, clearLedger } from '../delivery/completion-ledger.js';
|
|
12
|
+
import { modifyUapConfig } from '../utils/config-loader.js';
|
|
13
|
+
import { CoordinationService } from '../coordination/service.js';
|
|
14
|
+
import { listRuns, loadRunState, requestStop, saveRunState, isValidRunId } from '../delivery/run-state.js';
|
|
15
|
+
// ── Tasks ──
|
|
16
|
+
function taskSvc() {
|
|
17
|
+
return new TaskService();
|
|
18
|
+
}
|
|
19
|
+
export function handleTaskCreate(body) {
|
|
20
|
+
const title = String(body.title ?? '').trim();
|
|
21
|
+
if (!title)
|
|
22
|
+
throw new Error('title is required');
|
|
23
|
+
const input = { title };
|
|
24
|
+
if (body.type)
|
|
25
|
+
input.type = String(body.type);
|
|
26
|
+
if (body.priority != null && body.priority !== '')
|
|
27
|
+
input.priority = clampPriority(body.priority);
|
|
28
|
+
if (body.assignee)
|
|
29
|
+
input.assignee = String(body.assignee);
|
|
30
|
+
if (body.parentId)
|
|
31
|
+
input.parentId = String(body.parentId);
|
|
32
|
+
const task = taskSvc().create(input);
|
|
33
|
+
return { id: task.id };
|
|
34
|
+
}
|
|
35
|
+
export function handleTaskUpdate(id, body) {
|
|
36
|
+
const input = {};
|
|
37
|
+
if (body.status)
|
|
38
|
+
input.status = String(body.status);
|
|
39
|
+
if (body.assignee !== undefined)
|
|
40
|
+
input.assignee = String(body.assignee);
|
|
41
|
+
if (body.priority !== undefined && body.priority !== '')
|
|
42
|
+
input.priority = clampPriority(body.priority);
|
|
43
|
+
if (body.title)
|
|
44
|
+
input.title = String(body.title);
|
|
45
|
+
const task = taskSvc().update(id, input);
|
|
46
|
+
if (!task)
|
|
47
|
+
throw new Error('task not found');
|
|
48
|
+
return { id };
|
|
49
|
+
}
|
|
50
|
+
export function handleTaskClose(id, body) {
|
|
51
|
+
const task = taskSvc().close(id, body.reason ? String(body.reason) : undefined);
|
|
52
|
+
if (!task)
|
|
53
|
+
throw new Error('task not found');
|
|
54
|
+
return { id, status: 'done' };
|
|
55
|
+
}
|
|
56
|
+
export function handleTaskDelete(id) {
|
|
57
|
+
const ok = taskSvc().delete(id);
|
|
58
|
+
if (!ok)
|
|
59
|
+
throw new Error('task not found');
|
|
60
|
+
return { id, deleted: true };
|
|
61
|
+
}
|
|
62
|
+
export function handleTaskClaim(id, body) {
|
|
63
|
+
const agentId = String(body.agentId ?? 'dashboard');
|
|
64
|
+
const branch = String(body.worktreeBranch ?? '');
|
|
65
|
+
const claimed = taskSvc().tryClaim(id, agentId, branch);
|
|
66
|
+
return { id, claimed };
|
|
67
|
+
}
|
|
68
|
+
function clampPriority(v) {
|
|
69
|
+
const n = Math.round(Number(v));
|
|
70
|
+
return (Number.isFinite(n) ? Math.min(4, Math.max(0, n)) : 2);
|
|
71
|
+
}
|
|
72
|
+
// ── Epics / completion ledger ──
|
|
73
|
+
const LEDGER_STATUSES = ['pending', 'in_progress', 'done', 'failed'];
|
|
74
|
+
export function handleLedgerItem(cwd, id, body) {
|
|
75
|
+
const status = String(body.status ?? '');
|
|
76
|
+
if (!LEDGER_STATUSES.includes(status))
|
|
77
|
+
throw new Error(`invalid status; must be one of ${LEDGER_STATUSES.join(', ')}`);
|
|
78
|
+
const ok = markItem(cwd, id, status);
|
|
79
|
+
if (!ok)
|
|
80
|
+
throw new Error('ledger item not found');
|
|
81
|
+
return { id, status };
|
|
82
|
+
}
|
|
83
|
+
export function handleLedgerReset(cwd) {
|
|
84
|
+
clearLedger(cwd);
|
|
85
|
+
return { reset: true };
|
|
86
|
+
}
|
|
87
|
+
export function handleLedgerInit(cwd, body) {
|
|
88
|
+
const mission = String(body.mission ?? '').trim();
|
|
89
|
+
if (!mission)
|
|
90
|
+
throw new Error('mission is required');
|
|
91
|
+
const rawItems = Array.isArray(body.items) ? body.items : [];
|
|
92
|
+
const items = rawItems
|
|
93
|
+
.filter((it) => !!it && typeof it === 'object')
|
|
94
|
+
.map((it) => ({ id: String(it.id), title: String(it.title ?? it.id) }));
|
|
95
|
+
const led = initLedger(cwd, mission, items);
|
|
96
|
+
return { mission: led.mission, items: led.items.length };
|
|
97
|
+
}
|
|
98
|
+
// ── Orchestrator toggle ──
|
|
99
|
+
export function handleOrchestratorToggle(cwd, body) {
|
|
100
|
+
const state = String(body.state ?? '').toLowerCase();
|
|
101
|
+
if (state !== 'on' && state !== 'off' && state !== 'auto')
|
|
102
|
+
throw new Error('state must be on | off | auto');
|
|
103
|
+
modifyUapConfig(cwd, (cfg) => {
|
|
104
|
+
const deliver = { ...(cfg.deliver ?? {}) };
|
|
105
|
+
if (state === 'auto')
|
|
106
|
+
delete deliver.orchestrate;
|
|
107
|
+
else
|
|
108
|
+
deliver.orchestrate = state;
|
|
109
|
+
return { ...cfg, deliver };
|
|
110
|
+
});
|
|
111
|
+
return { state };
|
|
112
|
+
}
|
|
113
|
+
// ── Agents ──
|
|
114
|
+
export function handleAgentDeregister(id) {
|
|
115
|
+
const svc = new CoordinationService();
|
|
116
|
+
svc.deregister(id);
|
|
117
|
+
return { id, deregistered: true };
|
|
118
|
+
}
|
|
119
|
+
export function handleAgentCleanStale() {
|
|
120
|
+
const svc = new CoordinationService();
|
|
121
|
+
return { cleaned: svc.cleanupStaleAgents() };
|
|
122
|
+
}
|
|
123
|
+
// ── Deliver runs ──
|
|
124
|
+
export function listDeliverRuns(cwd) {
|
|
125
|
+
try {
|
|
126
|
+
return listRuns(cwd);
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return [];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
export function handleDeliverLaunch(cwd, body) {
|
|
133
|
+
const instruction = String(body.instruction ?? '').trim();
|
|
134
|
+
if (!instruction)
|
|
135
|
+
throw new Error('instruction is required');
|
|
136
|
+
const args = ['deliver', instruction, '--json'];
|
|
137
|
+
if (body.model)
|
|
138
|
+
args.push('--model', String(body.model));
|
|
139
|
+
if (body.maxTurns)
|
|
140
|
+
args.push('--max-turns', String(Math.max(1, Math.round(Number(body.maxTurns)) || 5)));
|
|
141
|
+
const child = spawn('uap', args, { cwd, detached: true, stdio: 'ignore' });
|
|
142
|
+
child.unref();
|
|
143
|
+
return { launched: true, pid: child.pid };
|
|
144
|
+
}
|
|
145
|
+
export function handleDeliverCancel(cwd, runId) {
|
|
146
|
+
if (!isValidRunId(runId))
|
|
147
|
+
throw new Error('invalid runId');
|
|
148
|
+
requestStop(cwd, runId);
|
|
149
|
+
const st = loadRunState(cwd, runId);
|
|
150
|
+
// Is the owning process still alive? kill(pid, 0) throws ESRCH when it is gone.
|
|
151
|
+
let alive = false;
|
|
152
|
+
if (st && st.pid) {
|
|
153
|
+
try {
|
|
154
|
+
process.kill(st.pid, 0);
|
|
155
|
+
alive = true;
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
alive = false;
|
|
159
|
+
}
|
|
160
|
+
if (alive) {
|
|
161
|
+
// A live run: SIGTERM it and let its loop observe the stop-file and mark
|
|
162
|
+
// the run interrupted on its own terms (checkpoint-safe).
|
|
163
|
+
try {
|
|
164
|
+
process.kill(st.pid, 'SIGTERM');
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
/* raced to exit */
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Orphaned run (process gone, or a pre-pid run with no recorded pid): nothing
|
|
172
|
+
// will ever observe the cooperative stop-file, so flip the durable state to
|
|
173
|
+
// interrupted directly — otherwise a dead 'running' run lingers forever.
|
|
174
|
+
let interrupted = false;
|
|
175
|
+
if (!alive && st && st.status === 'running') {
|
|
176
|
+
saveRunState({ ...st, status: 'interrupted' });
|
|
177
|
+
interrupted = true;
|
|
178
|
+
}
|
|
179
|
+
return { runId, cancelRequested: true, interrupted };
|
|
180
|
+
}
|
|
181
|
+
export function handleDeliverResume(cwd, runId) {
|
|
182
|
+
if (!isValidRunId(runId))
|
|
183
|
+
throw new Error('invalid runId');
|
|
184
|
+
const child = spawn('uap', ['deliver', '--resume', runId, '--json'], { cwd, detached: true, stdio: 'ignore' });
|
|
185
|
+
child.unref();
|
|
186
|
+
return { runId, resumed: true, pid: child.pid };
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=controls.js.map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