@harness-engineering/orchestrator 0.8.1 → 0.8.3
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 +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +86 -16
- package/dist/index.mjs +87 -18
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1099,6 +1099,25 @@ declare class WorkspaceManager {
|
|
|
1099
1099
|
* swallowed — dispatch should not be blocked by transient network issues.
|
|
1100
1100
|
*/
|
|
1101
1101
|
private tryFetch;
|
|
1102
|
+
/**
|
|
1103
|
+
* Default paths seeded into a fresh worktree when {@link WorkspaceConfig.seedPaths}
|
|
1104
|
+
* is unset — the artifacts produced by the brainstorm → orchestrator handoff.
|
|
1105
|
+
*/
|
|
1106
|
+
private static readonly DEFAULT_SEED_PATHS;
|
|
1107
|
+
/**
|
|
1108
|
+
* Copies the configured seed paths from the root working tree into a
|
|
1109
|
+
* freshly-created worktree, overlaying the committed checkout.
|
|
1110
|
+
*
|
|
1111
|
+
* A new worktree is based on a committed remote ref, so it does not contain
|
|
1112
|
+
* uncommitted artifacts that exist only in the root working tree (a
|
|
1113
|
+
* just-written proposal under `.harness/proposals/`, a promoted row in
|
|
1114
|
+
* `docs/roadmap.md`). Seeding carries them over so a dispatched agent sees
|
|
1115
|
+
* the same state the orchestrator dispatched from.
|
|
1116
|
+
*
|
|
1117
|
+
* Best-effort by design: a missing source is skipped, and a copy failure is
|
|
1118
|
+
* swallowed — neither must ever block dispatch.
|
|
1119
|
+
*/
|
|
1120
|
+
private seedWorkspace;
|
|
1102
1121
|
/**
|
|
1103
1122
|
* Resolves the ref that new worktrees should be based on.
|
|
1104
1123
|
*
|
|
@@ -1487,6 +1506,18 @@ declare class BackendRouter {
|
|
|
1487
1506
|
private validateReferences;
|
|
1488
1507
|
}
|
|
1489
1508
|
|
|
1509
|
+
/**
|
|
1510
|
+
* Derives the worktree seed paths from a workflow config when
|
|
1511
|
+
* {@link WorkspaceConfig.seedPaths} is not set explicitly.
|
|
1512
|
+
*
|
|
1513
|
+
* A new worktree is checked out from a committed remote ref and therefore lacks
|
|
1514
|
+
* the uncommitted artifacts of the brainstorm → orchestrator handoff. Seeding
|
|
1515
|
+
* carries them over: the proposal directory, plus the roadmap file at its
|
|
1516
|
+
* *configured* location — a roadmap tracker may point `filePath` somewhere
|
|
1517
|
+
* other than the default `docs/roadmap.md`, and the default seed list would
|
|
1518
|
+
* otherwise miss it.
|
|
1519
|
+
*/
|
|
1520
|
+
declare function deriveSeedPaths(config: WorkflowConfig): string[];
|
|
1490
1521
|
/**
|
|
1491
1522
|
* The central orchestrator that manages the lifecycle of coding agents.
|
|
1492
1523
|
*
|
|
@@ -2817,4 +2848,4 @@ declare function emitProposalCreated(bus: EventEmitter, proposal: SkillProposal)
|
|
|
2817
2848
|
declare function emitProposalApproved(bus: EventEmitter, proposal: SkillProposal): void;
|
|
2818
2849
|
declare function emitProposalRejected(bus: EventEmitter, proposal: SkillProposal): void;
|
|
2819
2850
|
|
|
2820
|
-
export { type AgentUpdateEvent, AnalysisArchive, type AnalysisRecord, type ApplyEventResult, type ArtifactPresence, type AttemptStats, BUILT_IN_TASKS, BackendDefSchema, 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, LocalModelResolver, type LocalModelResolverOptions, 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 ResolverLogger, type RetryEntry, type RetryFiredEvent, RoadmapTrackerAdapter, RoutingConfigSchema, RoutingValueSchema, 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, defaultFetchModels, detectScopeTier, discoverSkillCatalog, discoverSkillCatalogNames, emitProposalApproved, emitProposalCreated, emitProposalRejected, extractHighlights, extractTitlePrefix, getAvailableSlots, getDefaultConfig, getPerStateCount, indexSessionDirectory, isEligible, isSummaryEnabled, launchTUI, loadPublishedIndex, migrateAgentConfig, normalizeFts5Query, normalizeLocalModel, openSearchIndex, promote, reconcile, reindexFromArchive, renderAnalysisComment, renderLlmSummaryMarkdown, renderPRComment, resolveEscalationConfig, resolveOrchestratorId, routeIssue, routingWarnings, runGate, savePublishedIndex, searchIndexPath, selectCandidates, sortCandidates, summarizeArchivedSession, syncMain, triageIssue, truncateForBudget, validateCustomTasks, validateWorkflowConfig, wireNotificationSinks, wrapAsEnvelope };
|
|
2851
|
+
export { type AgentUpdateEvent, AnalysisArchive, type AnalysisRecord, type ApplyEventResult, type ArtifactPresence, type AttemptStats, BUILT_IN_TASKS, BackendDefSchema, 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, LocalModelResolver, type LocalModelResolverOptions, 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 ResolverLogger, type RetryEntry, type RetryFiredEvent, RoadmapTrackerAdapter, RoutingConfigSchema, RoutingValueSchema, 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, defaultFetchModels, deriveSeedPaths, detectScopeTier, discoverSkillCatalog, discoverSkillCatalogNames, emitProposalApproved, emitProposalCreated, emitProposalRejected, extractHighlights, extractTitlePrefix, getAvailableSlots, getDefaultConfig, getPerStateCount, indexSessionDirectory, isEligible, isSummaryEnabled, launchTUI, loadPublishedIndex, migrateAgentConfig, normalizeFts5Query, normalizeLocalModel, openSearchIndex, promote, reconcile, reindexFromArchive, renderAnalysisComment, renderLlmSummaryMarkdown, renderPRComment, resolveEscalationConfig, resolveOrchestratorId, routeIssue, routingWarnings, runGate, savePublishedIndex, searchIndexPath, selectCandidates, sortCandidates, summarizeArchivedSession, syncMain, triageIssue, truncateForBudget, validateCustomTasks, validateWorkflowConfig, wireNotificationSinks, wrapAsEnvelope };
|
package/dist/index.d.ts
CHANGED
|
@@ -1099,6 +1099,25 @@ declare class WorkspaceManager {
|
|
|
1099
1099
|
* swallowed — dispatch should not be blocked by transient network issues.
|
|
1100
1100
|
*/
|
|
1101
1101
|
private tryFetch;
|
|
1102
|
+
/**
|
|
1103
|
+
* Default paths seeded into a fresh worktree when {@link WorkspaceConfig.seedPaths}
|
|
1104
|
+
* is unset — the artifacts produced by the brainstorm → orchestrator handoff.
|
|
1105
|
+
*/
|
|
1106
|
+
private static readonly DEFAULT_SEED_PATHS;
|
|
1107
|
+
/**
|
|
1108
|
+
* Copies the configured seed paths from the root working tree into a
|
|
1109
|
+
* freshly-created worktree, overlaying the committed checkout.
|
|
1110
|
+
*
|
|
1111
|
+
* A new worktree is based on a committed remote ref, so it does not contain
|
|
1112
|
+
* uncommitted artifacts that exist only in the root working tree (a
|
|
1113
|
+
* just-written proposal under `.harness/proposals/`, a promoted row in
|
|
1114
|
+
* `docs/roadmap.md`). Seeding carries them over so a dispatched agent sees
|
|
1115
|
+
* the same state the orchestrator dispatched from.
|
|
1116
|
+
*
|
|
1117
|
+
* Best-effort by design: a missing source is skipped, and a copy failure is
|
|
1118
|
+
* swallowed — neither must ever block dispatch.
|
|
1119
|
+
*/
|
|
1120
|
+
private seedWorkspace;
|
|
1102
1121
|
/**
|
|
1103
1122
|
* Resolves the ref that new worktrees should be based on.
|
|
1104
1123
|
*
|
|
@@ -1487,6 +1506,18 @@ declare class BackendRouter {
|
|
|
1487
1506
|
private validateReferences;
|
|
1488
1507
|
}
|
|
1489
1508
|
|
|
1509
|
+
/**
|
|
1510
|
+
* Derives the worktree seed paths from a workflow config when
|
|
1511
|
+
* {@link WorkspaceConfig.seedPaths} is not set explicitly.
|
|
1512
|
+
*
|
|
1513
|
+
* A new worktree is checked out from a committed remote ref and therefore lacks
|
|
1514
|
+
* the uncommitted artifacts of the brainstorm → orchestrator handoff. Seeding
|
|
1515
|
+
* carries them over: the proposal directory, plus the roadmap file at its
|
|
1516
|
+
* *configured* location — a roadmap tracker may point `filePath` somewhere
|
|
1517
|
+
* other than the default `docs/roadmap.md`, and the default seed list would
|
|
1518
|
+
* otherwise miss it.
|
|
1519
|
+
*/
|
|
1520
|
+
declare function deriveSeedPaths(config: WorkflowConfig): string[];
|
|
1490
1521
|
/**
|
|
1491
1522
|
* The central orchestrator that manages the lifecycle of coding agents.
|
|
1492
1523
|
*
|
|
@@ -2817,4 +2848,4 @@ declare function emitProposalCreated(bus: EventEmitter, proposal: SkillProposal)
|
|
|
2817
2848
|
declare function emitProposalApproved(bus: EventEmitter, proposal: SkillProposal): void;
|
|
2818
2849
|
declare function emitProposalRejected(bus: EventEmitter, proposal: SkillProposal): void;
|
|
2819
2850
|
|
|
2820
|
-
export { type AgentUpdateEvent, AnalysisArchive, type AnalysisRecord, type ApplyEventResult, type ArtifactPresence, type AttemptStats, BUILT_IN_TASKS, BackendDefSchema, 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, LocalModelResolver, type LocalModelResolverOptions, 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 ResolverLogger, type RetryEntry, type RetryFiredEvent, RoadmapTrackerAdapter, RoutingConfigSchema, RoutingValueSchema, 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, defaultFetchModels, detectScopeTier, discoverSkillCatalog, discoverSkillCatalogNames, emitProposalApproved, emitProposalCreated, emitProposalRejected, extractHighlights, extractTitlePrefix, getAvailableSlots, getDefaultConfig, getPerStateCount, indexSessionDirectory, isEligible, isSummaryEnabled, launchTUI, loadPublishedIndex, migrateAgentConfig, normalizeFts5Query, normalizeLocalModel, openSearchIndex, promote, reconcile, reindexFromArchive, renderAnalysisComment, renderLlmSummaryMarkdown, renderPRComment, resolveEscalationConfig, resolveOrchestratorId, routeIssue, routingWarnings, runGate, savePublishedIndex, searchIndexPath, selectCandidates, sortCandidates, summarizeArchivedSession, syncMain, triageIssue, truncateForBudget, validateCustomTasks, validateWorkflowConfig, wireNotificationSinks, wrapAsEnvelope };
|
|
2851
|
+
export { type AgentUpdateEvent, AnalysisArchive, type AnalysisRecord, type ApplyEventResult, type ArtifactPresence, type AttemptStats, BUILT_IN_TASKS, BackendDefSchema, 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, LocalModelResolver, type LocalModelResolverOptions, 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 ResolverLogger, type RetryEntry, type RetryFiredEvent, RoadmapTrackerAdapter, RoutingConfigSchema, RoutingValueSchema, 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, defaultFetchModels, deriveSeedPaths, detectScopeTier, discoverSkillCatalog, discoverSkillCatalogNames, emitProposalApproved, emitProposalCreated, emitProposalRejected, extractHighlights, extractTitlePrefix, getAvailableSlots, getDefaultConfig, getPerStateCount, indexSessionDirectory, isEligible, isSummaryEnabled, launchTUI, loadPublishedIndex, migrateAgentConfig, normalizeFts5Query, normalizeLocalModel, openSearchIndex, promote, reconcile, reindexFromArchive, renderAnalysisComment, renderLlmSummaryMarkdown, renderPRComment, resolveEscalationConfig, resolveOrchestratorId, routeIssue, routingWarnings, runGate, savePublishedIndex, searchIndexPath, selectCandidates, sortCandidates, summarizeArchivedSession, syncMain, triageIssue, truncateForBudget, validateCustomTasks, validateWorkflowConfig, wireNotificationSinks, wrapAsEnvelope };
|
package/dist/index.js
CHANGED
|
@@ -73,6 +73,7 @@ __export(index_exports, {
|
|
|
73
73
|
createEmptyState: () => createEmptyState,
|
|
74
74
|
crossFieldRoutingIssues: () => crossFieldRoutingIssues,
|
|
75
75
|
defaultFetchModels: () => defaultFetchModels,
|
|
76
|
+
deriveSeedPaths: () => deriveSeedPaths,
|
|
76
77
|
detectScopeTier: () => detectScopeTier,
|
|
77
78
|
discoverSkillCatalog: () => discoverSkillCatalog,
|
|
78
79
|
discoverSkillCatalogNames: () => discoverSkillCatalogNames,
|
|
@@ -2459,7 +2460,7 @@ var path8 = __toESM(require("path"));
|
|
|
2459
2460
|
var import_node_child_process2 = require("child_process");
|
|
2460
2461
|
var import_node_util2 = require("util");
|
|
2461
2462
|
var import_types6 = require("@harness-engineering/types");
|
|
2462
|
-
var WorkspaceManager = class {
|
|
2463
|
+
var WorkspaceManager = class _WorkspaceManager {
|
|
2463
2464
|
config;
|
|
2464
2465
|
/** Absolute path to the git repository root (resolved lazily). */
|
|
2465
2466
|
repoRoot = null;
|
|
@@ -2530,6 +2531,7 @@ var WorkspaceManager = class {
|
|
|
2530
2531
|
await this.tryFetch(repoRoot);
|
|
2531
2532
|
const baseRef = await this.resolveBaseRef(repoRoot);
|
|
2532
2533
|
await this.git(["worktree", "add", "--detach", workspacePath, baseRef], repoRoot);
|
|
2534
|
+
await this.seedWorkspace(workspacePath, repoRoot);
|
|
2533
2535
|
return (0, import_types6.Ok)(workspacePath);
|
|
2534
2536
|
} catch (error) {
|
|
2535
2537
|
return (0, import_types6.Err)(error instanceof Error ? error : new Error(String(error)));
|
|
@@ -2546,6 +2548,44 @@ var WorkspaceManager = class {
|
|
|
2546
2548
|
} catch {
|
|
2547
2549
|
}
|
|
2548
2550
|
}
|
|
2551
|
+
/**
|
|
2552
|
+
* Default paths seeded into a fresh worktree when {@link WorkspaceConfig.seedPaths}
|
|
2553
|
+
* is unset — the artifacts produced by the brainstorm → orchestrator handoff.
|
|
2554
|
+
*/
|
|
2555
|
+
static DEFAULT_SEED_PATHS = [".harness/proposals", "docs/roadmap.md"];
|
|
2556
|
+
/**
|
|
2557
|
+
* Copies the configured seed paths from the root working tree into a
|
|
2558
|
+
* freshly-created worktree, overlaying the committed checkout.
|
|
2559
|
+
*
|
|
2560
|
+
* A new worktree is based on a committed remote ref, so it does not contain
|
|
2561
|
+
* uncommitted artifacts that exist only in the root working tree (a
|
|
2562
|
+
* just-written proposal under `.harness/proposals/`, a promoted row in
|
|
2563
|
+
* `docs/roadmap.md`). Seeding carries them over so a dispatched agent sees
|
|
2564
|
+
* the same state the orchestrator dispatched from.
|
|
2565
|
+
*
|
|
2566
|
+
* Best-effort by design: a missing source is skipped, and a copy failure is
|
|
2567
|
+
* swallowed — neither must ever block dispatch.
|
|
2568
|
+
*/
|
|
2569
|
+
async seedWorkspace(workspacePath, repoRoot) {
|
|
2570
|
+
const seedPaths = this.config.seedPaths ?? _WorkspaceManager.DEFAULT_SEED_PATHS;
|
|
2571
|
+
for (const entry of seedPaths) {
|
|
2572
|
+
const rel = path8.isAbsolute(entry) ? path8.relative(repoRoot, entry).replaceAll("\\", "/") : entry;
|
|
2573
|
+
if (!rel || rel === ".." || rel.startsWith("../") || path8.isAbsolute(rel)) {
|
|
2574
|
+
continue;
|
|
2575
|
+
}
|
|
2576
|
+
const src = path8.join(repoRoot, rel);
|
|
2577
|
+
try {
|
|
2578
|
+
await fs9.access(src);
|
|
2579
|
+
} catch {
|
|
2580
|
+
continue;
|
|
2581
|
+
}
|
|
2582
|
+
const dest = path8.join(workspacePath, rel);
|
|
2583
|
+
try {
|
|
2584
|
+
await fs9.cp(src, dest, { recursive: true, force: true });
|
|
2585
|
+
} catch {
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2549
2589
|
/**
|
|
2550
2590
|
* Resolves the ref that new worktrees should be based on.
|
|
2551
2591
|
*
|
|
@@ -4746,7 +4786,7 @@ var OpenAIBackend = class {
|
|
|
4746
4786
|
};
|
|
4747
4787
|
|
|
4748
4788
|
// src/agent/backends/gemini.ts
|
|
4749
|
-
var
|
|
4789
|
+
var import_genai = require("@google/genai");
|
|
4750
4790
|
var import_types13 = require("@harness-engineering/types");
|
|
4751
4791
|
var import_core6 = require("@harness-engineering/core");
|
|
4752
4792
|
var GeminiBackend = class {
|
|
@@ -4784,16 +4824,21 @@ var GeminiBackend = class {
|
|
|
4784
4824
|
let cacheCreationTokens = 0;
|
|
4785
4825
|
let cacheReadTokens = 0;
|
|
4786
4826
|
try {
|
|
4787
|
-
const genAI = new
|
|
4788
|
-
const
|
|
4827
|
+
const genAI = new import_genai.GoogleGenAI({ apiKey: this.config.apiKey });
|
|
4828
|
+
const response = await genAI.models.generateContentStream({
|
|
4789
4829
|
model: this.config.model,
|
|
4830
|
+
contents: params.prompt,
|
|
4790
4831
|
...geminiSession.systemPrompt !== void 0 && {
|
|
4791
|
-
systemInstruction: geminiSession.systemPrompt
|
|
4832
|
+
config: { systemInstruction: geminiSession.systemPrompt }
|
|
4792
4833
|
}
|
|
4793
4834
|
});
|
|
4794
|
-
const
|
|
4795
|
-
|
|
4796
|
-
|
|
4835
|
+
for await (const chunk of response) {
|
|
4836
|
+
let text;
|
|
4837
|
+
try {
|
|
4838
|
+
text = chunk.text;
|
|
4839
|
+
} catch {
|
|
4840
|
+
text = void 0;
|
|
4841
|
+
}
|
|
4797
4842
|
if (text) {
|
|
4798
4843
|
const event = {
|
|
4799
4844
|
type: "text",
|
|
@@ -4823,7 +4868,13 @@ var GeminiBackend = class {
|
|
|
4823
4868
|
return {
|
|
4824
4869
|
success: false,
|
|
4825
4870
|
sessionId: session.sessionId,
|
|
4826
|
-
usage: {
|
|
4871
|
+
usage: {
|
|
4872
|
+
inputTokens,
|
|
4873
|
+
outputTokens,
|
|
4874
|
+
totalTokens,
|
|
4875
|
+
cacheCreationTokens,
|
|
4876
|
+
cacheReadTokens
|
|
4877
|
+
},
|
|
4827
4878
|
error: errorMessage
|
|
4828
4879
|
};
|
|
4829
4880
|
}
|
|
@@ -4850,9 +4901,14 @@ var GeminiBackend = class {
|
|
|
4850
4901
|
return (0, import_types13.Ok)(void 0);
|
|
4851
4902
|
}
|
|
4852
4903
|
async healthCheck() {
|
|
4904
|
+
if (!this.config.apiKey) {
|
|
4905
|
+
return (0, import_types13.Err)({
|
|
4906
|
+
category: "agent_not_found",
|
|
4907
|
+
message: "GEMINI_API_KEY is not set"
|
|
4908
|
+
});
|
|
4909
|
+
}
|
|
4853
4910
|
try {
|
|
4854
|
-
|
|
4855
|
-
genAI.getGenerativeModel({ model: this.config.model });
|
|
4911
|
+
new import_genai.GoogleGenAI({ apiKey: this.config.apiKey });
|
|
4856
4912
|
return (0, import_types13.Ok)(void 0);
|
|
4857
4913
|
} catch (err) {
|
|
4858
4914
|
return (0, import_types13.Err)({
|
|
@@ -12424,6 +12480,10 @@ function reportCycle(path24, next, errors, reported) {
|
|
|
12424
12480
|
}
|
|
12425
12481
|
|
|
12426
12482
|
// src/orchestrator.ts
|
|
12483
|
+
function deriveSeedPaths(config) {
|
|
12484
|
+
const roadmapPath = config.tracker.kind === "roadmap" && config.tracker.filePath ? config.tracker.filePath : "docs/roadmap.md";
|
|
12485
|
+
return [".harness/proposals", roadmapPath];
|
|
12486
|
+
}
|
|
12427
12487
|
var Orchestrator = class extends import_node_events.EventEmitter {
|
|
12428
12488
|
state;
|
|
12429
12489
|
config;
|
|
@@ -12587,12 +12647,21 @@ var Orchestrator = class extends import_node_events.EventEmitter {
|
|
|
12587
12647
|
);
|
|
12588
12648
|
}
|
|
12589
12649
|
this.tracker = overrides?.tracker || this.createTracker();
|
|
12590
|
-
this.workspace = new WorkspaceManager(
|
|
12591
|
-
|
|
12592
|
-
|
|
12593
|
-
|
|
12650
|
+
this.workspace = new WorkspaceManager(
|
|
12651
|
+
{
|
|
12652
|
+
...config.workspace,
|
|
12653
|
+
// Seed the brainstorm handoff artifacts into each fresh worktree. An
|
|
12654
|
+
// explicit `seedPaths` wins; otherwise derive from the tracker config
|
|
12655
|
+
// so a non-default roadmap location is still carried over.
|
|
12656
|
+
seedPaths: config.workspace.seedPaths ?? deriveSeedPaths(config)
|
|
12657
|
+
},
|
|
12658
|
+
{
|
|
12659
|
+
emitEvent: (event) => {
|
|
12660
|
+
this.server?.broadcastMaintenance("maintenance:baseref_fallback", event);
|
|
12661
|
+
this.emit("maintenance:baseref_fallback", event);
|
|
12662
|
+
}
|
|
12594
12663
|
}
|
|
12595
|
-
|
|
12664
|
+
);
|
|
12596
12665
|
this.hooks = new WorkspaceHooks(config.hooks);
|
|
12597
12666
|
this.renderer = new PromptRenderer();
|
|
12598
12667
|
this.overrideBackend = overrides?.backend ?? null;
|
|
@@ -14754,6 +14823,7 @@ function buildArchiveHooks(opts) {
|
|
|
14754
14823
|
createEmptyState,
|
|
14755
14824
|
crossFieldRoutingIssues,
|
|
14756
14825
|
defaultFetchModels,
|
|
14826
|
+
deriveSeedPaths,
|
|
14757
14827
|
detectScopeTier,
|
|
14758
14828
|
discoverSkillCatalog,
|
|
14759
14829
|
discoverSkillCatalogNames,
|
package/dist/index.mjs
CHANGED
|
@@ -2348,7 +2348,7 @@ import * as path8 from "path";
|
|
|
2348
2348
|
import { execFile as execFile2 } from "child_process";
|
|
2349
2349
|
import { promisify as promisify2 } from "util";
|
|
2350
2350
|
import { Ok as Ok6, Err as Err4 } from "@harness-engineering/types";
|
|
2351
|
-
var WorkspaceManager = class {
|
|
2351
|
+
var WorkspaceManager = class _WorkspaceManager {
|
|
2352
2352
|
config;
|
|
2353
2353
|
/** Absolute path to the git repository root (resolved lazily). */
|
|
2354
2354
|
repoRoot = null;
|
|
@@ -2419,6 +2419,7 @@ var WorkspaceManager = class {
|
|
|
2419
2419
|
await this.tryFetch(repoRoot);
|
|
2420
2420
|
const baseRef = await this.resolveBaseRef(repoRoot);
|
|
2421
2421
|
await this.git(["worktree", "add", "--detach", workspacePath, baseRef], repoRoot);
|
|
2422
|
+
await this.seedWorkspace(workspacePath, repoRoot);
|
|
2422
2423
|
return Ok6(workspacePath);
|
|
2423
2424
|
} catch (error) {
|
|
2424
2425
|
return Err4(error instanceof Error ? error : new Error(String(error)));
|
|
@@ -2435,6 +2436,44 @@ var WorkspaceManager = class {
|
|
|
2435
2436
|
} catch {
|
|
2436
2437
|
}
|
|
2437
2438
|
}
|
|
2439
|
+
/**
|
|
2440
|
+
* Default paths seeded into a fresh worktree when {@link WorkspaceConfig.seedPaths}
|
|
2441
|
+
* is unset — the artifacts produced by the brainstorm → orchestrator handoff.
|
|
2442
|
+
*/
|
|
2443
|
+
static DEFAULT_SEED_PATHS = [".harness/proposals", "docs/roadmap.md"];
|
|
2444
|
+
/**
|
|
2445
|
+
* Copies the configured seed paths from the root working tree into a
|
|
2446
|
+
* freshly-created worktree, overlaying the committed checkout.
|
|
2447
|
+
*
|
|
2448
|
+
* A new worktree is based on a committed remote ref, so it does not contain
|
|
2449
|
+
* uncommitted artifacts that exist only in the root working tree (a
|
|
2450
|
+
* just-written proposal under `.harness/proposals/`, a promoted row in
|
|
2451
|
+
* `docs/roadmap.md`). Seeding carries them over so a dispatched agent sees
|
|
2452
|
+
* the same state the orchestrator dispatched from.
|
|
2453
|
+
*
|
|
2454
|
+
* Best-effort by design: a missing source is skipped, and a copy failure is
|
|
2455
|
+
* swallowed — neither must ever block dispatch.
|
|
2456
|
+
*/
|
|
2457
|
+
async seedWorkspace(workspacePath, repoRoot) {
|
|
2458
|
+
const seedPaths = this.config.seedPaths ?? _WorkspaceManager.DEFAULT_SEED_PATHS;
|
|
2459
|
+
for (const entry of seedPaths) {
|
|
2460
|
+
const rel = path8.isAbsolute(entry) ? path8.relative(repoRoot, entry).replaceAll("\\", "/") : entry;
|
|
2461
|
+
if (!rel || rel === ".." || rel.startsWith("../") || path8.isAbsolute(rel)) {
|
|
2462
|
+
continue;
|
|
2463
|
+
}
|
|
2464
|
+
const src = path8.join(repoRoot, rel);
|
|
2465
|
+
try {
|
|
2466
|
+
await fs9.access(src);
|
|
2467
|
+
} catch {
|
|
2468
|
+
continue;
|
|
2469
|
+
}
|
|
2470
|
+
const dest = path8.join(workspacePath, rel);
|
|
2471
|
+
try {
|
|
2472
|
+
await fs9.cp(src, dest, { recursive: true, force: true });
|
|
2473
|
+
} catch {
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2438
2477
|
/**
|
|
2439
2478
|
* Resolves the ref that new worktrees should be based on.
|
|
2440
2479
|
*
|
|
@@ -4653,7 +4692,7 @@ var OpenAIBackend = class {
|
|
|
4653
4692
|
};
|
|
4654
4693
|
|
|
4655
4694
|
// src/agent/backends/gemini.ts
|
|
4656
|
-
import {
|
|
4695
|
+
import { GoogleGenAI } from "@google/genai";
|
|
4657
4696
|
import {
|
|
4658
4697
|
Ok as Ok13,
|
|
4659
4698
|
Err as Err10
|
|
@@ -4694,16 +4733,21 @@ var GeminiBackend = class {
|
|
|
4694
4733
|
let cacheCreationTokens = 0;
|
|
4695
4734
|
let cacheReadTokens = 0;
|
|
4696
4735
|
try {
|
|
4697
|
-
const genAI = new
|
|
4698
|
-
const
|
|
4736
|
+
const genAI = new GoogleGenAI({ apiKey: this.config.apiKey });
|
|
4737
|
+
const response = await genAI.models.generateContentStream({
|
|
4699
4738
|
model: this.config.model,
|
|
4739
|
+
contents: params.prompt,
|
|
4700
4740
|
...geminiSession.systemPrompt !== void 0 && {
|
|
4701
|
-
systemInstruction: geminiSession.systemPrompt
|
|
4741
|
+
config: { systemInstruction: geminiSession.systemPrompt }
|
|
4702
4742
|
}
|
|
4703
4743
|
});
|
|
4704
|
-
const
|
|
4705
|
-
|
|
4706
|
-
|
|
4744
|
+
for await (const chunk of response) {
|
|
4745
|
+
let text;
|
|
4746
|
+
try {
|
|
4747
|
+
text = chunk.text;
|
|
4748
|
+
} catch {
|
|
4749
|
+
text = void 0;
|
|
4750
|
+
}
|
|
4707
4751
|
if (text) {
|
|
4708
4752
|
const event = {
|
|
4709
4753
|
type: "text",
|
|
@@ -4733,7 +4777,13 @@ var GeminiBackend = class {
|
|
|
4733
4777
|
return {
|
|
4734
4778
|
success: false,
|
|
4735
4779
|
sessionId: session.sessionId,
|
|
4736
|
-
usage: {
|
|
4780
|
+
usage: {
|
|
4781
|
+
inputTokens,
|
|
4782
|
+
outputTokens,
|
|
4783
|
+
totalTokens,
|
|
4784
|
+
cacheCreationTokens,
|
|
4785
|
+
cacheReadTokens
|
|
4786
|
+
},
|
|
4737
4787
|
error: errorMessage
|
|
4738
4788
|
};
|
|
4739
4789
|
}
|
|
@@ -4760,9 +4810,14 @@ var GeminiBackend = class {
|
|
|
4760
4810
|
return Ok13(void 0);
|
|
4761
4811
|
}
|
|
4762
4812
|
async healthCheck() {
|
|
4813
|
+
if (!this.config.apiKey) {
|
|
4814
|
+
return Err10({
|
|
4815
|
+
category: "agent_not_found",
|
|
4816
|
+
message: "GEMINI_API_KEY is not set"
|
|
4817
|
+
});
|
|
4818
|
+
}
|
|
4763
4819
|
try {
|
|
4764
|
-
|
|
4765
|
-
genAI.getGenerativeModel({ model: this.config.model });
|
|
4820
|
+
new GoogleGenAI({ apiKey: this.config.apiKey });
|
|
4766
4821
|
return Ok13(void 0);
|
|
4767
4822
|
} catch (err) {
|
|
4768
4823
|
return Err10({
|
|
@@ -10722,7 +10777,7 @@ var StructuredLogger = class {
|
|
|
10722
10777
|
|
|
10723
10778
|
// src/workspace/config-scanner.ts
|
|
10724
10779
|
import { existsSync as existsSync6, readFileSync as readFileSync6 } from "fs";
|
|
10725
|
-
import { join as join15, relative } from "path";
|
|
10780
|
+
import { join as join15, relative as relative2 } from "path";
|
|
10726
10781
|
import {
|
|
10727
10782
|
scanForInjection,
|
|
10728
10783
|
SecurityScanner,
|
|
@@ -10759,7 +10814,7 @@ async function scanSingleFile(filePath, targetDir, scanner) {
|
|
|
10759
10814
|
findings.push(...mapSecurityFindings(secFindings, findings));
|
|
10760
10815
|
const adjusted = adjustFindingSeverity(findings);
|
|
10761
10816
|
return {
|
|
10762
|
-
file:
|
|
10817
|
+
file: relative2(targetDir, filePath).replaceAll("\\", "/"),
|
|
10763
10818
|
findings: adjusted,
|
|
10764
10819
|
overallSeverity: computeOverallSeverity(adjusted)
|
|
10765
10820
|
};
|
|
@@ -12395,6 +12450,10 @@ function reportCycle(path24, next, errors, reported) {
|
|
|
12395
12450
|
}
|
|
12396
12451
|
|
|
12397
12452
|
// src/orchestrator.ts
|
|
12453
|
+
function deriveSeedPaths(config) {
|
|
12454
|
+
const roadmapPath = config.tracker.kind === "roadmap" && config.tracker.filePath ? config.tracker.filePath : "docs/roadmap.md";
|
|
12455
|
+
return [".harness/proposals", roadmapPath];
|
|
12456
|
+
}
|
|
12398
12457
|
var Orchestrator = class extends EventEmitter {
|
|
12399
12458
|
state;
|
|
12400
12459
|
config;
|
|
@@ -12558,12 +12617,21 @@ var Orchestrator = class extends EventEmitter {
|
|
|
12558
12617
|
);
|
|
12559
12618
|
}
|
|
12560
12619
|
this.tracker = overrides?.tracker || this.createTracker();
|
|
12561
|
-
this.workspace = new WorkspaceManager(
|
|
12562
|
-
|
|
12563
|
-
|
|
12564
|
-
|
|
12620
|
+
this.workspace = new WorkspaceManager(
|
|
12621
|
+
{
|
|
12622
|
+
...config.workspace,
|
|
12623
|
+
// Seed the brainstorm handoff artifacts into each fresh worktree. An
|
|
12624
|
+
// explicit `seedPaths` wins; otherwise derive from the tracker config
|
|
12625
|
+
// so a non-default roadmap location is still carried over.
|
|
12626
|
+
seedPaths: config.workspace.seedPaths ?? deriveSeedPaths(config)
|
|
12627
|
+
},
|
|
12628
|
+
{
|
|
12629
|
+
emitEvent: (event) => {
|
|
12630
|
+
this.server?.broadcastMaintenance("maintenance:baseref_fallback", event);
|
|
12631
|
+
this.emit("maintenance:baseref_fallback", event);
|
|
12632
|
+
}
|
|
12565
12633
|
}
|
|
12566
|
-
|
|
12634
|
+
);
|
|
12567
12635
|
this.hooks = new WorkspaceHooks(config.hooks);
|
|
12568
12636
|
this.renderer = new PromptRenderer();
|
|
12569
12637
|
this.overrideBackend = overrides?.backend ?? null;
|
|
@@ -14726,6 +14794,7 @@ export {
|
|
|
14726
14794
|
createEmptyState,
|
|
14727
14795
|
crossFieldRoutingIssues,
|
|
14728
14796
|
defaultFetchModels,
|
|
14797
|
+
deriveSeedPaths,
|
|
14729
14798
|
detectScopeTier,
|
|
14730
14799
|
discoverSkillCatalog,
|
|
14731
14800
|
discoverSkillCatalogNames,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@harness-engineering/orchestrator",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "Orchestrator daemon for dispatching coding agents to issues",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@anthropic-ai/sdk": "^0.95.1",
|
|
40
40
|
"@earendil-works/pi-coding-agent": "^0.74.1",
|
|
41
|
-
"@google/
|
|
41
|
+
"@google/genai": "^2.0.4",
|
|
42
42
|
"bcryptjs": "^2.4.3",
|
|
43
43
|
"better-sqlite3": "^12.10.0",
|
|
44
44
|
"ink": "^4.4.1",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"ws": "^8.21.0",
|
|
49
49
|
"yaml": "^2.8.3",
|
|
50
50
|
"zod": "^3.25.76",
|
|
51
|
-
"@harness-engineering/core": "0.
|
|
52
|
-
"@harness-engineering/graph": "0.11.
|
|
53
|
-
"@harness-engineering/
|
|
54
|
-
"@harness-engineering/
|
|
51
|
+
"@harness-engineering/core": "0.30.1",
|
|
52
|
+
"@harness-engineering/graph": "0.11.1",
|
|
53
|
+
"@harness-engineering/types": "0.16.1",
|
|
54
|
+
"@harness-engineering/intelligence": "0.3.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@asteasolutions/zod-to-openapi": "^7.3.0",
|