@hilbras/omninode 0.8.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
@@ -291,11 +291,15 @@ interface PipelineStepRun {
291
291
  status: TaskStatus;
292
292
  /** Tasks created for this step (research fans out to several). */
293
293
  taskIds?: string[];
294
+ /** Set on plan steps that produced a stored plan (§18). */
295
+ planId?: string;
294
296
  error?: string;
295
297
  }
296
298
  interface PipelineRun {
297
299
  id: string;
298
300
  pipelineId: string;
301
+ /** The objective this run is executing (persisted for retries). */
302
+ objective?: string;
299
303
  status: PipelineRunStatus;
300
304
  startedAt?: string;
301
305
  finishedAt?: string;
@@ -304,6 +308,40 @@ interface PipelineRun {
304
308
  reports?: Report[];
305
309
  /** Set when the report system generated a combined report for this run. */
306
310
  combinedReportId?: string;
311
+ /** Set when a plan step produced an implementation plan (§18). */
312
+ planId?: string;
313
+ /** Outcome summary of the final executed step (§28 — Result). */
314
+ resultSummary?: string;
315
+ }
316
+
317
+ /** Plan types: the final implementation plan produced by the planner layer (§18). */
318
+ interface PlanStep {
319
+ id: string;
320
+ title: string;
321
+ description?: string;
322
+ order: number;
323
+ /** Files/modules the step touches, if stated. */
324
+ targets?: string[];
325
+ acceptanceCriteria?: string[];
326
+ /** Plan-internal dependencies between steps. */
327
+ dependsOn?: string[];
328
+ /** Finding ids that motivated this step (traceability to reports). */
329
+ sourceFindings?: string[];
330
+ }
331
+ interface Plan {
332
+ id: string;
333
+ objective: string;
334
+ summary: string;
335
+ steps: PlanStep[];
336
+ risks?: string[];
337
+ notes?: string[];
338
+ /** What produced the plan, e.g. "model:my-gateway:chatgpt" or "heuristic". */
339
+ generatedBy: string;
340
+ model?: string;
341
+ taskId?: string;
342
+ pipelineRunId?: string;
343
+ createdAt: string;
344
+ metadata?: Record<string, unknown>;
307
345
  }
308
346
 
309
347
  /** Agent ↔ OmniNode communication protocol (§21). */
@@ -452,7 +490,7 @@ interface IChatProvider extends IProvider {
452
490
  }
453
491
 
454
492
  /** Typed error hierarchy shared across the whole codebase (§4.1 — error model). */
455
- type OmniNodeErrorCode = "CONFIG_NOT_FOUND" | "CONFIG_INVALID" | "PROVIDER_NOT_FOUND" | "PROVIDER_UNAVAILABLE" | "PROVIDER_AUTH_FAILED" | "MODEL_NOT_FOUND" | "AGENT_NOT_FOUND" | "AGENT_FAILED" | "AGENT_TIMEOUT" | "TASK_INVALID" | "TASK_NOT_FOUND" | "TASK_FAILED" | "PIPELINE_NOT_FOUND" | "PIPELINE_INVALID" | "PIPELINE_FAILED" | "PROTOCOL_VIOLATION" | "MEMORY_UNAVAILABLE" | "REPORT_NOT_FOUND" | "NOT_IMPLEMENTED" | "CLI_USAGE" | "INTERNAL";
493
+ type OmniNodeErrorCode = "CONFIG_NOT_FOUND" | "CONFIG_INVALID" | "PROVIDER_NOT_FOUND" | "PROVIDER_UNAVAILABLE" | "PROVIDER_AUTH_FAILED" | "MODEL_NOT_FOUND" | "AGENT_NOT_FOUND" | "AGENT_FAILED" | "AGENT_TIMEOUT" | "TASK_INVALID" | "TASK_NOT_FOUND" | "TASK_FAILED" | "PIPELINE_NOT_FOUND" | "PIPELINE_INVALID" | "PIPELINE_FAILED" | "PLANNER_FAILED" | "PLAN_INVALID" | "PROTOCOL_VIOLATION" | "MEMORY_UNAVAILABLE" | "REPORT_NOT_FOUND" | "NOT_IMPLEMENTED" | "CLI_USAGE" | "INTERNAL";
456
494
  interface OmniNodeErrorOptions {
457
495
  cause?: unknown;
458
496
  details?: Record<string, unknown>;
@@ -480,6 +518,9 @@ declare class PipelineError extends OmniNodeError {
480
518
  declare class ProtocolError extends OmniNodeError {
481
519
  constructor(message: string, options?: OmniNodeErrorOptions);
482
520
  }
521
+ declare class PlannerError extends OmniNodeError {
522
+ constructor(code: "PLANNER_FAILED" | "PLAN_INVALID", message: string, options?: OmniNodeErrorOptions);
523
+ }
483
524
  declare class MemoryError extends OmniNodeError {
484
525
  constructor(message: string, options?: OmniNodeErrorOptions);
485
526
  }
@@ -702,6 +743,19 @@ declare const pipelineConfigSchema: z.ZodObject<{
702
743
  name?: string | undefined;
703
744
  objective?: string | undefined;
704
745
  }>;
746
+ declare const plannerConfigSchema: z.ZodObject<{
747
+ kind: z.ZodDefault<z.ZodEnum<["model", "heuristic"]>>;
748
+ model: z.ZodOptional<z.ZodString>;
749
+ instruction: z.ZodOptional<z.ZodString>;
750
+ }, "strict", z.ZodTypeAny, {
751
+ kind: "model" | "heuristic";
752
+ model?: string | undefined;
753
+ instruction?: string | undefined;
754
+ }, {
755
+ kind?: "model" | "heuristic" | undefined;
756
+ model?: string | undefined;
757
+ instruction?: string | undefined;
758
+ }>;
705
759
  declare const projectConfigSchema: z.ZodObject<{
706
760
  name: z.ZodString;
707
761
  providers: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -853,6 +907,19 @@ declare const projectConfigSchema: z.ZodObject<{
853
907
  name?: string | undefined;
854
908
  objective?: string | undefined;
855
909
  }>, "many">>;
910
+ planner: z.ZodOptional<z.ZodObject<{
911
+ kind: z.ZodDefault<z.ZodEnum<["model", "heuristic"]>>;
912
+ model: z.ZodOptional<z.ZodString>;
913
+ instruction: z.ZodOptional<z.ZodString>;
914
+ }, "strict", z.ZodTypeAny, {
915
+ kind: "model" | "heuristic";
916
+ model?: string | undefined;
917
+ instruction?: string | undefined;
918
+ }, {
919
+ kind?: "model" | "heuristic" | undefined;
920
+ model?: string | undefined;
921
+ instruction?: string | undefined;
922
+ }>>;
856
923
  memory: z.ZodOptional<z.ZodObject<{
857
924
  provider: z.ZodDefault<z.ZodString>;
858
925
  base_url: z.ZodOptional<z.ZodString>;
@@ -914,6 +981,11 @@ declare const projectConfigSchema: z.ZodObject<{
914
981
  name?: string | undefined;
915
982
  objective?: string | undefined;
916
983
  }[];
984
+ planner?: {
985
+ kind: "model" | "heuristic";
986
+ model?: string | undefined;
987
+ instruction?: string | undefined;
988
+ } | undefined;
917
989
  memory?: {
918
990
  provider: string;
919
991
  base_url?: string | undefined;
@@ -967,6 +1039,11 @@ declare const projectConfigSchema: z.ZodObject<{
967
1039
  name?: string | undefined;
968
1040
  objective?: string | undefined;
969
1041
  }[] | undefined;
1042
+ planner?: {
1043
+ kind?: "model" | "heuristic" | undefined;
1044
+ model?: string | undefined;
1045
+ instruction?: string | undefined;
1046
+ } | undefined;
970
1047
  memory?: {
971
1048
  base_url?: string | undefined;
972
1049
  api_key_env_var?: string | undefined;
@@ -1125,6 +1202,19 @@ declare const appConfigSchema: z.ZodObject<{
1125
1202
  name?: string | undefined;
1126
1203
  objective?: string | undefined;
1127
1204
  }>, "many">>;
1205
+ planner: z.ZodOptional<z.ZodObject<{
1206
+ kind: z.ZodDefault<z.ZodEnum<["model", "heuristic"]>>;
1207
+ model: z.ZodOptional<z.ZodString>;
1208
+ instruction: z.ZodOptional<z.ZodString>;
1209
+ }, "strict", z.ZodTypeAny, {
1210
+ kind: "model" | "heuristic";
1211
+ model?: string | undefined;
1212
+ instruction?: string | undefined;
1213
+ }, {
1214
+ kind?: "model" | "heuristic" | undefined;
1215
+ model?: string | undefined;
1216
+ instruction?: string | undefined;
1217
+ }>>;
1128
1218
  memory: z.ZodOptional<z.ZodObject<{
1129
1219
  provider: z.ZodDefault<z.ZodString>;
1130
1220
  base_url: z.ZodOptional<z.ZodString>;
@@ -1186,6 +1276,11 @@ declare const appConfigSchema: z.ZodObject<{
1186
1276
  name?: string | undefined;
1187
1277
  objective?: string | undefined;
1188
1278
  }[];
1279
+ planner?: {
1280
+ kind: "model" | "heuristic";
1281
+ model?: string | undefined;
1282
+ instruction?: string | undefined;
1283
+ } | undefined;
1189
1284
  memory?: {
1190
1285
  provider: string;
1191
1286
  base_url?: string | undefined;
@@ -1239,6 +1334,11 @@ declare const appConfigSchema: z.ZodObject<{
1239
1334
  name?: string | undefined;
1240
1335
  objective?: string | undefined;
1241
1336
  }[] | undefined;
1337
+ planner?: {
1338
+ kind?: "model" | "heuristic" | undefined;
1339
+ model?: string | undefined;
1340
+ instruction?: string | undefined;
1341
+ } | undefined;
1242
1342
  memory?: {
1243
1343
  base_url?: string | undefined;
1244
1344
  api_key_env_var?: string | undefined;
@@ -1301,6 +1401,11 @@ declare const appConfigSchema: z.ZodObject<{
1301
1401
  name?: string | undefined;
1302
1402
  objective?: string | undefined;
1303
1403
  }[];
1404
+ planner?: {
1405
+ kind: "model" | "heuristic";
1406
+ model?: string | undefined;
1407
+ instruction?: string | undefined;
1408
+ } | undefined;
1304
1409
  memory?: {
1305
1410
  provider: string;
1306
1411
  base_url?: string | undefined;
@@ -1359,6 +1464,11 @@ declare const appConfigSchema: z.ZodObject<{
1359
1464
  name?: string | undefined;
1360
1465
  objective?: string | undefined;
1361
1466
  }[] | undefined;
1467
+ planner?: {
1468
+ kind?: "model" | "heuristic" | undefined;
1469
+ model?: string | undefined;
1470
+ instruction?: string | undefined;
1471
+ } | undefined;
1362
1472
  memory?: {
1363
1473
  base_url?: string | undefined;
1364
1474
  api_key_env_var?: string | undefined;
@@ -1374,6 +1484,7 @@ type AgentConfigYaml = z.infer<typeof agentConfigSchema>;
1374
1484
  type RoleConfigYaml = z.infer<typeof roleConfigSchema>;
1375
1485
  type PipelineConfigYaml = z.infer<typeof pipelineConfigSchema>;
1376
1486
  type PipelineStepConfigYaml = z.infer<typeof pipelineStepConfigSchema>;
1487
+ type PlannerConfigYaml = z.infer<typeof plannerConfigSchema>;
1377
1488
  type ProjectConfigYaml = z.infer<typeof projectConfigSchema>;
1378
1489
  type AppConfigYaml = z.infer<typeof appConfigSchema>;
1379
1490
 
@@ -1384,6 +1495,11 @@ interface AppConfig {
1384
1495
  agents: AgentConfig[];
1385
1496
  roles: RoleDefinition[];
1386
1497
  pipelines: PipelineDefinition[];
1498
+ planner?: {
1499
+ kind: "model" | "heuristic";
1500
+ model?: string;
1501
+ instruction?: string;
1502
+ };
1387
1503
  memory?: {
1388
1504
  provider: string;
1389
1505
  baseUrl?: string;
@@ -1646,6 +1762,8 @@ declare class TaskEngine {
1646
1762
  /** Runs the task through its assigned agent and records the result. */
1647
1763
  run(id: string): Promise<Task>;
1648
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>;
1649
1767
  get(id: string): Promise<Task | undefined>;
1650
1768
  list(filter?: TaskStoreFilter): Promise<Task[]>;
1651
1769
  private mustGet;
@@ -1730,6 +1848,35 @@ interface AggregateOptions {
1730
1848
  declare function aggregateReports(reports: Report[], options?: AggregateOptions): CombinedReport;
1731
1849
  declare function similar(a: string, b: string, threshold: number): boolean;
1732
1850
 
1851
+ /** Planner interface and request contract (§18). The planner is replaceable. */
1852
+
1853
+ interface PlanRequest {
1854
+ objective: string;
1855
+ /** Raw reports (already normalized) the plan is based on. */
1856
+ reports: Report[];
1857
+ /** Combined research context from upstream pipeline steps, if available. */
1858
+ context?: string;
1859
+ role?: RoleDefinition;
1860
+ memory?: MemoryEntry[];
1861
+ project?: string;
1862
+ taskId?: string;
1863
+ pipelineRunId?: string;
1864
+ }
1865
+ interface IPlanner {
1866
+ readonly name: string;
1867
+ plan(request: PlanRequest): Promise<Plan>;
1868
+ }
1869
+
1870
+ interface PlanFilter {
1871
+ pipelineRunId?: string;
1872
+ taskId?: string;
1873
+ }
1874
+ interface PlanStore {
1875
+ save(plan: Plan): Promise<void>;
1876
+ get(id: string): Promise<Plan | undefined>;
1877
+ list(filter?: PlanFilter): Promise<Plan[]>;
1878
+ }
1879
+
1733
1880
  interface PipelineRunFilter {
1734
1881
  pipelineId?: string;
1735
1882
  status?: PipelineRunStatus;
@@ -1759,6 +1906,10 @@ interface PipelineEngineOptions {
1759
1906
  providers: AppConfig["project"]["providers"];
1760
1907
  store: PipelineRunStore;
1761
1908
  chat?: ChatFn;
1909
+ /** Default planner used by plan steps without their own model (§18). */
1910
+ planner?: IPlanner;
1911
+ /** When present, plans produced by plan steps are persisted. */
1912
+ plans?: PlanStore;
1762
1913
  /** When present, finished runs have their reports collected, stored and combined (§16–§17). */
1763
1914
  reports?: ReportService;
1764
1915
  log?: Logger;
@@ -1797,10 +1948,8 @@ declare class PipelineEngine {
1797
1948
  /** Default chat function: resolves "provider:model" against the configured providers. */
1798
1949
  declare function createDefaultChatFn(providers: AppConfig["project"]["providers"]): ChatFn;
1799
1950
 
1800
- /** Assembles a PipelineEngine from the project configuration (local-first defaults). */
1801
-
1802
1951
  declare function buildPipelineEngine(config: AppConfig, log?: Logger): PipelineEngine;
1803
1952
 
1804
- declare const OMNINODE_VERSION = "0.8.0";
1953
+ declare const OMNINODE_VERSION = "0.10.0";
1805
1954
 
1806
- 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, 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, projectConfigSchema, providerConfigSchema, registryKey, requestJson, resolveApiKey, roleConfigSchema, similar };
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 };