@hilbras/omninode 0.6.0 → 0.8.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
@@ -27,6 +27,43 @@ interface Report {
27
27
  createdAt: string;
28
28
  metadata?: Record<string, unknown>;
29
29
  }
30
+ /** Source attribution for an aggregated finding (§17). */
31
+ interface FindingSource {
32
+ agent: string;
33
+ reportId: string;
34
+ }
35
+ interface AggregatedFinding {
36
+ title: string;
37
+ /** Distinct details contributed across reports. */
38
+ details: string[];
39
+ sources: FindingSource[];
40
+ /** How many reports reported this (or a similar) finding. */
41
+ occurrences: number;
42
+ /** Highest severity seen across merged duplicates. */
43
+ severity?: FindingSeverity;
44
+ evidence: string[];
45
+ }
46
+ interface AggregatedRecommendation {
47
+ text: string;
48
+ sources: FindingSource[];
49
+ occurrences: number;
50
+ }
51
+ /** Combined intelligence produced from several independent reports (§17). */
52
+ interface CombinedReport {
53
+ id: string;
54
+ title: string;
55
+ objective?: string;
56
+ pipelineRunId?: string;
57
+ taskIds: string[];
58
+ summary: string;
59
+ findings: AggregatedFinding[];
60
+ recommendations: AggregatedRecommendation[];
61
+ /** Distinct agent names that contributed. */
62
+ sources: string[];
63
+ reportIds: string[];
64
+ createdAt: string;
65
+ metadata?: Record<string, unknown>;
66
+ }
30
67
 
31
68
  /** Role system: what an AI is supposed to do, independent of any provider (§11). */
32
69
  interface RoleDefinition {
@@ -201,6 +238,8 @@ interface TaskResult {
201
238
  reportId?: string;
202
239
  /** Structured reports produced by protocol-mode agents (Phase 6 builds on this). */
203
240
  reports?: Report[];
241
+ /** Truncated verbatim agent output, kept for report extraction and audit. */
242
+ rawOutput?: string;
204
243
  error?: string;
205
244
  finishedAt?: string;
206
245
  }
@@ -263,6 +302,8 @@ interface PipelineRun {
263
302
  stepRuns: PipelineStepRun[];
264
303
  /** Structured reports gathered across all steps (Phase 6 builds on this). */
265
304
  reports?: Report[];
305
+ /** Set when the report system generated a combined report for this run. */
306
+ combinedReportId?: string;
266
307
  }
267
308
 
268
309
  /** Agent ↔ OmniNode communication protocol (§21). */
@@ -411,7 +452,7 @@ interface IChatProvider extends IProvider {
411
452
  }
412
453
 
413
454
  /** Typed error hierarchy shared across the whole codebase (§4.1 — error model). */
414
- 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" | "NOT_IMPLEMENTED" | "CLI_USAGE" | "INTERNAL";
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";
415
456
  interface OmniNodeErrorOptions {
416
457
  cause?: unknown;
417
458
  details?: Record<string, unknown>;
@@ -813,11 +854,17 @@ declare const projectConfigSchema: z.ZodObject<{
813
854
  objective?: string | undefined;
814
855
  }>, "many">>;
815
856
  memory: z.ZodOptional<z.ZodObject<{
816
- provider: z.ZodString;
857
+ provider: z.ZodDefault<z.ZodString>;
858
+ base_url: z.ZodOptional<z.ZodString>;
859
+ api_key_env_var: z.ZodOptional<z.ZodString>;
817
860
  }, "strict", z.ZodTypeAny, {
818
861
  provider: string;
862
+ base_url?: string | undefined;
863
+ api_key_env_var?: string | undefined;
819
864
  }, {
820
- provider: string;
865
+ base_url?: string | undefined;
866
+ api_key_env_var?: string | undefined;
867
+ provider?: string | undefined;
821
868
  }>>;
822
869
  }, "strict", z.ZodTypeAny, {
823
870
  name: string;
@@ -869,6 +916,8 @@ declare const projectConfigSchema: z.ZodObject<{
869
916
  }[];
870
917
  memory?: {
871
918
  provider: string;
919
+ base_url?: string | undefined;
920
+ api_key_env_var?: string | undefined;
872
921
  } | undefined;
873
922
  }, {
874
923
  name: string;
@@ -919,7 +968,9 @@ declare const projectConfigSchema: z.ZodObject<{
919
968
  objective?: string | undefined;
920
969
  }[] | undefined;
921
970
  memory?: {
922
- provider: string;
971
+ base_url?: string | undefined;
972
+ api_key_env_var?: string | undefined;
973
+ provider?: string | undefined;
923
974
  } | undefined;
924
975
  }>;
925
976
  declare const appConfigSchema: z.ZodObject<{
@@ -1075,11 +1126,17 @@ declare const appConfigSchema: z.ZodObject<{
1075
1126
  objective?: string | undefined;
1076
1127
  }>, "many">>;
1077
1128
  memory: z.ZodOptional<z.ZodObject<{
1078
- provider: z.ZodString;
1129
+ provider: z.ZodDefault<z.ZodString>;
1130
+ base_url: z.ZodOptional<z.ZodString>;
1131
+ api_key_env_var: z.ZodOptional<z.ZodString>;
1079
1132
  }, "strict", z.ZodTypeAny, {
1080
1133
  provider: string;
1134
+ base_url?: string | undefined;
1135
+ api_key_env_var?: string | undefined;
1081
1136
  }, {
1082
- provider: string;
1137
+ base_url?: string | undefined;
1138
+ api_key_env_var?: string | undefined;
1139
+ provider?: string | undefined;
1083
1140
  }>>;
1084
1141
  }, "strict", z.ZodTypeAny, {
1085
1142
  name: string;
@@ -1131,6 +1188,8 @@ declare const appConfigSchema: z.ZodObject<{
1131
1188
  }[];
1132
1189
  memory?: {
1133
1190
  provider: string;
1191
+ base_url?: string | undefined;
1192
+ api_key_env_var?: string | undefined;
1134
1193
  } | undefined;
1135
1194
  }, {
1136
1195
  name: string;
@@ -1181,7 +1240,9 @@ declare const appConfigSchema: z.ZodObject<{
1181
1240
  objective?: string | undefined;
1182
1241
  }[] | undefined;
1183
1242
  memory?: {
1184
- provider: string;
1243
+ base_url?: string | undefined;
1244
+ api_key_env_var?: string | undefined;
1245
+ provider?: string | undefined;
1185
1246
  } | undefined;
1186
1247
  }>;
1187
1248
  logging: z.ZodOptional<z.ZodObject<{
@@ -1242,6 +1303,8 @@ declare const appConfigSchema: z.ZodObject<{
1242
1303
  }[];
1243
1304
  memory?: {
1244
1305
  provider: string;
1306
+ base_url?: string | undefined;
1307
+ api_key_env_var?: string | undefined;
1245
1308
  } | undefined;
1246
1309
  };
1247
1310
  logging?: {
@@ -1297,7 +1360,9 @@ declare const appConfigSchema: z.ZodObject<{
1297
1360
  objective?: string | undefined;
1298
1361
  }[] | undefined;
1299
1362
  memory?: {
1300
- provider: string;
1363
+ base_url?: string | undefined;
1364
+ api_key_env_var?: string | undefined;
1365
+ provider?: string | undefined;
1301
1366
  } | undefined;
1302
1367
  };
1303
1368
  logging?: {
@@ -1321,6 +1386,8 @@ interface AppConfig {
1321
1386
  pipelines: PipelineDefinition[];
1322
1387
  memory?: {
1323
1388
  provider: string;
1389
+ baseUrl?: string;
1390
+ apiKeyEnvVar?: string;
1324
1391
  };
1325
1392
  };
1326
1393
  logging?: {
@@ -1346,8 +1413,14 @@ declare function loadConfig(options?: LoadConfigOptions): AppConfig;
1346
1413
  /** Template written by `omninode init` (§22, §23). */
1347
1414
  declare function defaultProjectConfigYaml(projectName?: string): string;
1348
1415
 
1349
- declare function resolveApiKey(config: ProviderConfig, env?: Record<string, string | undefined>): string | undefined;
1350
- declare function authHeaders(config: ProviderConfig, env?: Record<string, string | undefined>): Record<string, string>;
1416
+ /** Minimal provider identity — any config object with a name and optional env var reference. */
1417
+ interface AuthRef {
1418
+ name: string;
1419
+ apiKeyEnvVar?: string;
1420
+ headers?: Record<string, string>;
1421
+ }
1422
+ declare function resolveApiKey(config: AuthRef, env?: Record<string, string | undefined>): string | undefined;
1423
+ declare function authHeaders(config: AuthRef, env?: Record<string, string | undefined>): Record<string, string>;
1351
1424
 
1352
1425
  interface HttpRequestOptions {
1353
1426
  method?: "GET" | "POST";
@@ -1487,6 +1560,67 @@ declare class FileTaskStore implements TaskStore {
1487
1560
  private write;
1488
1561
  }
1489
1562
 
1563
+ declare function keywords(text: string): Set<string>;
1564
+ declare class LocalMemoryProvider implements IMemoryProvider {
1565
+ readonly name = "local";
1566
+ private readonly filePath;
1567
+ private queue;
1568
+ constructor(directory?: string);
1569
+ query(query: MemoryQuery): Promise<MemoryEntry[]>;
1570
+ write(entry: MemoryEntry): Promise<void>;
1571
+ count(): Promise<number>;
1572
+ private synchronized;
1573
+ private load;
1574
+ private saveAll;
1575
+ }
1576
+
1577
+ interface RememberaConfig {
1578
+ baseUrl: string;
1579
+ apiKeyEnvVar?: string;
1580
+ env?: Record<string, string | undefined>;
1581
+ }
1582
+ declare class RememberaMemoryProvider implements IMemoryProvider {
1583
+ readonly name = "remembera";
1584
+ private readonly baseUrl;
1585
+ private readonly apiKeyEnvVar?;
1586
+ private readonly env;
1587
+ private readonly log;
1588
+ constructor(config: RememberaConfig, log?: Logger);
1589
+ private headers;
1590
+ query(query: MemoryQuery): Promise<MemoryEntry[]>;
1591
+ write(entry: MemoryEntry): Promise<void>;
1592
+ private request;
1593
+ private toEntry;
1594
+ }
1595
+
1596
+ type MemoryProviderConfig = NonNullable<AppConfig["project"]["memory"]>;
1597
+ declare function createMemoryProvider(config?: MemoryProviderConfig): IMemoryProvider;
1598
+
1599
+ /**
1600
+ * Memory service (§19–§20): gathers relevant memory before a task runs and
1601
+ * records outcomes afterwards — the Task → memory → relevant context →
1602
+ * agents → reports → memory loop. Memory failures are best-effort: they log
1603
+ * a warning and never fail a task, because memory is an enhancement, not a
1604
+ * dependency (§2).
1605
+ */
1606
+
1607
+ interface MemoryContextQuery {
1608
+ objective: string;
1609
+ role?: string;
1610
+ project?: string;
1611
+ }
1612
+ declare class MemoryService {
1613
+ private readonly provider;
1614
+ private readonly log;
1615
+ constructor(provider: IMemoryProvider, log?: Logger);
1616
+ get providerRef(): IMemoryProvider;
1617
+ get providerName(): string;
1618
+ /** Relevant context for a task objective; empty string when nothing matches. */
1619
+ gatherContext(query: MemoryContextQuery): Promise<string>;
1620
+ /** Records a finished task's outcome — best-effort. */
1621
+ recordTaskOutcome(task: Task): Promise<void>;
1622
+ }
1623
+
1490
1624
  interface CreateTaskInput {
1491
1625
  objective: string;
1492
1626
  project?: string;
@@ -1498,6 +1632,8 @@ interface TaskEngineOptions {
1498
1632
  agents: AgentRegistry;
1499
1633
  roles: RoleRegistry;
1500
1634
  store: TaskStore;
1635
+ /** When present, tasks gather relevant memory before running and record outcomes after (§20). */
1636
+ memory?: MemoryService;
1501
1637
  log?: Logger;
1502
1638
  }
1503
1639
  declare class TaskEngine {
@@ -1520,6 +1656,80 @@ declare class TaskEngine {
1520
1656
 
1521
1657
  declare function createTaskEngine(config: AppConfig, log?: Logger, directory?: string): TaskEngine;
1522
1658
 
1659
+ interface ReportFilter {
1660
+ taskId?: string;
1661
+ agent?: string;
1662
+ }
1663
+ interface CombinedReportFilter {
1664
+ pipelineRunId?: string;
1665
+ }
1666
+ interface ReportStore {
1667
+ saveReports(reports: Report[]): Promise<void>;
1668
+ listReports(filter?: ReportFilter): Promise<Report[]>;
1669
+ saveCombined(combined: CombinedReport): Promise<void>;
1670
+ getCombined(id: string): Promise<CombinedReport | undefined>;
1671
+ listCombined(filter?: CombinedReportFilter): Promise<CombinedReport[]>;
1672
+ }
1673
+ declare class FileReportStore implements ReportStore {
1674
+ private readonly filePath;
1675
+ private queue;
1676
+ constructor(directory?: string);
1677
+ saveReports(reports: Report[]): Promise<void>;
1678
+ listReports(filter?: ReportFilter): Promise<Report[]>;
1679
+ saveCombined(combined: CombinedReport): Promise<void>;
1680
+ getCombined(id: string): Promise<CombinedReport | undefined>;
1681
+ listCombined(filter?: CombinedReportFilter): Promise<CombinedReport[]>;
1682
+ private synchronized;
1683
+ private load;
1684
+ private write;
1685
+ }
1686
+
1687
+ /**
1688
+ * Report service (§16–§17): collects reports from finished tasks (structured
1689
+ * protocol reports when present, extraction from text otherwise), persists
1690
+ * them with source attribution and generates combined reports.
1691
+ */
1692
+
1693
+ interface CombinedMeta {
1694
+ objective?: string;
1695
+ pipelineRunId?: string;
1696
+ taskIds?: string[];
1697
+ }
1698
+ declare class ReportService {
1699
+ private readonly store;
1700
+ private readonly log;
1701
+ constructor(store: ReportStore, log?: Logger);
1702
+ get storeRef(): ReportStore;
1703
+ /** Normalizes finished tasks into reports (§17 — normalizer). */
1704
+ collectFromTasks(tasks: Task[]): Promise<Report[]>;
1705
+ saveReports(reports: Report[]): Promise<void>;
1706
+ generateCombined(reports: Report[], meta?: CombinedMeta): Promise<CombinedReport | undefined>;
1707
+ }
1708
+
1709
+ /**
1710
+ * Report normalization (§17): turns an agent's text output into a structured
1711
+ * Report by extracting findings, recommendations and evidence from
1712
+ * markdown-style sections. Deterministic heuristics; AI-assisted extraction
1713
+ * can layer on top later via the planner.
1714
+ */
1715
+
1716
+ interface ExtractionMeta {
1717
+ taskId: string;
1718
+ agent: string;
1719
+ model?: string;
1720
+ }
1721
+ declare function extractReportFromText(raw: string, meta: ExtractionMeta): Report;
1722
+
1723
+ interface AggregateOptions {
1724
+ objective?: string;
1725
+ pipelineRunId?: string;
1726
+ taskIds?: string[];
1727
+ /** Token-set Jaccard similarity above which findings are merged. */
1728
+ similarityThreshold?: number;
1729
+ }
1730
+ declare function aggregateReports(reports: Report[], options?: AggregateOptions): CombinedReport;
1731
+ declare function similar(a: string, b: string, threshold: number): boolean;
1732
+
1523
1733
  interface PipelineRunFilter {
1524
1734
  pipelineId?: string;
1525
1735
  status?: PipelineRunStatus;
@@ -1549,6 +1759,8 @@ interface PipelineEngineOptions {
1549
1759
  providers: AppConfig["project"]["providers"];
1550
1760
  store: PipelineRunStore;
1551
1761
  chat?: ChatFn;
1762
+ /** When present, finished runs have their reports collected, stored and combined (§16–§17). */
1763
+ reports?: ReportService;
1552
1764
  log?: Logger;
1553
1765
  }
1554
1766
  interface RunPipelineOptions {
@@ -1589,6 +1801,6 @@ declare function createDefaultChatFn(providers: AppConfig["project"]["providers"
1589
1801
 
1590
1802
  declare function buildPipelineEngine(config: AppConfig, log?: Logger): PipelineEngine;
1591
1803
 
1592
- declare const OMNINODE_VERSION = "0.6.0";
1804
+ declare const OMNINODE_VERSION = "0.8.0";
1593
1805
 
1594
- export { type AgentConfig, type AgentConfigYaml, AgentError, type AgentInfo, type AgentInputMode, type AgentIntegrationType, AgentRegistry, type AgentStatus, type AgentTaskInput, type AgentTaskOutput, type AgentToNodeMessage, type AppConfig, type AppConfigYaml, type ChatFn, type ChatMessage, type ChatRequest, type ChatResponse, type ChatRole, type ChatUsage, type Confidence, ConfigError, ConsoleLogSink, type CreateTaskInput, type DiscoveryResult, type EnvelopeMeta, FilePipelineRunStore, FileTaskStore, type Finding, type FindingSeverity, type HttpRequestOptions, type HttpResponse, type IAgent, type IChatProvider, type IMemoryProvider, type IProvider, type LoadConfigOptions, type LogLevel, type LogSink, Logger, type LoggerOptions, type MemoryEntry, MemoryError, type MemoryQuery, type MemoryScope, 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 Report, 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, appConfigSchema, authHeaders, buildAgentRegistry, buildPipelineEngine, buildRoleRegistry, composeTaskText, createAgent, createDefaultChatFn, createProvider, createTaskEngine, defaultProjectConfigYaml, expandEnvRefs, findConfigFile, isOmniNodeError, loadConfig, logger, pipelineConfigSchema, pipelineStepConfigSchema, projectConfigSchema, providerConfigSchema, registryKey, requestJson, resolveApiKey, roleConfigSchema };
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 };