@hilbras/omninode 0.9.0 → 0.10.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.ts CHANGED
@@ -298,6 +298,8 @@ interface PipelineStepRun {
298
298
  interface PipelineRun {
299
299
  id: string;
300
300
  pipelineId: string;
301
+ /** The objective this run is executing (persisted for retries). */
302
+ objective?: string;
301
303
  status: PipelineRunStatus;
302
304
  startedAt?: string;
303
305
  finishedAt?: string;
@@ -308,6 +310,8 @@ interface PipelineRun {
308
310
  combinedReportId?: string;
309
311
  /** Set when a plan step produced an implementation plan (§18). */
310
312
  planId?: string;
313
+ /** Outcome summary of the final executed step (§28 — Result). */
314
+ resultSummary?: string;
311
315
  }
312
316
 
313
317
  /** Plan types: the final implementation plan produced by the planner layer (§18). */
@@ -1758,6 +1762,8 @@ declare class TaskEngine {
1758
1762
  /** Runs the task through its assigned agent and records the result. */
1759
1763
  run(id: string): Promise<Task>;
1760
1764
  cancel(id: string): Promise<Task>;
1765
+ /** Error recovery (§27 Phase 9): reset a failed/cancelled task so it can run again. */
1766
+ retry(id: string): Promise<Task>;
1761
1767
  get(id: string): Promise<Task | undefined>;
1762
1768
  list(filter?: TaskStoreFilter): Promise<Task[]>;
1763
1769
  private mustGet;
@@ -1944,6 +1950,6 @@ declare function createDefaultChatFn(providers: AppConfig["project"]["providers"
1944
1950
 
1945
1951
  declare function buildPipelineEngine(config: AppConfig, log?: Logger): PipelineEngine;
1946
1952
 
1947
- declare const OMNINODE_VERSION = "0.9.0";
1953
+ declare const OMNINODE_VERSION = "0.10.0";
1948
1954
 
1949
1955
  export { type AgentConfig, type AgentConfigYaml, AgentError, type AgentInfo, type AgentInputMode, type AgentIntegrationType, AgentRegistry, type AgentStatus, type AgentTaskInput, type AgentTaskOutput, type AgentToNodeMessage, type AggregateOptions, type AggregatedFinding, type AggregatedRecommendation, type AppConfig, type AppConfigYaml, type ChatFn, type ChatMessage, type ChatRequest, type ChatResponse, type ChatRole, type ChatUsage, type CombinedMeta, type CombinedReport, type CombinedReportFilter, type Confidence, ConfigError, ConsoleLogSink, type CreateTaskInput, type DiscoveryResult, type EnvelopeMeta, type ExtractionMeta, FilePipelineRunStore, FileReportStore, FileTaskStore, type Finding, type FindingSeverity, type FindingSource, type HttpRequestOptions, type HttpResponse, type IAgent, type IChatProvider, type IMemoryProvider, type IProvider, type LoadConfigOptions, LocalMemoryProvider, type LogLevel, type LogSink, Logger, type LoggerOptions, type MemoryContextQuery, type MemoryEntry, MemoryError, type MemoryProviderConfig, type MemoryQuery, type MemoryScope, MemoryService, type MessageEnvelope, type ModelCapabilities, type ModelFilter, type ModelInfo, ModelRegistry, type ModelStatus, type NodeToAgentMessage, OMNINODE_VERSION, OPENAI_COMPATIBLE_TYPES, type OmniHilbrasConnectionResult, OmniHilbrasProvider, OmniNodeError, type OmniNodeErrorCode, type OmniNodeErrorOptions, OpenAICompatibleProvider, type PipelineConfigYaml, type PipelineDefinition, PipelineEngine, type PipelineEngineOptions, PipelineError, type PipelineRun, type PipelineRunFilter, type PipelineRunStatus, type PipelineRunStore, type PipelineStep, type PipelineStepCondition, type PipelineStepConfigYaml, type PipelineStepKind, type PipelineStepRun, type Plan, type PlanStep, type PlannerConfigYaml, PlannerError, ProcessAgent, type Project, type ProjectConfigYaml, ProtocolError, type ProviderConfig, type ProviderConfigYaml, ProviderError, type ProviderHealth, type ProviderStatus, type ProviderType, type RememberaConfig, RememberaMemoryProvider, type Report, type ReportFilter, ReportService, type ReportStore, type RoleConfigYaml, type RoleDefinition, RoleRegistry, type RunPipelineOptions, type Task, type TaskContext, TaskEngine, type TaskEngineOptions, TaskError, type TaskResult, type TaskStatus, type TaskStore, type TaskStoreFilter, type WritableLike, agentConfigSchema, aggregateReports, appConfigSchema, authHeaders, buildAgentRegistry, buildPipelineEngine, buildRoleRegistry, composeTaskText, createAgent, createDefaultChatFn, createMemoryProvider, createProvider, createTaskEngine, defaultProjectConfigYaml, expandEnvRefs, extractReportFromText, findConfigFile, isOmniNodeError, keywords, loadConfig, logger, pipelineConfigSchema, pipelineStepConfigSchema, plannerConfigSchema, projectConfigSchema, providerConfigSchema, registryKey, requestJson, resolveApiKey, roleConfigSchema, similar };
package/dist/index.js CHANGED
@@ -1160,6 +1160,25 @@ var TaskEngine = class {
1160
1160
  }
1161
1161
  return this.transition(task, "cancelled");
1162
1162
  }
1163
+ /** Error recovery (§27 Phase 9): reset a failed/cancelled task so it can run again. */
1164
+ async retry(id) {
1165
+ const task = await this.mustGet(id);
1166
+ if (task.status !== "failed" && task.status !== "cancelled") {
1167
+ throw new TaskError(
1168
+ "TASK_INVALID",
1169
+ `Only failed or cancelled tasks can be retried \u2014 task ${id} is "${task.status}".`
1170
+ );
1171
+ }
1172
+ const { result: _discarded, ...rest } = task;
1173
+ const reset = {
1174
+ ...rest,
1175
+ status: "created",
1176
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
1177
+ };
1178
+ await this.options.store.save(reset);
1179
+ this.log.info(`Task ${id} reset for retry.`);
1180
+ return reset;
1181
+ }
1163
1182
  async get(id) {
1164
1183
  return this.options.store.get(id);
1165
1184
  }
@@ -1836,6 +1855,7 @@ var PipelineEngine = class {
1836
1855
  const run = {
1837
1856
  id: `run-${Date.now().toString(36)}-${randomBytes4(3).toString("hex")}`,
1838
1857
  pipelineId: def.id,
1858
+ objective,
1839
1859
  status: "running",
1840
1860
  startedAt: now,
1841
1861
  stepRuns: []
@@ -1895,9 +1915,19 @@ ${contribution}`);
1895
1915
  const failed = [...outcomes.values()].some((o) => o.status === "failed");
1896
1916
  const finalStatus = failed ? "failed" : "completed";
1897
1917
  const planId = [...outcomes.values()].find((o) => o.planId !== void 0)?.planId;
1918
+ let resultSummary;
1919
+ for (let i = def.steps.length - 1; i >= 0; i -= 1) {
1920
+ const step = def.steps[i];
1921
+ const outcome = outcomes.get(step.id);
1922
+ if (outcome?.status !== "completed" || outcome.taskIds.length === 0) continue;
1923
+ const stepTasks = (await Promise.all(outcome.taskIds.map((id) => this.options.tasks.get(id)))).filter((task) => task !== void 0);
1924
+ const summaries = stepTasks.map((task) => task.result?.summary).filter((summary) => summary !== void 0);
1925
+ if (summaries.length > 0) resultSummary = summaries.join("\n");
1926
+ break;
1927
+ }
1898
1928
  let combinedReportId;
1899
1929
  if (this.options.reports) {
1900
- const taskIds = [...outcomes.values()].flatMap((o) => o.taskIds);
1930
+ const taskIds = def.steps.filter((step) => step.kind === "research" || step.kind === "analyze").flatMap((step) => outcomes.get(step.id)?.taskIds ?? []);
1901
1931
  const tasks = (await Promise.all(taskIds.map((id) => this.options.tasks.get(id)))).filter((task) => task !== void 0);
1902
1932
  const collected = await this.options.reports.collectFromTasks(tasks);
1903
1933
  await this.options.reports.saveReports(collected);
@@ -1917,7 +1947,8 @@ ${contribution}`);
1917
1947
  finishedAt: (/* @__PURE__ */ new Date()).toISOString(),
1918
1948
  ...run.reports !== void 0 && run.reports.length > 0 ? { reports: run.reports } : {},
1919
1949
  ...combinedReportId !== void 0 ? { combinedReportId } : {},
1920
- ...planId !== void 0 ? { planId } : {}
1950
+ ...planId !== void 0 ? { planId } : {},
1951
+ ...resultSummary !== void 0 ? { resultSummary } : {}
1921
1952
  };
1922
1953
  await this.options.store.save(finished);
1923
1954
  this.log.info(`Pipeline ${def.id} finished: ${finalStatus}.`);
@@ -2573,7 +2604,7 @@ function buildPipelineEngine(config, log = logger) {
2573
2604
  }
2574
2605
 
2575
2606
  // src/version.ts
2576
- var OMNINODE_VERSION = "0.9.0";
2607
+ var OMNINODE_VERSION = "0.10.0";
2577
2608
  export {
2578
2609
  AgentError,
2579
2610
  AgentRegistry,