@harness-engineering/orchestrator 0.5.0 → 0.7.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/dist/index.d.mts +623 -51
- package/dist/index.d.ts +623 -51
- package/dist/index.js +2587 -529
- package/dist/index.mjs +2560 -501
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as _harness_engineering_types from '@harness-engineering/types';
|
|
2
|
+
import { Issue, AgentEvent, WorkflowConfig, TokenUsage, ConcernSignal, ScopeTier, EscalationConfig, IssueRoutingDecision, Result, WorkflowDefinition, BackendDef, RoutingConfig, WorkspaceConfig, HooksConfig, AgentBackend, SessionStartParams, AgentSession, AgentError, TurnParams, TurnResult, CheckScriptDefinition, OutputRetentionConfig, RoutingDecision, RoutingUseCase, ContainerConfig, SecretConfig, AgentConfig, CustomTaskDefinition, TokenScope, AuthToken, AuthTokenPublic, IndexedFileKind, SessionSearchResult, ReindexStats, SessionSummarizationConfig, SessionSummary, SessionSummaryMeta, SessionsConfig, GatewayEvent, NotificationEnvelope, NotificationDeliveryResult, NotificationSinkConfig, NotificationsConfig } from '@harness-engineering/types';
|
|
3
|
+
import { IssueTrackerClient, Issue as Issue$1, TrackerConfig, CacheMetricsRecorder, ArchiveHooks, SkillProposal, ProposalGateFinding } from '@harness-engineering/core';
|
|
3
4
|
import { EnrichedSpec, ComplexityScore, SimulationResult, IntelligencePipeline, WeightedRecommendation, AnalysisProvider } from '@harness-engineering/intelligence';
|
|
4
5
|
import { GraphStore } from '@harness-engineering/graph';
|
|
5
6
|
import { execFile } from 'node:child_process';
|
|
@@ -366,6 +367,10 @@ interface TickEvent {
|
|
|
366
367
|
simulationResults?: Map<string, SimulationResult>;
|
|
367
368
|
/** Pre-computed persona recommendations from specialization scorer (issueId -> recommendations) */
|
|
368
369
|
personaRecommendations?: Map<string, WeightedRecommendation[]>;
|
|
370
|
+
/** Identity of this orchestrator. Items assigned to a different value are
|
|
371
|
+
* filtered out of dispatch by `selectCandidates`. Omit for back-compat
|
|
372
|
+
* (preserves today's permissive behavior). */
|
|
373
|
+
selfAssignee?: string;
|
|
369
374
|
}
|
|
370
375
|
interface WorkerExitEvent {
|
|
371
376
|
type: 'worker_exit';
|
|
@@ -485,11 +490,11 @@ declare function sortCandidates(issues: readonly Issue[]): Issue[];
|
|
|
485
490
|
* Check if a single issue is dispatch-eligible.
|
|
486
491
|
* State comparisons are case-insensitive.
|
|
487
492
|
*/
|
|
488
|
-
declare function isEligible(issue: Issue, state: OrchestratorState, activeStates: string[], terminalStates: string[]): boolean;
|
|
493
|
+
declare function isEligible(issue: Issue, state: OrchestratorState, activeStates: string[], terminalStates: string[], selfAssignee?: string | null): boolean;
|
|
489
494
|
/**
|
|
490
495
|
* Select and sort eligible candidates from a list of issues.
|
|
491
496
|
*/
|
|
492
|
-
declare function selectCandidates(issues: readonly Issue[], state: OrchestratorState, activeStates: string[], terminalStates: string[]): Issue[];
|
|
497
|
+
declare function selectCandidates(issues: readonly Issue[], state: OrchestratorState, activeStates: string[], terminalStates: string[], selfAssignee?: string | null): Issue[];
|
|
493
498
|
|
|
494
499
|
/**
|
|
495
500
|
* Get the number of available global concurrency slots.
|
|
@@ -549,7 +554,7 @@ declare function detectScopeTier(issue: Issue, artifacts: ArtifactPresence): Sco
|
|
|
549
554
|
* 4. If tier is in signalGated -> check concern signals
|
|
550
555
|
* 5. Otherwise -> dispatch-local (safe default)
|
|
551
556
|
*/
|
|
552
|
-
declare function routeIssue(scopeTier: ScopeTier, concernSignals: ConcernSignal[], config: EscalationConfig):
|
|
557
|
+
declare function routeIssue(scopeTier: ScopeTier, concernSignals: ConcernSignal[], config: EscalationConfig): IssueRoutingDecision;
|
|
553
558
|
|
|
554
559
|
/**
|
|
555
560
|
* Candidate skills the orchestrator may dispatch to. Keep this set
|
|
@@ -864,9 +869,107 @@ declare class WorkflowLoader {
|
|
|
864
869
|
loadWorkflow(filePath: string): Promise<Result<WorkflowDefinition, Error>>;
|
|
865
870
|
}
|
|
866
871
|
|
|
867
|
-
|
|
872
|
+
/**
|
|
873
|
+
* Cross-field check: every value in `routing` must reference a key in
|
|
874
|
+
* `backends`. Mirrors the Phase 1 standalone helper but returns a flat
|
|
875
|
+
* array of issues for synchronous consumption inside
|
|
876
|
+
* `validateWorkflowConfig` (which is hand-rolled, not a Zod parse).
|
|
877
|
+
*
|
|
878
|
+
* Exported for unit testing. Production callers should prefer
|
|
879
|
+
* `validateWorkflowConfig` (which wraps this helper with the surrounding
|
|
880
|
+
* legacy-vs-modern branching).
|
|
881
|
+
*/
|
|
882
|
+
declare function crossFieldRoutingIssues(backends: Record<string, BackendDef>, routing: RoutingConfig): Array<{
|
|
883
|
+
path: string[];
|
|
884
|
+
message: string;
|
|
885
|
+
}>;
|
|
886
|
+
/**
|
|
887
|
+
* Spec B Phase 2 / S3: produce non-blocking warnings for misconfigured
|
|
888
|
+
* routing entries that are SYNTACTICALLY valid (the cross-field check
|
|
889
|
+
* has passed) but SEMANTICALLY suspicious:
|
|
890
|
+
*
|
|
891
|
+
* - `routing.skills.<name>` where `<name>` is not in the local skill
|
|
892
|
+
* catalog. Likely a typo or a skill that was renamed / removed.
|
|
893
|
+
*
|
|
894
|
+
* - `routing.modes.<mode>` where `<mode>` is not in the
|
|
895
|
+
* STANDARD_COGNITIVE_MODES tuple. Since `CognitiveMode` allows the
|
|
896
|
+
* `(string & {})` escape hatch, the type system accepts custom modes
|
|
897
|
+
* — but operators are far more likely to typo a standard mode than
|
|
898
|
+
* introduce a custom one, so we warn.
|
|
899
|
+
*
|
|
900
|
+
* Returns an empty array when `knownSkillNames` is empty (i.e., the
|
|
901
|
+
* catalog could not be discovered — most likely because `agents/skills/`
|
|
902
|
+
* is absent). Skipping is preferable to flooding the operator with
|
|
903
|
+
* false positives when the catalog itself is missing.
|
|
904
|
+
*
|
|
905
|
+
* Warnings are advisory; the loader continues to return `Ok` and the
|
|
906
|
+
* orchestrator starts normally.
|
|
907
|
+
*/
|
|
908
|
+
declare function routingWarnings(routing: RoutingConfig, knownSkillNames: readonly string[]): string[];
|
|
909
|
+
interface ValidateWorkflowConfigOptions {
|
|
910
|
+
/**
|
|
911
|
+
* Known skill names from the local catalog. When non-empty, used to
|
|
912
|
+
* warn (S3) on `routing.skills.<name>` references that are not in
|
|
913
|
+
* the catalog. When empty, skill-name warnings are suppressed — the
|
|
914
|
+
* caller is presumed to be running without a discoverable catalog
|
|
915
|
+
* (e.g., tests, or orchestrator outside a harness project root).
|
|
916
|
+
*/
|
|
917
|
+
knownSkillNames?: readonly string[];
|
|
918
|
+
}
|
|
919
|
+
interface ValidatedWorkflowConfig {
|
|
920
|
+
config: WorkflowConfig;
|
|
921
|
+
/**
|
|
922
|
+
* Non-blocking warnings produced during validation. Currently
|
|
923
|
+
* includes (Spec B Phase 2 / S3):
|
|
924
|
+
* - `routing.skills.<name>` not in the local catalog
|
|
925
|
+
* - `routing.modes.<mode>` not in `STANDARD_COGNITIVE_MODES`
|
|
926
|
+
*/
|
|
927
|
+
warnings: readonly string[];
|
|
928
|
+
}
|
|
929
|
+
declare function validateWorkflowConfig(config: unknown, options?: ValidateWorkflowConfigOptions): Result<ValidatedWorkflowConfig, Error>;
|
|
868
930
|
declare function getDefaultConfig(): WorkflowConfig;
|
|
869
931
|
|
|
932
|
+
/**
|
|
933
|
+
* Spec B Phase 3: an entry in the local skill catalog.
|
|
934
|
+
*
|
|
935
|
+
* Carries the skill's catalog `name` AND optional `cognitive_mode`
|
|
936
|
+
* declaration from `skill.yaml`. Consumed by the orchestrator dispatch
|
|
937
|
+
* site to construct `{ kind: 'skill', skillName, cognitiveMode }`
|
|
938
|
+
* RoutingUseCases so per-skill / per-mode routing fires at dispatch.
|
|
939
|
+
*/
|
|
940
|
+
interface SkillCatalogEntry {
|
|
941
|
+
readonly name: string;
|
|
942
|
+
readonly cognitiveMode?: string;
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Spec B Phase 3: read the local skill catalog at orchestrator startup,
|
|
946
|
+
* returning each declared skill's `name` AND optional `cognitive_mode`.
|
|
947
|
+
*
|
|
948
|
+
* Reads from EVERY host subdirectory under `agents/skills/` (claude-code,
|
|
949
|
+
* cursor, gemini, etc.). Names are deduplicated across hosts — first
|
|
950
|
+
* occurrence wins (matches Phase 2 behavior for `discoverSkillCatalogNames`).
|
|
951
|
+
*
|
|
952
|
+
* Returns an empty array when `agents/skills/` is absent (orchestrator
|
|
953
|
+
* running outside a harness project root). In that case dispatch-site
|
|
954
|
+
* routing falls through to per-tier resolution, preserving today's
|
|
955
|
+
* behavior (F11/N2).
|
|
956
|
+
*
|
|
957
|
+
* Errors reading individual skill.yaml files (malformed YAML, missing
|
|
958
|
+
* `name` field, IO errors) are swallowed silently. The catalog is
|
|
959
|
+
* advisory; a single broken skill.yaml should not block dispatch.
|
|
960
|
+
*/
|
|
961
|
+
declare function discoverSkillCatalog(projectRoot: string): SkillCatalogEntry[];
|
|
962
|
+
/**
|
|
963
|
+
* Spec B Phase 2: read the local skill catalog at orchestrator startup
|
|
964
|
+
* for warning-level routing validation (`routing.skills.<name>` where
|
|
965
|
+
* `<name>` is not in the catalog).
|
|
966
|
+
*
|
|
967
|
+
* Spec B Phase 3: thin alias over {@link discoverSkillCatalog} — name
|
|
968
|
+
* extraction preserved for the Phase 2 WorkflowLoader → validation
|
|
969
|
+
* pipeline (no behavioral change for Phase 2 callers).
|
|
970
|
+
*/
|
|
971
|
+
declare function discoverSkillCatalogNames(projectRoot: string): string[];
|
|
972
|
+
|
|
870
973
|
/**
|
|
871
974
|
* Adapter for using a markdown roadmap file as an issue tracker.
|
|
872
975
|
*
|
|
@@ -1084,8 +1187,10 @@ declare class PromptRenderer {
|
|
|
1084
1187
|
|
|
1085
1188
|
/**
|
|
1086
1189
|
* Internal types for the maintenance module.
|
|
1087
|
-
* Public config types (MaintenanceConfig, TaskOverride
|
|
1190
|
+
* Public config types (MaintenanceConfig, TaskOverride, CustomTaskDefinition,
|
|
1191
|
+
* CheckScriptDefinition, OutputRetentionConfig) live in @harness-engineering/types.
|
|
1088
1192
|
*/
|
|
1193
|
+
|
|
1089
1194
|
/**
|
|
1090
1195
|
* Classification of maintenance task execution strategy.
|
|
1091
1196
|
*
|
|
@@ -1095,6 +1200,85 @@ declare class PromptRenderer {
|
|
|
1095
1200
|
* - housekeeping: Run a mechanical command directly; no AI, no PR.
|
|
1096
1201
|
*/
|
|
1097
1202
|
type TaskType = 'mechanical-ai' | 'pure-ai' | 'report-only' | 'housekeeping';
|
|
1203
|
+
/**
|
|
1204
|
+
* Hermes Phase 2 — Provenance tag identifying the trigger source of a run.
|
|
1205
|
+
*
|
|
1206
|
+
* Set by the entry point, never user-configurable:
|
|
1207
|
+
* - 'cron' — scheduled by MaintenanceScheduler
|
|
1208
|
+
* - 'cli' — `harness maintenance run <id>`
|
|
1209
|
+
* - { kind: 'api', tokenName } — Gateway API trigger (Phase 0)
|
|
1210
|
+
* - { kind: 'chain', upstreamTaskId } — fired by a downstream `contextFrom`
|
|
1211
|
+
* dependency (reserved; not yet wired)
|
|
1212
|
+
*/
|
|
1213
|
+
type RunOrigin = 'cron' | 'cli' | {
|
|
1214
|
+
kind: 'api';
|
|
1215
|
+
tokenName: string;
|
|
1216
|
+
} | {
|
|
1217
|
+
kind: 'chain';
|
|
1218
|
+
upstreamTaskId: string;
|
|
1219
|
+
};
|
|
1220
|
+
/**
|
|
1221
|
+
* Per-task cost ceiling (Hermes Phase 5).
|
|
1222
|
+
*
|
|
1223
|
+
* When set, the orchestrator's `CostCeilingMonitor` tracks cumulative
|
|
1224
|
+
* agent spend for the task and aborts dispatch on exceed (D6 — abort
|
|
1225
|
+
* is advisory at the turn boundary).
|
|
1226
|
+
*/
|
|
1227
|
+
interface TaskCostCeiling {
|
|
1228
|
+
/** Hard cap in USD. Cumulative spend > maxUsd fires the abort path. */
|
|
1229
|
+
maxUsd: number;
|
|
1230
|
+
/** Warn threshold expressed as a percentage of `maxUsd` (1–99). */
|
|
1231
|
+
warnAtPct?: number;
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Definition of a maintenance task (built-in or Phase 2 custom).
|
|
1235
|
+
*
|
|
1236
|
+
* Custom-task-only fields (`checkScript`, `inlineSkills`, `inlineSkillsBudgetTokens`,
|
|
1237
|
+
* `contextFrom`, `contextFromMaxAgeMinutes`, `outputRetention`, `isCustom`) are
|
|
1238
|
+
* populated by the scheduler when merging `MaintenanceConfig.customTasks` into the
|
|
1239
|
+
* resolved task list. Built-ins leave them unset and the runner falls through to
|
|
1240
|
+
* the legacy execution paths unchanged.
|
|
1241
|
+
*/
|
|
1242
|
+
interface TaskDefinition {
|
|
1243
|
+
/** Unique identifier for this task (e.g., 'arch-violations') */
|
|
1244
|
+
id: string;
|
|
1245
|
+
/** Execution strategy */
|
|
1246
|
+
type: TaskType;
|
|
1247
|
+
/** Human-readable description */
|
|
1248
|
+
description: string;
|
|
1249
|
+
/** Default cron expression (e.g., '0 2 * * *' for daily at 2am) */
|
|
1250
|
+
schedule: string;
|
|
1251
|
+
/** Branch name for PRs, or null for report-only/housekeeping tasks */
|
|
1252
|
+
branch: string | null;
|
|
1253
|
+
/** CLI command args for the mechanical check step (mechanical-ai and report-only) */
|
|
1254
|
+
checkCommand?: string[];
|
|
1255
|
+
/** Skill name to dispatch for AI fix (mechanical-ai and pure-ai) */
|
|
1256
|
+
fixSkill?: string;
|
|
1257
|
+
/**
|
|
1258
|
+
* Per-task cost ceiling (Hermes Phase 5). When set, cumulative agent
|
|
1259
|
+
* spend across all turns dispatched for this task is tracked; the
|
|
1260
|
+
* orchestrator aborts dispatch on `maxUsd` exceedance with
|
|
1261
|
+
* `RunResult.error === 'cost_ceiling_exceeded'`. Default: unset = no cap.
|
|
1262
|
+
*/
|
|
1263
|
+
costCeiling?: TaskCostCeiling;
|
|
1264
|
+
/**
|
|
1265
|
+
* Hermes Phase 2 — Arbitrary-executable check (replaces `checkCommand`).
|
|
1266
|
+
* Mutually-exclusive with `checkCommand`; validator rejects both.
|
|
1267
|
+
*/
|
|
1268
|
+
checkScript?: CheckScriptDefinition;
|
|
1269
|
+
/** Hermes Phase 2 — Skill names whose markdown is inlined into the agent prompt. */
|
|
1270
|
+
inlineSkills?: string[];
|
|
1271
|
+
/** Hermes Phase 2 — Token-budget cap for inlined skills. Default: 8000. */
|
|
1272
|
+
inlineSkillsBudgetTokens?: number;
|
|
1273
|
+
/** Hermes Phase 2 — Upstream task IDs whose latest output feeds prompt context. */
|
|
1274
|
+
contextFrom?: string[];
|
|
1275
|
+
/** Hermes Phase 2 — Max upstream-output age (minutes). Default: 1440. */
|
|
1276
|
+
contextFromMaxAgeMinutes?: number;
|
|
1277
|
+
/** Hermes Phase 2 — Output retention overrides. */
|
|
1278
|
+
outputRetention?: OutputRetentionConfig;
|
|
1279
|
+
/** Hermes Phase 2 — Marks tasks originating from `customTasks` config. */
|
|
1280
|
+
isCustom?: boolean;
|
|
1281
|
+
}
|
|
1098
1282
|
/**
|
|
1099
1283
|
* Result of a single maintenance task run.
|
|
1100
1284
|
*/
|
|
@@ -1126,6 +1310,12 @@ interface RunResult {
|
|
|
1126
1310
|
* and `error === 'cost_ceiling_exceeded'`.
|
|
1127
1311
|
*/
|
|
1128
1312
|
costUsd?: number;
|
|
1313
|
+
/**
|
|
1314
|
+
* Hermes Phase 2 — Provenance tag set by the entry point.
|
|
1315
|
+
* Older orchestrators may emit this field absent; renderers should fall
|
|
1316
|
+
* back to `'—'` rather than crash.
|
|
1317
|
+
*/
|
|
1318
|
+
origin?: RunOrigin;
|
|
1129
1319
|
}
|
|
1130
1320
|
/**
|
|
1131
1321
|
* Schedule entry for a single task, used in MaintenanceStatus.
|
|
@@ -1167,6 +1357,144 @@ interface MaintenanceStatus {
|
|
|
1167
1357
|
history: RunResult[];
|
|
1168
1358
|
}
|
|
1169
1359
|
|
|
1360
|
+
interface RoutingDecisionBusFilter {
|
|
1361
|
+
skillName?: string;
|
|
1362
|
+
mode?: string;
|
|
1363
|
+
backendName?: string;
|
|
1364
|
+
limit?: number;
|
|
1365
|
+
}
|
|
1366
|
+
interface RoutingDecisionBusOptions {
|
|
1367
|
+
/** Default 500. Bound on the in-memory ring buffer. */
|
|
1368
|
+
capacity?: number;
|
|
1369
|
+
/**
|
|
1370
|
+
* Logger for the structured `routing-decision` line (O1) and for
|
|
1371
|
+
* one-off warn() when a subscriber throws (S6). When omitted, the
|
|
1372
|
+
* bus silently swallows subscriber errors (test-mode default).
|
|
1373
|
+
*/
|
|
1374
|
+
logger?: StructuredLogger;
|
|
1375
|
+
}
|
|
1376
|
+
/**
|
|
1377
|
+
* Spec B Phase 4 (D8): in-process bus + ring buffer for
|
|
1378
|
+
* {@link RoutingDecision} events. One emit() per
|
|
1379
|
+
* {@link BackendRouter.resolve} call; subscribers receive the
|
|
1380
|
+
* decision synchronously after the ring buffer is updated.
|
|
1381
|
+
*
|
|
1382
|
+
* Subscriber errors are isolated (caught + logged, never thrown
|
|
1383
|
+
* back to the emitter) so a misbehaving subscriber cannot block a
|
|
1384
|
+
* dispatch. (S6)
|
|
1385
|
+
*
|
|
1386
|
+
* Capacity-bound (default 500) via Array.shift() — acceptable for
|
|
1387
|
+
* v1 (see plan C4); switch to circular indexing if 24h dispatch
|
|
1388
|
+
* volume ever pushes 10K+ records/min.
|
|
1389
|
+
*/
|
|
1390
|
+
declare class RoutingDecisionBus {
|
|
1391
|
+
private readonly ringBuffer;
|
|
1392
|
+
private readonly listeners;
|
|
1393
|
+
private readonly capacity;
|
|
1394
|
+
private readonly logger;
|
|
1395
|
+
constructor(opts?: RoutingDecisionBusOptions);
|
|
1396
|
+
emit(decision: RoutingDecision): void;
|
|
1397
|
+
recent(filter?: RoutingDecisionBusFilter): RoutingDecision[];
|
|
1398
|
+
subscribe(listener: (d: RoutingDecision) => void): () => void;
|
|
1399
|
+
/**
|
|
1400
|
+
* Spec B Phase 5 (review-S2 fix): release all subscriber references so
|
|
1401
|
+
* teardown can complete without anchoring closures. Called from
|
|
1402
|
+
* `Orchestrator.stop()` before nulling the bus reference. The bus
|
|
1403
|
+
* remains usable after clear — `subscribe()` works as normal.
|
|
1404
|
+
*/
|
|
1405
|
+
clearListeners(): void;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
interface BackendRouterOptions {
|
|
1409
|
+
backends: Record<string, BackendDef>;
|
|
1410
|
+
routing: RoutingConfig;
|
|
1411
|
+
/**
|
|
1412
|
+
* Spec B Phase 4 (D8): when present, every resolve() emits its
|
|
1413
|
+
* decision onto the bus. The bus owns the structured log line + ring
|
|
1414
|
+
* buffer; the router stays a pure resolution function.
|
|
1415
|
+
*/
|
|
1416
|
+
decisionBus?: RoutingDecisionBus;
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* BackendRouter (Spec B Phase 1)
|
|
1420
|
+
*
|
|
1421
|
+
* Owns the lookup from a {@link RoutingUseCase} (a discriminated query
|
|
1422
|
+
* — tier, intelligence layer, maintenance, chat, isolation, **skill**,
|
|
1423
|
+
* **mode**) to a {@link RoutingDecision} naming a chosen backend and
|
|
1424
|
+
* the full resolution path that produced it.
|
|
1425
|
+
*
|
|
1426
|
+
* Resolution order (D2): invocation override -> per-skill -> per-mode
|
|
1427
|
+
* -> existing per-tier/intelligence/isolation/maintenance/chat ->
|
|
1428
|
+
* `routing.default`. Within each source, fallback chain entries are
|
|
1429
|
+
* tried in declared order; first existing backend wins. Unknown
|
|
1430
|
+
* entries are recorded with `outcome: 'unknown-backend'` and the walk
|
|
1431
|
+
* continues.
|
|
1432
|
+
*
|
|
1433
|
+
* Construction-time validation guarantees every name referenced by
|
|
1434
|
+
* `routing` is present in `backends` so the static-config case can
|
|
1435
|
+
* never produce a runtime exhaustion throw. The runtime throw at the
|
|
1436
|
+
* end of `resolve()` is a safety net for future dynamic-backends
|
|
1437
|
+
* scenarios where a chain entry can become unknown post-construction.
|
|
1438
|
+
*/
|
|
1439
|
+
declare class BackendRouter {
|
|
1440
|
+
private readonly backends;
|
|
1441
|
+
private readonly routing;
|
|
1442
|
+
private readonly decisionBus;
|
|
1443
|
+
constructor(opts: BackendRouterOptions);
|
|
1444
|
+
/**
|
|
1445
|
+
* Resolve a {@link RoutingUseCase} to a {@link RoutingDecision}.
|
|
1446
|
+
*
|
|
1447
|
+
* @param useCase the routing query
|
|
1448
|
+
* @param opts.invocationOverride if set and the named backend exists,
|
|
1449
|
+
* beats all other sources (D7 — the `--backend <name>` escape hatch)
|
|
1450
|
+
*/
|
|
1451
|
+
resolve(useCase: RoutingUseCase, opts?: {
|
|
1452
|
+
invocationOverride?: string;
|
|
1453
|
+
}): RoutingDecision;
|
|
1454
|
+
/**
|
|
1455
|
+
* Returns the {@link BackendDef} reference for the resolved name.
|
|
1456
|
+
* Identity-equal to the entry in `backends` (no copy) so callers
|
|
1457
|
+
* relying on reference equality (SC21) continue to work.
|
|
1458
|
+
*/
|
|
1459
|
+
resolveDefinition(useCase: RoutingUseCase, opts?: {
|
|
1460
|
+
invocationOverride?: string;
|
|
1461
|
+
}): BackendDef;
|
|
1462
|
+
/**
|
|
1463
|
+
* Spec B Phase 4 (closes P1-IMP-2): a single resolve() + def lookup
|
|
1464
|
+
* for callers that need both. Replaces the previous pattern of
|
|
1465
|
+
* `resolveDefinition(useCase) + resolve(useCase)` which produced two
|
|
1466
|
+
* RoutingDecision emissions per dispatch — doubling routing-decision
|
|
1467
|
+
* log volume now that Phase 4 emits.
|
|
1468
|
+
*
|
|
1469
|
+
* Identity-equal `BackendDef` (no copy) so callers relying on
|
|
1470
|
+
* reference equality (SC21) continue to work.
|
|
1471
|
+
*/
|
|
1472
|
+
resolveDecisionAndDef(useCase: RoutingUseCase, opts?: {
|
|
1473
|
+
invocationOverride?: string;
|
|
1474
|
+
}): {
|
|
1475
|
+
decision: RoutingDecision;
|
|
1476
|
+
def: BackendDef;
|
|
1477
|
+
};
|
|
1478
|
+
/**
|
|
1479
|
+
* The pre-Spec-B resolution helper: returns the configured
|
|
1480
|
+
* {@link RoutingValue} for tier/intelligence/isolation/maintenance/chat
|
|
1481
|
+
* use cases (or `undefined` for skill/mode use cases, which are owned
|
|
1482
|
+
* by the per-skill / per-mode steps in {@link resolve}). Returning
|
|
1483
|
+
* `undefined` lets the caller fall through to `routing.default`.
|
|
1484
|
+
*/
|
|
1485
|
+
private resolveExistingUseCase;
|
|
1486
|
+
private validateReferences;
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
/**
|
|
1490
|
+
* The central orchestrator that manages the lifecycle of coding agents.
|
|
1491
|
+
*
|
|
1492
|
+
* It polls an issue tracker for candidate tasks, manages ephemeral workspaces,
|
|
1493
|
+
* runs agents to resolve issues, and updates the tracker with progress.
|
|
1494
|
+
*
|
|
1495
|
+
* @fires Orchestrator#state_change Emitted when the internal state machine transitions
|
|
1496
|
+
* @fires Orchestrator#agent_event Emitted when an agent produces an output or thought
|
|
1497
|
+
*/
|
|
1170
1498
|
declare class Orchestrator extends EventEmitter {
|
|
1171
1499
|
private state;
|
|
1172
1500
|
private config;
|
|
@@ -1191,6 +1519,14 @@ declare class Orchestrator extends EventEmitter {
|
|
|
1191
1519
|
* construction time. Eliminating this fallback is autopilot Phase 4+.
|
|
1192
1520
|
*/
|
|
1193
1521
|
private backendFactory;
|
|
1522
|
+
/**
|
|
1523
|
+
* Spec B Phase 4 (D8): per-orchestrator in-process bus for
|
|
1524
|
+
* `RoutingDecision` events. Constructed alongside backendFactory when
|
|
1525
|
+
* agent.backends synthesis succeeds; null when legacy single-backend
|
|
1526
|
+
* config bypassed backends. Phase 5+ consumers (HTTP, WS, dashboard)
|
|
1527
|
+
* subscribe via `getRoutingDecisionBus()`.
|
|
1528
|
+
*/
|
|
1529
|
+
private routingDecisionBus;
|
|
1194
1530
|
/**
|
|
1195
1531
|
* Test-only: when overrides.backend is provided, dispatch uses this
|
|
1196
1532
|
* instance directly (bypassing the factory). Mirrors Phase 1
|
|
@@ -1213,6 +1549,15 @@ declare class Orchestrator extends EventEmitter {
|
|
|
1213
1549
|
* so this map is the single source of truth post-migration.
|
|
1214
1550
|
*/
|
|
1215
1551
|
private localResolvers;
|
|
1552
|
+
/**
|
|
1553
|
+
* Spec B Phase 3: skill catalog (name + cognitiveMode) read once at
|
|
1554
|
+
* construction from `projectRoot/agents/skills/`. Consulted by
|
|
1555
|
+
* `buildRoutingUseCase` at dispatch start to construct
|
|
1556
|
+
* `{ kind: 'skill', skillName, cognitiveMode }` RoutingUseCases.
|
|
1557
|
+
* Empty when the orchestrator runs outside a harness project root
|
|
1558
|
+
* (then dispatch falls through to per-tier, preserving F11/N2).
|
|
1559
|
+
*/
|
|
1560
|
+
private readonly skillCatalog;
|
|
1216
1561
|
/**
|
|
1217
1562
|
* Per-resolver `onStatusChange` unsubscribe callbacks. Spec 2 Phase 5
|
|
1218
1563
|
* (SC39): each local/pi resolver gets its own listener emitting a
|
|
@@ -1395,6 +1740,34 @@ declare class Orchestrator extends EventEmitter {
|
|
|
1395
1740
|
* Returns a point-in-time snapshot of the orchestrator's internal state.
|
|
1396
1741
|
*/
|
|
1397
1742
|
getSnapshot(): Record<string, unknown>;
|
|
1743
|
+
/**
|
|
1744
|
+
* Spec B Phase 4 (D8): expose the bus for Phase 5 (HTTP routes) and
|
|
1745
|
+
* Phase 7 (dashboard WS broadcast). Returns null when the legacy
|
|
1746
|
+
* single-backend config bypassed agent.backends synthesis.
|
|
1747
|
+
*/
|
|
1748
|
+
getRoutingDecisionBus(): RoutingDecisionBus | null;
|
|
1749
|
+
/**
|
|
1750
|
+
* Spec B Phase 5: live BackendRouter for HTTP routes. The orchestrator
|
|
1751
|
+
* dispatch path uses the factory-owned router directly; observability
|
|
1752
|
+
* routes (config / decisions) reach it through this accessor. Returns
|
|
1753
|
+
* null when the legacy single-backend config bypassed agent.backends
|
|
1754
|
+
* synthesis (no backendFactory built).
|
|
1755
|
+
*/
|
|
1756
|
+
getBackendRouter(): BackendRouter | null;
|
|
1757
|
+
/**
|
|
1758
|
+
* Spec B Phase 5: snapshot of the active RoutingConfig for the config
|
|
1759
|
+
* route and the trace route's bus-less router construction. Returns
|
|
1760
|
+
* null when the operator's harness.config.json carries no
|
|
1761
|
+
* `agent.routing` block.
|
|
1762
|
+
*/
|
|
1763
|
+
getRoutingConfig(): _harness_engineering_types.RoutingConfig | null;
|
|
1764
|
+
/**
|
|
1765
|
+
* Spec B Phase 5: snapshot of `agent.backends` for the config route
|
|
1766
|
+
* (existence annotations) and the trace route (bus-less router
|
|
1767
|
+
* construction). Returns null when no synthesized backends map exists
|
|
1768
|
+
* (legacy single-backend configs).
|
|
1769
|
+
*/
|
|
1770
|
+
getBackends(): Record<string, _harness_engineering_types.BackendDef> | null;
|
|
1398
1771
|
/** Returns the maintenance scheduler status, or null if maintenance is not enabled. */
|
|
1399
1772
|
getMaintenanceStatus(): MaintenanceStatus | null;
|
|
1400
1773
|
}
|
|
@@ -1410,47 +1783,6 @@ declare function launchTUI(orchestrator: Orchestrator): {
|
|
|
1410
1783
|
waitUntilExit: () => Promise<void>;
|
|
1411
1784
|
};
|
|
1412
1785
|
|
|
1413
|
-
interface BackendRouterOptions {
|
|
1414
|
-
backends: Record<string, BackendDef>;
|
|
1415
|
-
routing: RoutingConfig;
|
|
1416
|
-
}
|
|
1417
|
-
/**
|
|
1418
|
-
* BackendRouter
|
|
1419
|
-
*
|
|
1420
|
-
* Owns the lookup from a `RoutingUseCase` (a discriminated query — tier,
|
|
1421
|
-
* intelligence layer, maintenance, chat) to a named backend.
|
|
1422
|
-
* Construction-time validation guarantees every name referenced by
|
|
1423
|
-
* `routing` is present in `backends` so runtime lookups are total and
|
|
1424
|
-
* never throw on unknown-name references (D6/D7).
|
|
1425
|
-
*
|
|
1426
|
-
* Lookups for tier/intelligence use cases that fall through to undefined
|
|
1427
|
-
* mappings return `routing.default` without throwing — this matches the
|
|
1428
|
-
* spec's "every use case inherits default unless explicitly routed"
|
|
1429
|
-
* semantics. The `maintenance` and `chat` kinds always resolve to
|
|
1430
|
-
* `routing.default` (SC19, SC20).
|
|
1431
|
-
*/
|
|
1432
|
-
declare class BackendRouter {
|
|
1433
|
-
private readonly backends;
|
|
1434
|
-
private readonly routing;
|
|
1435
|
-
constructor(opts: BackendRouterOptions);
|
|
1436
|
-
/**
|
|
1437
|
-
* Returns the backend name for a given use case.
|
|
1438
|
-
*
|
|
1439
|
-
* - `tier`: per-tier override, falling back to `routing.default`.
|
|
1440
|
-
* - `intelligence`: per-layer override under `routing.intelligence`,
|
|
1441
|
-
* falling back to `routing.default`.
|
|
1442
|
-
* - `maintenance` / `chat`: always `routing.default`.
|
|
1443
|
-
*/
|
|
1444
|
-
resolve(useCase: RoutingUseCase): string;
|
|
1445
|
-
/**
|
|
1446
|
-
* Returns the BackendDef reference for the resolved name. Returns the
|
|
1447
|
-
* exact reference held in `backends` (no copy) so identity comparisons
|
|
1448
|
-
* succeed (SC21).
|
|
1449
|
-
*/
|
|
1450
|
-
resolveDefinition(useCase: RoutingUseCase): BackendDef;
|
|
1451
|
-
private validateReferences;
|
|
1452
|
-
}
|
|
1453
|
-
|
|
1454
1786
|
/**
|
|
1455
1787
|
* Options for `OrchestratorBackendFactory`.
|
|
1456
1788
|
*
|
|
@@ -1485,6 +1817,11 @@ interface OrchestratorBackendFactoryOptions {
|
|
|
1485
1817
|
* `/api/v1/telemetry/cache/stats` endpoint sees the full rolling window.
|
|
1486
1818
|
*/
|
|
1487
1819
|
cacheMetrics?: CacheMetricsRecorder;
|
|
1820
|
+
/**
|
|
1821
|
+
* Spec B Phase 4 (D8): forwarded to the underlying BackendRouter so
|
|
1822
|
+
* every resolve() during forUseCase / resolveName emits.
|
|
1823
|
+
*/
|
|
1824
|
+
decisionBus?: RoutingDecisionBus;
|
|
1488
1825
|
}
|
|
1489
1826
|
/**
|
|
1490
1827
|
* High-level factory wrapping `BackendRouter` + `createBackend` plus
|
|
@@ -1517,8 +1854,19 @@ declare class OrchestratorBackendFactory {
|
|
|
1517
1854
|
* is `undefined` for pure-modern configs. Threading the routed name
|
|
1518
1855
|
* through dispatch eliminates that gap.
|
|
1519
1856
|
*/
|
|
1520
|
-
resolveName(useCase: RoutingUseCase
|
|
1521
|
-
|
|
1857
|
+
resolveName(useCase: RoutingUseCase, opts?: {
|
|
1858
|
+
invocationOverride?: string;
|
|
1859
|
+
}): string;
|
|
1860
|
+
/**
|
|
1861
|
+
* Spec B Phase 1: expose the underlying router for callers that need
|
|
1862
|
+
* it directly (e.g., {@link buildIntelligencePipeline} for the
|
|
1863
|
+
* I1 SEL/PESL comparison fix). Read-only access; consumers must not
|
|
1864
|
+
* mutate router state.
|
|
1865
|
+
*/
|
|
1866
|
+
getRouter(): BackendRouter;
|
|
1867
|
+
forUseCase(useCase: RoutingUseCase, opts?: {
|
|
1868
|
+
invocationOverride?: string;
|
|
1869
|
+
}): AgentBackend;
|
|
1522
1870
|
/**
|
|
1523
1871
|
* Rebuild a `local`/`pi` backend with a resolver-bound `getModel`,
|
|
1524
1872
|
* mirroring `createBackend`'s local/pi branches but substituting the
|
|
@@ -1614,6 +1962,147 @@ interface SyncMainOptions {
|
|
|
1614
1962
|
*/
|
|
1615
1963
|
declare function syncMain(repoRoot: string, opts?: SyncMainOptions): Promise<SyncMainResult>;
|
|
1616
1964
|
|
|
1965
|
+
/**
|
|
1966
|
+
* All 21 built-in maintenance task definitions with default schedules.
|
|
1967
|
+
*
|
|
1968
|
+
* Tasks are grouped by type:
|
|
1969
|
+
* - mechanical-ai (7): Run check first, dispatch AI only if fixable issues found
|
|
1970
|
+
* - pure-ai (4): Always dispatch AI agent on schedule
|
|
1971
|
+
* - report-only (7): Run command, record metrics, no PR
|
|
1972
|
+
* - housekeeping (3): Mechanical command, no AI, no PR
|
|
1973
|
+
*/
|
|
1974
|
+
declare const BUILT_IN_TASKS: readonly TaskDefinition[];
|
|
1975
|
+
|
|
1976
|
+
/**
|
|
1977
|
+
* Unified logger interface for all maintenance classes.
|
|
1978
|
+
* Matches StructuredLogger's shape.
|
|
1979
|
+
*/
|
|
1980
|
+
interface MaintenanceLogger {
|
|
1981
|
+
info(message: string, context?: Record<string, unknown>): void;
|
|
1982
|
+
warn(message: string, context?: Record<string, unknown>): void;
|
|
1983
|
+
error(message: string, context?: Record<string, unknown>): void;
|
|
1984
|
+
debug?(message: string, context?: Record<string, unknown>): void;
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
/**
|
|
1988
|
+
* Hermes Phase 2 — A single persisted run entry.
|
|
1989
|
+
*
|
|
1990
|
+
* Mirrors `RunResult` plus the captured stdout/stderr, the parsed structured
|
|
1991
|
+
* status envelope (if any), the resolved upstream context that was injected
|
|
1992
|
+
* into the prompt (if any), and the trigger origin.
|
|
1993
|
+
*/
|
|
1994
|
+
interface PersistedOutputEntry {
|
|
1995
|
+
taskId: string;
|
|
1996
|
+
startedAt: string;
|
|
1997
|
+
completedAt: string;
|
|
1998
|
+
status: RunResult['status'];
|
|
1999
|
+
findings: number;
|
|
2000
|
+
fixed: number;
|
|
2001
|
+
prUrl: string | null;
|
|
2002
|
+
prUpdated: boolean;
|
|
2003
|
+
error?: string;
|
|
2004
|
+
costUsd?: number;
|
|
2005
|
+
origin?: RunOrigin;
|
|
2006
|
+
/** Raw captured stdout from the check step (or housekeeping command). */
|
|
2007
|
+
stdout?: string;
|
|
2008
|
+
/** Raw captured stderr from the check step. */
|
|
2009
|
+
stderr?: string;
|
|
2010
|
+
/** Structured envelope when a JSON status line was parsed; null otherwise. */
|
|
2011
|
+
structured?: Record<string, unknown> | null;
|
|
2012
|
+
/** Resolved upstream-context block, if any. */
|
|
2013
|
+
context?: string;
|
|
2014
|
+
}
|
|
2015
|
+
interface TaskOutputStoreOptions {
|
|
2016
|
+
/** Root directory under which `<taskId>/outputs/` lives. Default: `.harness/maintenance`. */
|
|
2017
|
+
rootDir: string;
|
|
2018
|
+
/** Default retention bounds applied when a task doesn't specify its own. */
|
|
2019
|
+
retentionDefaults?: Required<OutputRetentionConfig>;
|
|
2020
|
+
logger?: MaintenanceLogger;
|
|
2021
|
+
}
|
|
2022
|
+
/**
|
|
2023
|
+
* Persists per-task run outputs to disk and applies retention. The store is
|
|
2024
|
+
* intentionally simple: one file per run keyed by completion timestamp, JSON
|
|
2025
|
+
* payload, no SQLite. The chain-context read path (`latest`) and the
|
|
2026
|
+
* dashboard list path (`list`) both consume the same on-disk format.
|
|
2027
|
+
*
|
|
2028
|
+
* Concurrency: `processQueue` already serializes runs of the same task ID,
|
|
2029
|
+
* so the store assumes exclusive write access per task.
|
|
2030
|
+
*/
|
|
2031
|
+
declare class TaskOutputStore {
|
|
2032
|
+
private rootDir;
|
|
2033
|
+
private retentionDefaults;
|
|
2034
|
+
private logger;
|
|
2035
|
+
constructor(options: TaskOutputStoreOptions);
|
|
2036
|
+
/**
|
|
2037
|
+
* Reject task IDs that don't match the validator's kebab-case pattern —
|
|
2038
|
+
* defends `dirFor()` against caller-supplied path-traversal segments
|
|
2039
|
+
* (`'../foo'`) when the store is invoked from CLI surfaces that don't
|
|
2040
|
+
* round-trip through `validateCustomTasks`.
|
|
2041
|
+
*/
|
|
2042
|
+
private ensureSafeTaskId;
|
|
2043
|
+
/**
|
|
2044
|
+
* Persist a single run entry. Retention is applied after the write so
|
|
2045
|
+
* the latest record is durable even if pruning fails.
|
|
2046
|
+
*/
|
|
2047
|
+
write(taskId: string, entry: PersistedOutputEntry, retention?: OutputRetentionConfig): Promise<void>;
|
|
2048
|
+
/**
|
|
2049
|
+
* Return the most recent persisted entry for the task, or null if none.
|
|
2050
|
+
*/
|
|
2051
|
+
latest(taskId: string): Promise<PersistedOutputEntry | null>;
|
|
2052
|
+
/**
|
|
2053
|
+
* List entries newest-first with offset+limit pagination.
|
|
2054
|
+
*/
|
|
2055
|
+
list(taskId: string, limit: number, offset: number): Promise<PersistedOutputEntry[]>;
|
|
2056
|
+
/**
|
|
2057
|
+
* Lookup a specific run by its file name (without the `.json` suffix) or
|
|
2058
|
+
* by its raw completion timestamp.
|
|
2059
|
+
*/
|
|
2060
|
+
get(taskId: string, runId: string): Promise<PersistedOutputEntry | null>;
|
|
2061
|
+
/**
|
|
2062
|
+
* The on-disk root for a given task. Exposed for tooling that needs to walk
|
|
2063
|
+
* outputs from outside the store API.
|
|
2064
|
+
*/
|
|
2065
|
+
dirFor(taskId: string): string;
|
|
2066
|
+
private readEntry;
|
|
2067
|
+
private applyRetention;
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
/**
|
|
2071
|
+
* Hermes Phase 2 — Validation errors surfaced by `validateCustomTasks`.
|
|
2072
|
+
*
|
|
2073
|
+
* `path` always begins with `customTasks.<taskId>` so the caller can render
|
|
2074
|
+
* it directly without re-prefixing. Multiple errors may be returned in a
|
|
2075
|
+
* single call; the validator does not short-circuit on the first failure.
|
|
2076
|
+
*/
|
|
2077
|
+
interface CustomTaskValidationError {
|
|
2078
|
+
path: string;
|
|
2079
|
+
message: string;
|
|
2080
|
+
}
|
|
2081
|
+
interface CustomTaskValidatorDeps {
|
|
2082
|
+
/** Returns true if a skill with this name exists in the project's registry. */
|
|
2083
|
+
skillExists?: (name: string) => boolean;
|
|
2084
|
+
/** Returns true if the executable referenced by a checkScript.path exists. */
|
|
2085
|
+
scriptExists?: (path: string) => boolean;
|
|
2086
|
+
}
|
|
2087
|
+
/**
|
|
2088
|
+
* Validates a `MaintenanceConfig.customTasks` map.
|
|
2089
|
+
*
|
|
2090
|
+
* Checks:
|
|
2091
|
+
* - kebab-case task IDs (matching the BUILT_IN_TASKS convention)
|
|
2092
|
+
* - no collision with built-in IDs
|
|
2093
|
+
* - per-type required fields (e.g., mechanical-ai must have `branch` + `fixSkill`)
|
|
2094
|
+
* - exactly one of `checkCommand` / `checkScript` for types that need a check step
|
|
2095
|
+
* - `contextFrom` cycle detection across the merged graph (built-ins + customs)
|
|
2096
|
+
* - `contextFrom` entries reference existing task IDs
|
|
2097
|
+
* - `inlineSkills` entries exist in the skill registry (when `skillExists` is provided)
|
|
2098
|
+
* - `checkScript.path` exists on disk (when `scriptExists` is provided)
|
|
2099
|
+
*
|
|
2100
|
+
* Returns `Ok(void)` when all custom tasks pass; otherwise an `Err` carrying
|
|
2101
|
+
* every distinct violation. The validator is pure: no I/O outside the
|
|
2102
|
+
* injected predicates.
|
|
2103
|
+
*/
|
|
2104
|
+
declare function validateCustomTasks(customTasks: Record<string, CustomTaskDefinition> | undefined, builtIns: readonly TaskDefinition[], deps?: CustomTaskValidatorDeps): Result<void, CustomTaskValidationError[]>;
|
|
2105
|
+
|
|
1617
2106
|
interface CreateTokenInput {
|
|
1618
2107
|
name: string;
|
|
1619
2108
|
scopes: TokenScope[];
|
|
@@ -1980,4 +2469,87 @@ interface WireParams {
|
|
|
1980
2469
|
}
|
|
1981
2470
|
declare function wireNotificationSinks({ bus, registry }: WireParams): () => void;
|
|
1982
2471
|
|
|
1983
|
-
|
|
2472
|
+
/**
|
|
2473
|
+
* Phase 4 gate (degraded mode, see spec D5).
|
|
2474
|
+
*
|
|
2475
|
+
* The full design calls for `harness skill run harness-soundness-review
|
|
2476
|
+
* --mode skill` against materialized proposal content. The skill-mode check
|
|
2477
|
+
* vocabulary is not yet designed; its design is the explicit follow-up spec
|
|
2478
|
+
* referenced in Phase 4's Non-goals.
|
|
2479
|
+
*
|
|
2480
|
+
* In v1 we run a small set of mechanical checks inline against the proposal
|
|
2481
|
+
* payload. They cover the obvious structural failures (unparseable YAML,
|
|
2482
|
+
* empty markdown, name/regex drift) without needing an LLM. The result
|
|
2483
|
+
* shape mirrors the eventual soundness-review output so the downstream
|
|
2484
|
+
* promote step (and dashboard panel) does not need to change when
|
|
2485
|
+
* skill-mode lands.
|
|
2486
|
+
*/
|
|
2487
|
+
declare class GateRunError extends Error {
|
|
2488
|
+
constructor(message: string);
|
|
2489
|
+
}
|
|
2490
|
+
interface GateResult {
|
|
2491
|
+
proposalId: string;
|
|
2492
|
+
status: SkillProposal['status'];
|
|
2493
|
+
findings: ProposalGateFinding[];
|
|
2494
|
+
runAt: string;
|
|
2495
|
+
}
|
|
2496
|
+
/**
|
|
2497
|
+
* Synchronously run the gate against the given proposal. The proposal is
|
|
2498
|
+
* read from disk, checks are computed, and the proposal JSON is patched
|
|
2499
|
+
* with the gate result. Returns the post-update gate snapshot for the
|
|
2500
|
+
* caller to render.
|
|
2501
|
+
*/
|
|
2502
|
+
declare function runGate(projectPath: string, proposalId: string): Promise<GateResult>;
|
|
2503
|
+
|
|
2504
|
+
declare class GateNotReadyError extends Error {
|
|
2505
|
+
constructor(message: string);
|
|
2506
|
+
}
|
|
2507
|
+
declare class PromotionError extends Error {
|
|
2508
|
+
constructor(message: string);
|
|
2509
|
+
}
|
|
2510
|
+
interface PromotionResult {
|
|
2511
|
+
proposalId: string;
|
|
2512
|
+
skillPath: string;
|
|
2513
|
+
/** Provenance field stamped onto the promoted skill. */
|
|
2514
|
+
provenance: 'agent-proposed';
|
|
2515
|
+
}
|
|
2516
|
+
/**
|
|
2517
|
+
* Promote a proposal to the skill catalog. Caller is responsible for
|
|
2518
|
+
* emitting `proposal.approved` after a successful return.
|
|
2519
|
+
*/
|
|
2520
|
+
declare function promote(projectPath: string, proposalId: string, decidedBy: string): Promise<PromotionResult>;
|
|
2521
|
+
|
|
2522
|
+
/**
|
|
2523
|
+
* Phase 4 — thin wrappers around the orchestrator event bus that emit the
|
|
2524
|
+
* three `proposal.*` lifecycle events with a stable, validated payload
|
|
2525
|
+
* shape. Both the webhook fan-out (gateway/webhooks/events.ts) and the
|
|
2526
|
+
* in-process notification dispatcher (notifications/events.ts) subscribe
|
|
2527
|
+
* to these topics; their envelope derivers know the field names below.
|
|
2528
|
+
*/
|
|
2529
|
+
interface ProposalCreatedData {
|
|
2530
|
+
id: string;
|
|
2531
|
+
kind: SkillProposal['kind'];
|
|
2532
|
+
name: string;
|
|
2533
|
+
targetSkill?: string;
|
|
2534
|
+
proposedBy: string;
|
|
2535
|
+
justification: string;
|
|
2536
|
+
}
|
|
2537
|
+
interface ProposalApprovedData {
|
|
2538
|
+
id: string;
|
|
2539
|
+
kind: SkillProposal['kind'];
|
|
2540
|
+
name: string;
|
|
2541
|
+
targetSkill?: string;
|
|
2542
|
+
decidedBy: string;
|
|
2543
|
+
}
|
|
2544
|
+
interface ProposalRejectedData {
|
|
2545
|
+
id: string;
|
|
2546
|
+
kind: SkillProposal['kind'];
|
|
2547
|
+
name: string;
|
|
2548
|
+
decidedBy: string;
|
|
2549
|
+
reason: string;
|
|
2550
|
+
}
|
|
2551
|
+
declare function emitProposalCreated(bus: EventEmitter, proposal: SkillProposal): void;
|
|
2552
|
+
declare function emitProposalApproved(bus: EventEmitter, proposal: SkillProposal): void;
|
|
2553
|
+
declare function emitProposalRejected(bus: EventEmitter, proposal: SkillProposal): void;
|
|
2554
|
+
|
|
2555
|
+
export { type AgentUpdateEvent, AnalysisArchive, type AnalysisRecord, type ApplyEventResult, type ArtifactPresence, type AttemptStats, BUILT_IN_TASKS, BackendRouter, type BackendRouterOptions, type BaseRefFallbackEvent, type BuildArchiveHooksOptions, ClaimManager, type ClaimManagerConfig, type CleanWorkspaceEffect, type CreateTokenInput, type CreateTokenResult, type CustomTaskValidationError, type DispatchEffect, type EmitLogEffect, type EscalateEffect, type ExecFileFn$1 as ExecFileFn, type FromConfigOptions, GateNotReadyError, type GateResult, GateRunError, type Highlight, type HighlightsInfo, type IndexedDoc, InteractionQueue, type LinearGraphQLExtension, LinearGraphQLStub, type LiveSession, MAX_ATTEMPTS, type MigrationResult, MockBackend, type NotificationSink, type NotificationSinkDeliverInput, ORCHESTRATOR_IDENTITY_FILE, Orchestrator, OrchestratorBackendFactory, type OrchestratorBackendFactoryOptions, type OrchestratorContext, type OrchestratorEvent, type OrchestratorState, PRDetector, type PRDetectorLogger, type PendingInteraction, type PersistedOutputEntry, PromotionError, type PromotionResult, PromptRenderer, type ProposalApprovedData, type ProposalCreatedData, type ProposalRejectedData, type PublishedIndex, type QueueInsertInput, type QueueRow, type QueueStats, RETRY_DELAYS_MS, type RateLimitSnapshot as RateLimitComputeSnapshot, type RateLimitConfig, type RateLimitSnapshot$1 as RateLimitSnapshot, type RegistryEntry, type ReleaseClaimEffect, type RetryEntry, type RetryFiredEvent, RoadmapTrackerAdapter, type RunAttemptPhase, type RunOrigin, type RunningEntry, type ScheduleRetryEffect, type SearchOptions, type SideEffect, SinkConfigError, SinkRegistry, type SkillCatalogEntry, SlackSink, type SlackSinkOptions, SqliteSearchIndex, type StallDetectedEvent, type StopEffect, type StreamManifest, StreamRecorder, type SummarizeContext, type SummarizeResult, type SyncMainOptions, type SyncMainResult, type SyncSkipReason, type TaskDefinition, TaskOutputStore, type TaskType, type TickEvent, TokenStore, type TokenTotals, type TriageConfig, type TriageDecision, type TriageSignals, type TriageSkill, type UpdateTokensEffect, type ValidateWorkflowConfigOptions, type ValidatedWorkflowConfig, WebhookQueue, type WorkerExitEvent, WorkflowLoader, WorkspaceHooks, WorkspaceManager, type WorkspaceManagerOptions, applyEvent, artifactPresenceFromIssue, buildArchiveHooks, calculateRetryDelay, canDispatch, computeRateLimitDelay, createBackend, createEmptyState, crossFieldRoutingIssues, detectScopeTier, discoverSkillCatalog, discoverSkillCatalogNames, emitProposalApproved, emitProposalCreated, emitProposalRejected, extractHighlights, extractTitlePrefix, getAvailableSlots, getDefaultConfig, getPerStateCount, indexSessionDirectory, isEligible, isSummaryEnabled, launchTUI, loadPublishedIndex, migrateAgentConfig, normalizeFts5Query, openSearchIndex, promote, reconcile, reindexFromArchive, renderAnalysisComment, renderLlmSummaryMarkdown, renderPRComment, resolveEscalationConfig, resolveOrchestratorId, routeIssue, routingWarnings, runGate, savePublishedIndex, searchIndexPath, selectCandidates, sortCandidates, summarizeArchivedSession, syncMain, triageIssue, truncateForBudget, validateCustomTasks, validateWorkflowConfig, wireNotificationSinks, wrapAsEnvelope };
|