@hilbras/omninode 0.0.0-stage → 0.1.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.
@@ -0,0 +1,946 @@
1
+ import { z } from 'zod';
2
+
3
+ /** Role system: what an AI is supposed to do, independent of any provider (§11). */
4
+ interface RoleDefinition {
5
+ /** Slug identifier, e.g. "architecture-reviewer". */
6
+ id: string;
7
+ name: string;
8
+ description?: string;
9
+ responsibilities: string[];
10
+ /** What the role is expected to return, e.g. findings, evidence, recommendations. */
11
+ expectedOutputs: string[];
12
+ /** Optional hint; roles remain provider- and agent-independent. */
13
+ preferredAgents?: string[];
14
+ systemPrompt?: string;
15
+ metadata?: Record<string, unknown>;
16
+ }
17
+
18
+ /** Agent abstraction: CLI agents and custom agents plug in via adapters (§9–§10). */
19
+
20
+ type AgentIntegrationType = "native" | "process" | "custom";
21
+ type AgentStatus = "registered" | "ready" | "running" | "busy" | "stopped" | "error";
22
+ interface AgentConfig {
23
+ name: string;
24
+ integration: AgentIntegrationType;
25
+ /** Executable command for process agents, e.g. "opencode". */
26
+ command?: string;
27
+ args?: string[];
28
+ cwd?: string;
29
+ env?: Record<string, string>;
30
+ /** Models (as "provider:model-id") this agent may use, if restricted. */
31
+ allowedModels?: string[];
32
+ metadata?: Record<string, unknown>;
33
+ }
34
+ interface AgentInfo {
35
+ name: string;
36
+ integration: AgentIntegrationType;
37
+ version?: string;
38
+ capabilities?: string[];
39
+ command?: string;
40
+ cwd?: string;
41
+ status: AgentStatus;
42
+ metadata?: Record<string, unknown>;
43
+ }
44
+ interface AgentTaskInput {
45
+ taskId: string;
46
+ objective: string;
47
+ role?: RoleDefinition;
48
+ /** Assembled task context (project, memory, files) already selected for this agent. */
49
+ context?: string;
50
+ instruction?: string;
51
+ }
52
+ interface AgentTaskOutput {
53
+ taskId: string;
54
+ status: "completed" | "failed" | "cancelled";
55
+ summary?: string;
56
+ /** Verbatim agent output; structured report parsing lands in Phase 6. */
57
+ rawOutput?: string;
58
+ exitCode?: number;
59
+ logs?: string[];
60
+ error?: string;
61
+ }
62
+ /** Contract every agent adapter implements (Phase 3+). */
63
+ interface IAgent {
64
+ readonly info: AgentInfo;
65
+ /** Submit a task and collect the agent's output. */
66
+ run(input: AgentTaskInput): Promise<AgentTaskOutput>;
67
+ /** Ask the agent to stop current work, if supported. */
68
+ cancel?(taskId: string): Promise<void>;
69
+ }
70
+
71
+ /**
72
+ * Memory abstraction. Remembera is the preferred Hilbras integration, but the
73
+ * core depends only on this interface (memory-agnostic principle, §2, §19).
74
+ */
75
+ type MemoryScope = "project" | "role" | "task" | "knowledge";
76
+ interface MemoryEntry {
77
+ key: string;
78
+ scope: MemoryScope;
79
+ content: string;
80
+ tags?: string[];
81
+ createdAt?: string;
82
+ updatedAt?: string;
83
+ metadata?: Record<string, unknown>;
84
+ }
85
+ interface MemoryQuery {
86
+ scope?: MemoryScope;
87
+ tags?: string[];
88
+ /** Free-text relevance query; implementations decide ranking. */
89
+ text?: string;
90
+ limit?: number;
91
+ }
92
+ interface IMemoryProvider {
93
+ readonly name: string;
94
+ /** Retrieve relevant memory; only relevant context should reach a task (§20). */
95
+ query(query: MemoryQuery): Promise<MemoryEntry[]>;
96
+ write(entry: MemoryEntry): Promise<void>;
97
+ }
98
+
99
+ /** Normalized model registry entry (DEVELOPMENT_PLAN.md §8). */
100
+ interface ModelCapabilities {
101
+ chat?: boolean;
102
+ coding?: boolean;
103
+ tools?: boolean;
104
+ vision?: boolean;
105
+ embeddings?: boolean;
106
+ }
107
+ type ModelStatus = "available" | "unavailable" | "deprecated";
108
+ interface ModelInfo {
109
+ /** Name of the provider this model belongs to. */
110
+ provider: string;
111
+ /** Provider-specific model identifier, e.g. "qwen3-coder". */
112
+ id: string;
113
+ displayName?: string;
114
+ capabilities?: ModelCapabilities;
115
+ contextWindow?: number;
116
+ status?: ModelStatus;
117
+ metadata?: Record<string, unknown>;
118
+ }
119
+
120
+ /** Task system: every operation becomes a Task (§13). */
121
+ type TaskStatus = "created" | "queued" | "running" | "waiting" | "completed" | "failed" | "cancelled";
122
+ interface TaskContext {
123
+ project?: string;
124
+ /** Paths or globs relevant to the task. */
125
+ files?: string[];
126
+ /** Free-form background injected into the prompt. */
127
+ background?: string;
128
+ /** Keys of memory entries pulled from the memory provider. */
129
+ memoryKeys?: string[];
130
+ }
131
+ interface TaskResult {
132
+ summary?: string;
133
+ artifacts?: string[];
134
+ reportId?: string;
135
+ error?: string;
136
+ finishedAt?: string;
137
+ }
138
+ interface Task {
139
+ id: string;
140
+ project?: string;
141
+ objective: string;
142
+ /** Role id from the role system. */
143
+ role?: string;
144
+ /** Agent name from the agent registry. */
145
+ agent?: string;
146
+ context?: TaskContext;
147
+ status: TaskStatus;
148
+ createdAt: string;
149
+ updatedAt: string;
150
+ result?: TaskResult;
151
+ }
152
+
153
+ /** Pipeline engine: coordinating multiple AI operations (§14). */
154
+
155
+ type PipelineStepKind = "research" | "collect" | "analyze" | "plan" | "execute" | "custom";
156
+ type PipelineStepCondition = "always" | "on-success" | "on-failure";
157
+ interface PipelineStep {
158
+ id: string;
159
+ kind: PipelineStepKind;
160
+ /** Agents fanned out for research steps. */
161
+ agents?: string[];
162
+ /** Model used for plan steps, e.g. "my-gateway:chatgpt". */
163
+ model?: string;
164
+ dependsOn?: string[];
165
+ condition?: PipelineStepCondition;
166
+ retries?: number;
167
+ }
168
+ interface PipelineDefinition {
169
+ id: string;
170
+ name?: string;
171
+ steps: PipelineStep[];
172
+ }
173
+ type PipelineRunStatus = "pending" | "running" | "completed" | "failed" | "cancelled";
174
+ interface PipelineStepRun {
175
+ stepId: string;
176
+ taskId?: string;
177
+ status: TaskStatus;
178
+ }
179
+ interface PipelineRun {
180
+ id: string;
181
+ pipelineId: string;
182
+ status: PipelineRunStatus;
183
+ startedAt?: string;
184
+ finishedAt?: string;
185
+ stepRuns: PipelineStepRun[];
186
+ }
187
+
188
+ /** Structured report format so reports can be processed programmatically (§16). */
189
+ type Confidence = "low" | "medium" | "high";
190
+ type FindingSeverity = "info" | "low" | "medium" | "high" | "critical";
191
+ interface Finding {
192
+ id: string;
193
+ title: string;
194
+ detail: string;
195
+ severity?: FindingSeverity;
196
+ evidence?: string[];
197
+ /** File path or conceptual location the finding refers to. */
198
+ location?: string;
199
+ tags?: string[];
200
+ }
201
+ interface Report {
202
+ id: string;
203
+ taskId: string;
204
+ /** Agent name from the agent registry. */
205
+ agent: string;
206
+ /** Model id used, if known. */
207
+ model?: string;
208
+ summary: string;
209
+ findings: Finding[];
210
+ recommendations: string[];
211
+ confidence?: Confidence;
212
+ createdAt: string;
213
+ metadata?: Record<string, unknown>;
214
+ }
215
+
216
+ /** Agent ↔ OmniNode communication protocol (§21). */
217
+
218
+ interface EnvelopeMeta {
219
+ taskId?: string;
220
+ agent?: string;
221
+ timestamp: string;
222
+ correlationId?: string;
223
+ }
224
+ type AgentToNodeMessage = {
225
+ type: "TASK_REQUEST";
226
+ payload: {
227
+ objective: string;
228
+ role?: string;
229
+ };
230
+ } | {
231
+ type: "REPORT";
232
+ payload: Report;
233
+ } | {
234
+ type: "STATUS";
235
+ payload: {
236
+ state: AgentStatus;
237
+ detail?: string;
238
+ };
239
+ } | {
240
+ type: "QUESTION";
241
+ payload: {
242
+ question: string;
243
+ };
244
+ } | {
245
+ type: "ARTIFACT";
246
+ payload: {
247
+ path: string;
248
+ description?: string;
249
+ };
250
+ } | {
251
+ type: "COMPLETION";
252
+ payload: {
253
+ summary?: string;
254
+ };
255
+ } | {
256
+ type: "ERROR";
257
+ payload: {
258
+ code: string;
259
+ message: string;
260
+ };
261
+ };
262
+ type NodeToAgentMessage = {
263
+ type: "TASK";
264
+ payload: {
265
+ taskId: string;
266
+ objective: string;
267
+ };
268
+ } | {
269
+ type: "CONTEXT";
270
+ payload: {
271
+ body: string;
272
+ };
273
+ } | {
274
+ type: "ROLE";
275
+ payload: RoleDefinition;
276
+ } | {
277
+ type: "INSTRUCTION";
278
+ payload: {
279
+ text: string;
280
+ };
281
+ }
282
+ /** Plan schema lands in Phase 8. */
283
+ | {
284
+ type: "PLAN";
285
+ payload: unknown;
286
+ } | {
287
+ type: "FEEDBACK";
288
+ payload: {
289
+ text: string;
290
+ };
291
+ } | {
292
+ type: "VERIFICATION_RESULT";
293
+ payload: {
294
+ passed: boolean;
295
+ details?: string;
296
+ };
297
+ };
298
+ interface MessageEnvelope<T extends AgentToNodeMessage | NodeToAgentMessage> {
299
+ meta: EnvelopeMeta;
300
+ message: T;
301
+ }
302
+
303
+ /** Projects are first-class entities (§12). */
304
+ interface Project {
305
+ name: string;
306
+ repository?: string;
307
+ workspace?: string;
308
+ agents: string[];
309
+ roles: string[];
310
+ providers?: string[];
311
+ memory?: {
312
+ provider: string;
313
+ };
314
+ createdAt?: string;
315
+ }
316
+
317
+ /**
318
+ * Provider abstraction. OmniNode is provider-agnostic: any AI gateway or local
319
+ * runtime plugs in through this interface (DEVELOPMENT_PLAN.md §5–§7).
320
+ */
321
+
322
+ type ProviderType = "openai-compatible" | "omnihilbras" | "openrouter" | "local" | "custom";
323
+ type ProviderHealth = "unknown" | "healthy" | "degraded" | "unreachable";
324
+ interface ProviderConfig {
325
+ /** Unique name used in project configuration and the model registry. */
326
+ name: string;
327
+ type: ProviderType;
328
+ baseUrl: string;
329
+ /**
330
+ * Name of the environment variable that holds the API key. Keys are never
331
+ * stored in project files (DEVELOPMENT_PLAN.md §24 — Security).
332
+ */
333
+ apiKeyEnvVar?: string;
334
+ headers?: Record<string, string>;
335
+ enabled?: boolean;
336
+ metadata?: Record<string, unknown>;
337
+ }
338
+ interface ProviderStatus {
339
+ name: string;
340
+ type: ProviderType;
341
+ baseUrl: string;
342
+ health: ProviderHealth;
343
+ connected: boolean;
344
+ modelCount: number;
345
+ lastCheckedAt?: string;
346
+ message?: string;
347
+ }
348
+ /** Contract every provider adapter implements (Phase 1+). */
349
+ interface IProvider {
350
+ readonly config: ProviderConfig;
351
+ /** Discover models exposed by this provider. */
352
+ listModels(): Promise<ModelInfo[]>;
353
+ /** Check connectivity and authentication. */
354
+ healthCheck(): Promise<ProviderStatus>;
355
+ }
356
+
357
+ /** Typed error hierarchy shared across the whole codebase (§4.1 — error model). */
358
+ type OmniNodeErrorCode = "CONFIG_NOT_FOUND" | "CONFIG_INVALID" | "PROVIDER_UNAVAILABLE" | "PROVIDER_AUTH_FAILED" | "MODEL_NOT_FOUND" | "AGENT_NOT_FOUND" | "AGENT_FAILED" | "AGENT_TIMEOUT" | "TASK_INVALID" | "TASK_FAILED" | "PIPELINE_INVALID" | "PIPELINE_FAILED" | "PROTOCOL_VIOLATION" | "MEMORY_UNAVAILABLE" | "NOT_IMPLEMENTED" | "CLI_USAGE" | "INTERNAL";
359
+ interface OmniNodeErrorOptions {
360
+ cause?: unknown;
361
+ details?: Record<string, unknown>;
362
+ }
363
+ declare class OmniNodeError extends Error {
364
+ readonly code: OmniNodeErrorCode;
365
+ readonly details?: Record<string, unknown>;
366
+ constructor(code: OmniNodeErrorCode, message: string, options?: OmniNodeErrorOptions);
367
+ }
368
+ declare class ConfigError extends OmniNodeError {
369
+ constructor(code: "CONFIG_NOT_FOUND" | "CONFIG_INVALID", message: string, options?: OmniNodeErrorOptions);
370
+ }
371
+ declare class ProviderError extends OmniNodeError {
372
+ constructor(code: "PROVIDER_UNAVAILABLE" | "PROVIDER_AUTH_FAILED" | "MODEL_NOT_FOUND", message: string, options?: OmniNodeErrorOptions);
373
+ }
374
+ declare class AgentError extends OmniNodeError {
375
+ constructor(code: "AGENT_NOT_FOUND" | "AGENT_FAILED" | "AGENT_TIMEOUT", message: string, options?: OmniNodeErrorOptions);
376
+ }
377
+ declare class TaskError extends OmniNodeError {
378
+ constructor(code: "TASK_INVALID" | "TASK_FAILED", message: string, options?: OmniNodeErrorOptions);
379
+ }
380
+ declare class PipelineError extends OmniNodeError {
381
+ constructor(code: "PIPELINE_INVALID" | "PIPELINE_FAILED", message: string, options?: OmniNodeErrorOptions);
382
+ }
383
+ declare class ProtocolError extends OmniNodeError {
384
+ constructor(message: string, options?: OmniNodeErrorOptions);
385
+ }
386
+ declare class MemoryError extends OmniNodeError {
387
+ constructor(message: string, options?: OmniNodeErrorOptions);
388
+ }
389
+ declare function isOmniNodeError(value: unknown): value is OmniNodeError;
390
+
391
+ /** Leveled logger with a pluggable sink and child loggers (§4.1 — logging). */
392
+ type LogLevel = "debug" | "info" | "warn" | "error";
393
+ interface LogSink {
394
+ write(level: LogLevel, line: string): void;
395
+ }
396
+ interface WritableLike {
397
+ write(chunk: string): unknown;
398
+ }
399
+ declare class ConsoleLogSink implements LogSink {
400
+ private readonly stream;
401
+ constructor(stream?: WritableLike);
402
+ write(_level: LogLevel, line: string): void;
403
+ }
404
+ interface LoggerOptions {
405
+ level?: LogLevel;
406
+ sink?: LogSink;
407
+ /** Structured fields attached to every line, e.g. { component: "config" }. */
408
+ context?: Record<string, unknown>;
409
+ }
410
+ declare class Logger {
411
+ private readonly level;
412
+ private readonly sink;
413
+ private readonly context;
414
+ constructor(options?: LoggerOptions);
415
+ child(context: Record<string, unknown>): Logger;
416
+ debug(message: string, data?: Record<string, unknown>): void;
417
+ info(message: string, data?: Record<string, unknown>): void;
418
+ warn(message: string, data?: Record<string, unknown>): void;
419
+ error(message: string, data?: Record<string, unknown>): void;
420
+ private log;
421
+ }
422
+ /** Default application logger. Writes to stderr so stdout stays clean for CLI output. */
423
+ declare const logger: Logger;
424
+
425
+ /**
426
+ * Configuration schema. The project file (omninode.yaml) uses snake_case keys
427
+ * as shown in DEVELOPMENT_PLAN.md §7 and §23; the loader maps them onto the
428
+ * camelCase TypeScript contracts in src/types.
429
+ */
430
+
431
+ declare const providerConfigSchema: z.ZodObject<{
432
+ name: z.ZodString;
433
+ type: z.ZodEnum<["openai-compatible", "omnihilbras", "openrouter", "local", "custom"]>;
434
+ base_url: z.ZodString;
435
+ api_key_env_var: z.ZodOptional<z.ZodString>;
436
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
437
+ enabled: z.ZodOptional<z.ZodBoolean>;
438
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
439
+ }, "strict", z.ZodTypeAny, {
440
+ name: string;
441
+ type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
442
+ base_url: string;
443
+ api_key_env_var?: string | undefined;
444
+ headers?: Record<string, string> | undefined;
445
+ enabled?: boolean | undefined;
446
+ metadata?: Record<string, unknown> | undefined;
447
+ }, {
448
+ name: string;
449
+ type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
450
+ base_url: string;
451
+ api_key_env_var?: string | undefined;
452
+ headers?: Record<string, string> | undefined;
453
+ enabled?: boolean | undefined;
454
+ metadata?: Record<string, unknown> | undefined;
455
+ }>;
456
+ declare const agentConfigSchema: z.ZodObject<{
457
+ name: z.ZodString;
458
+ /** "cli" agents communicate over stdin/stdout (process adapter). */
459
+ type: z.ZodDefault<z.ZodEnum<["cli", "native", "process"]>>;
460
+ command: z.ZodOptional<z.ZodString>;
461
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
462
+ cwd: z.ZodOptional<z.ZodString>;
463
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
464
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
465
+ }, "strict", z.ZodTypeAny, {
466
+ name: string;
467
+ type: "native" | "process" | "cli";
468
+ metadata?: Record<string, unknown> | undefined;
469
+ command?: string | undefined;
470
+ args?: string[] | undefined;
471
+ cwd?: string | undefined;
472
+ env?: Record<string, string> | undefined;
473
+ }, {
474
+ name: string;
475
+ type?: "native" | "process" | "cli" | undefined;
476
+ metadata?: Record<string, unknown> | undefined;
477
+ command?: string | undefined;
478
+ args?: string[] | undefined;
479
+ cwd?: string | undefined;
480
+ env?: Record<string, string> | undefined;
481
+ }>;
482
+ declare const roleConfigSchema: z.ZodObject<{
483
+ id: z.ZodString;
484
+ name: z.ZodString;
485
+ description: z.ZodOptional<z.ZodString>;
486
+ responsibilities: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
487
+ expected_outputs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
488
+ preferred_agents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
489
+ system_prompt: z.ZodOptional<z.ZodString>;
490
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
491
+ }, "strict", z.ZodTypeAny, {
492
+ name: string;
493
+ id: string;
494
+ responsibilities: string[];
495
+ expected_outputs: string[];
496
+ metadata?: Record<string, unknown> | undefined;
497
+ description?: string | undefined;
498
+ preferred_agents?: string[] | undefined;
499
+ system_prompt?: string | undefined;
500
+ }, {
501
+ name: string;
502
+ id: string;
503
+ metadata?: Record<string, unknown> | undefined;
504
+ description?: string | undefined;
505
+ responsibilities?: string[] | undefined;
506
+ expected_outputs?: string[] | undefined;
507
+ preferred_agents?: string[] | undefined;
508
+ system_prompt?: string | undefined;
509
+ }>;
510
+ declare const projectConfigSchema: z.ZodObject<{
511
+ name: z.ZodString;
512
+ providers: z.ZodDefault<z.ZodArray<z.ZodObject<{
513
+ name: z.ZodString;
514
+ type: z.ZodEnum<["openai-compatible", "omnihilbras", "openrouter", "local", "custom"]>;
515
+ base_url: z.ZodString;
516
+ api_key_env_var: z.ZodOptional<z.ZodString>;
517
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
518
+ enabled: z.ZodOptional<z.ZodBoolean>;
519
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
520
+ }, "strict", z.ZodTypeAny, {
521
+ name: string;
522
+ type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
523
+ base_url: string;
524
+ api_key_env_var?: string | undefined;
525
+ headers?: Record<string, string> | undefined;
526
+ enabled?: boolean | undefined;
527
+ metadata?: Record<string, unknown> | undefined;
528
+ }, {
529
+ name: string;
530
+ type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
531
+ base_url: string;
532
+ api_key_env_var?: string | undefined;
533
+ headers?: Record<string, string> | undefined;
534
+ enabled?: boolean | undefined;
535
+ metadata?: Record<string, unknown> | undefined;
536
+ }>, "many">>;
537
+ agents: z.ZodDefault<z.ZodArray<z.ZodObject<{
538
+ name: z.ZodString;
539
+ /** "cli" agents communicate over stdin/stdout (process adapter). */
540
+ type: z.ZodDefault<z.ZodEnum<["cli", "native", "process"]>>;
541
+ command: z.ZodOptional<z.ZodString>;
542
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
543
+ cwd: z.ZodOptional<z.ZodString>;
544
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
545
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
546
+ }, "strict", z.ZodTypeAny, {
547
+ name: string;
548
+ type: "native" | "process" | "cli";
549
+ metadata?: Record<string, unknown> | undefined;
550
+ command?: string | undefined;
551
+ args?: string[] | undefined;
552
+ cwd?: string | undefined;
553
+ env?: Record<string, string> | undefined;
554
+ }, {
555
+ name: string;
556
+ type?: "native" | "process" | "cli" | undefined;
557
+ metadata?: Record<string, unknown> | undefined;
558
+ command?: string | undefined;
559
+ args?: string[] | undefined;
560
+ cwd?: string | undefined;
561
+ env?: Record<string, string> | undefined;
562
+ }>, "many">>;
563
+ roles: z.ZodDefault<z.ZodArray<z.ZodObject<{
564
+ id: z.ZodString;
565
+ name: z.ZodString;
566
+ description: z.ZodOptional<z.ZodString>;
567
+ responsibilities: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
568
+ expected_outputs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
569
+ preferred_agents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
570
+ system_prompt: z.ZodOptional<z.ZodString>;
571
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
572
+ }, "strict", z.ZodTypeAny, {
573
+ name: string;
574
+ id: string;
575
+ responsibilities: string[];
576
+ expected_outputs: string[];
577
+ metadata?: Record<string, unknown> | undefined;
578
+ description?: string | undefined;
579
+ preferred_agents?: string[] | undefined;
580
+ system_prompt?: string | undefined;
581
+ }, {
582
+ name: string;
583
+ id: string;
584
+ metadata?: Record<string, unknown> | undefined;
585
+ description?: string | undefined;
586
+ responsibilities?: string[] | undefined;
587
+ expected_outputs?: string[] | undefined;
588
+ preferred_agents?: string[] | undefined;
589
+ system_prompt?: string | undefined;
590
+ }>, "many">>;
591
+ memory: z.ZodOptional<z.ZodObject<{
592
+ provider: z.ZodString;
593
+ }, "strict", z.ZodTypeAny, {
594
+ provider: string;
595
+ }, {
596
+ provider: string;
597
+ }>>;
598
+ }, "strict", z.ZodTypeAny, {
599
+ name: string;
600
+ providers: {
601
+ name: string;
602
+ type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
603
+ base_url: string;
604
+ api_key_env_var?: string | undefined;
605
+ headers?: Record<string, string> | undefined;
606
+ enabled?: boolean | undefined;
607
+ metadata?: Record<string, unknown> | undefined;
608
+ }[];
609
+ agents: {
610
+ name: string;
611
+ type: "native" | "process" | "cli";
612
+ metadata?: Record<string, unknown> | undefined;
613
+ command?: string | undefined;
614
+ args?: string[] | undefined;
615
+ cwd?: string | undefined;
616
+ env?: Record<string, string> | undefined;
617
+ }[];
618
+ roles: {
619
+ name: string;
620
+ id: string;
621
+ responsibilities: string[];
622
+ expected_outputs: string[];
623
+ metadata?: Record<string, unknown> | undefined;
624
+ description?: string | undefined;
625
+ preferred_agents?: string[] | undefined;
626
+ system_prompt?: string | undefined;
627
+ }[];
628
+ memory?: {
629
+ provider: string;
630
+ } | undefined;
631
+ }, {
632
+ name: string;
633
+ providers?: {
634
+ name: string;
635
+ type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
636
+ base_url: string;
637
+ api_key_env_var?: string | undefined;
638
+ headers?: Record<string, string> | undefined;
639
+ enabled?: boolean | undefined;
640
+ metadata?: Record<string, unknown> | undefined;
641
+ }[] | undefined;
642
+ agents?: {
643
+ name: string;
644
+ type?: "native" | "process" | "cli" | undefined;
645
+ metadata?: Record<string, unknown> | undefined;
646
+ command?: string | undefined;
647
+ args?: string[] | undefined;
648
+ cwd?: string | undefined;
649
+ env?: Record<string, string> | undefined;
650
+ }[] | undefined;
651
+ roles?: {
652
+ name: string;
653
+ id: string;
654
+ metadata?: Record<string, unknown> | undefined;
655
+ description?: string | undefined;
656
+ responsibilities?: string[] | undefined;
657
+ expected_outputs?: string[] | undefined;
658
+ preferred_agents?: string[] | undefined;
659
+ system_prompt?: string | undefined;
660
+ }[] | undefined;
661
+ memory?: {
662
+ provider: string;
663
+ } | undefined;
664
+ }>;
665
+ declare const appConfigSchema: z.ZodObject<{
666
+ project: z.ZodObject<{
667
+ name: z.ZodString;
668
+ providers: z.ZodDefault<z.ZodArray<z.ZodObject<{
669
+ name: z.ZodString;
670
+ type: z.ZodEnum<["openai-compatible", "omnihilbras", "openrouter", "local", "custom"]>;
671
+ base_url: z.ZodString;
672
+ api_key_env_var: z.ZodOptional<z.ZodString>;
673
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
674
+ enabled: z.ZodOptional<z.ZodBoolean>;
675
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
676
+ }, "strict", z.ZodTypeAny, {
677
+ name: string;
678
+ type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
679
+ base_url: string;
680
+ api_key_env_var?: string | undefined;
681
+ headers?: Record<string, string> | undefined;
682
+ enabled?: boolean | undefined;
683
+ metadata?: Record<string, unknown> | undefined;
684
+ }, {
685
+ name: string;
686
+ type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
687
+ base_url: string;
688
+ api_key_env_var?: string | undefined;
689
+ headers?: Record<string, string> | undefined;
690
+ enabled?: boolean | undefined;
691
+ metadata?: Record<string, unknown> | undefined;
692
+ }>, "many">>;
693
+ agents: z.ZodDefault<z.ZodArray<z.ZodObject<{
694
+ name: z.ZodString;
695
+ /** "cli" agents communicate over stdin/stdout (process adapter). */
696
+ type: z.ZodDefault<z.ZodEnum<["cli", "native", "process"]>>;
697
+ command: z.ZodOptional<z.ZodString>;
698
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
699
+ cwd: z.ZodOptional<z.ZodString>;
700
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
701
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
702
+ }, "strict", z.ZodTypeAny, {
703
+ name: string;
704
+ type: "native" | "process" | "cli";
705
+ metadata?: Record<string, unknown> | undefined;
706
+ command?: string | undefined;
707
+ args?: string[] | undefined;
708
+ cwd?: string | undefined;
709
+ env?: Record<string, string> | undefined;
710
+ }, {
711
+ name: string;
712
+ type?: "native" | "process" | "cli" | undefined;
713
+ metadata?: Record<string, unknown> | undefined;
714
+ command?: string | undefined;
715
+ args?: string[] | undefined;
716
+ cwd?: string | undefined;
717
+ env?: Record<string, string> | undefined;
718
+ }>, "many">>;
719
+ roles: z.ZodDefault<z.ZodArray<z.ZodObject<{
720
+ id: z.ZodString;
721
+ name: z.ZodString;
722
+ description: z.ZodOptional<z.ZodString>;
723
+ responsibilities: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
724
+ expected_outputs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
725
+ preferred_agents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
726
+ system_prompt: z.ZodOptional<z.ZodString>;
727
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
728
+ }, "strict", z.ZodTypeAny, {
729
+ name: string;
730
+ id: string;
731
+ responsibilities: string[];
732
+ expected_outputs: string[];
733
+ metadata?: Record<string, unknown> | undefined;
734
+ description?: string | undefined;
735
+ preferred_agents?: string[] | undefined;
736
+ system_prompt?: string | undefined;
737
+ }, {
738
+ name: string;
739
+ id: string;
740
+ metadata?: Record<string, unknown> | undefined;
741
+ description?: string | undefined;
742
+ responsibilities?: string[] | undefined;
743
+ expected_outputs?: string[] | undefined;
744
+ preferred_agents?: string[] | undefined;
745
+ system_prompt?: string | undefined;
746
+ }>, "many">>;
747
+ memory: z.ZodOptional<z.ZodObject<{
748
+ provider: z.ZodString;
749
+ }, "strict", z.ZodTypeAny, {
750
+ provider: string;
751
+ }, {
752
+ provider: string;
753
+ }>>;
754
+ }, "strict", z.ZodTypeAny, {
755
+ name: string;
756
+ providers: {
757
+ name: string;
758
+ type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
759
+ base_url: string;
760
+ api_key_env_var?: string | undefined;
761
+ headers?: Record<string, string> | undefined;
762
+ enabled?: boolean | undefined;
763
+ metadata?: Record<string, unknown> | undefined;
764
+ }[];
765
+ agents: {
766
+ name: string;
767
+ type: "native" | "process" | "cli";
768
+ metadata?: Record<string, unknown> | undefined;
769
+ command?: string | undefined;
770
+ args?: string[] | undefined;
771
+ cwd?: string | undefined;
772
+ env?: Record<string, string> | undefined;
773
+ }[];
774
+ roles: {
775
+ name: string;
776
+ id: string;
777
+ responsibilities: string[];
778
+ expected_outputs: string[];
779
+ metadata?: Record<string, unknown> | undefined;
780
+ description?: string | undefined;
781
+ preferred_agents?: string[] | undefined;
782
+ system_prompt?: string | undefined;
783
+ }[];
784
+ memory?: {
785
+ provider: string;
786
+ } | undefined;
787
+ }, {
788
+ name: string;
789
+ providers?: {
790
+ name: string;
791
+ type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
792
+ base_url: string;
793
+ api_key_env_var?: string | undefined;
794
+ headers?: Record<string, string> | undefined;
795
+ enabled?: boolean | undefined;
796
+ metadata?: Record<string, unknown> | undefined;
797
+ }[] | undefined;
798
+ agents?: {
799
+ name: string;
800
+ type?: "native" | "process" | "cli" | undefined;
801
+ metadata?: Record<string, unknown> | undefined;
802
+ command?: string | undefined;
803
+ args?: string[] | undefined;
804
+ cwd?: string | undefined;
805
+ env?: Record<string, string> | undefined;
806
+ }[] | undefined;
807
+ roles?: {
808
+ name: string;
809
+ id: string;
810
+ metadata?: Record<string, unknown> | undefined;
811
+ description?: string | undefined;
812
+ responsibilities?: string[] | undefined;
813
+ expected_outputs?: string[] | undefined;
814
+ preferred_agents?: string[] | undefined;
815
+ system_prompt?: string | undefined;
816
+ }[] | undefined;
817
+ memory?: {
818
+ provider: string;
819
+ } | undefined;
820
+ }>;
821
+ logging: z.ZodOptional<z.ZodObject<{
822
+ level: z.ZodEnum<["debug", "info", "warn", "error"]>;
823
+ }, "strict", z.ZodTypeAny, {
824
+ level: "error" | "info" | "debug" | "warn";
825
+ }, {
826
+ level: "error" | "info" | "debug" | "warn";
827
+ }>>;
828
+ }, "strict", z.ZodTypeAny, {
829
+ project: {
830
+ name: string;
831
+ providers: {
832
+ name: string;
833
+ type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
834
+ base_url: string;
835
+ api_key_env_var?: string | undefined;
836
+ headers?: Record<string, string> | undefined;
837
+ enabled?: boolean | undefined;
838
+ metadata?: Record<string, unknown> | undefined;
839
+ }[];
840
+ agents: {
841
+ name: string;
842
+ type: "native" | "process" | "cli";
843
+ metadata?: Record<string, unknown> | undefined;
844
+ command?: string | undefined;
845
+ args?: string[] | undefined;
846
+ cwd?: string | undefined;
847
+ env?: Record<string, string> | undefined;
848
+ }[];
849
+ roles: {
850
+ name: string;
851
+ id: string;
852
+ responsibilities: string[];
853
+ expected_outputs: string[];
854
+ metadata?: Record<string, unknown> | undefined;
855
+ description?: string | undefined;
856
+ preferred_agents?: string[] | undefined;
857
+ system_prompt?: string | undefined;
858
+ }[];
859
+ memory?: {
860
+ provider: string;
861
+ } | undefined;
862
+ };
863
+ logging?: {
864
+ level: "error" | "info" | "debug" | "warn";
865
+ } | undefined;
866
+ }, {
867
+ project: {
868
+ name: string;
869
+ providers?: {
870
+ name: string;
871
+ type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
872
+ base_url: string;
873
+ api_key_env_var?: string | undefined;
874
+ headers?: Record<string, string> | undefined;
875
+ enabled?: boolean | undefined;
876
+ metadata?: Record<string, unknown> | undefined;
877
+ }[] | undefined;
878
+ agents?: {
879
+ name: string;
880
+ type?: "native" | "process" | "cli" | undefined;
881
+ metadata?: Record<string, unknown> | undefined;
882
+ command?: string | undefined;
883
+ args?: string[] | undefined;
884
+ cwd?: string | undefined;
885
+ env?: Record<string, string> | undefined;
886
+ }[] | undefined;
887
+ roles?: {
888
+ name: string;
889
+ id: string;
890
+ metadata?: Record<string, unknown> | undefined;
891
+ description?: string | undefined;
892
+ responsibilities?: string[] | undefined;
893
+ expected_outputs?: string[] | undefined;
894
+ preferred_agents?: string[] | undefined;
895
+ system_prompt?: string | undefined;
896
+ }[] | undefined;
897
+ memory?: {
898
+ provider: string;
899
+ } | undefined;
900
+ };
901
+ logging?: {
902
+ level: "error" | "info" | "debug" | "warn";
903
+ } | undefined;
904
+ }>;
905
+ type ProviderConfigYaml = z.infer<typeof providerConfigSchema>;
906
+ type AgentConfigYaml = z.infer<typeof agentConfigSchema>;
907
+ type RoleConfigYaml = z.infer<typeof roleConfigSchema>;
908
+ type ProjectConfigYaml = z.infer<typeof projectConfigSchema>;
909
+ type AppConfigYaml = z.infer<typeof appConfigSchema>;
910
+
911
+ interface AppConfig {
912
+ project: {
913
+ name: string;
914
+ providers: ProviderConfig[];
915
+ agents: AgentConfig[];
916
+ roles: RoleDefinition[];
917
+ memory?: {
918
+ provider: string;
919
+ };
920
+ };
921
+ logging?: {
922
+ level: LogLevel;
923
+ };
924
+ }
925
+ interface LoadConfigOptions {
926
+ /** Explicit path; otherwise omninode.yaml/yml/json is looked up in the given directory. */
927
+ path?: string;
928
+ directory?: string;
929
+ /** Environment used for ${VAR} expansion; defaults to process.env. */
930
+ env?: Record<string, string | undefined>;
931
+ }
932
+ declare function findConfigFile(directory?: string): string | undefined;
933
+ /**
934
+ * Replaces ${VAR} and ${VAR:-fallback} references. Unset variables without a
935
+ * fallback abort loading: a half-resolved config could silently misroute
936
+ * authentication.
937
+ */
938
+ declare function expandEnvRefs(text: string, env: Record<string, string | undefined>, source?: string): string;
939
+ declare function loadConfig(options?: LoadConfigOptions): AppConfig;
940
+
941
+ /** Template written by `omninode init` (§22, §23). */
942
+ declare function defaultProjectConfigYaml(projectName?: string): string;
943
+
944
+ declare const OMNINODE_VERSION = "0.1.0";
945
+
946
+ export { type AgentConfig, type AgentConfigYaml, AgentError, type AgentInfo, type AgentIntegrationType, type AgentStatus, type AgentTaskInput, type AgentTaskOutput, type AgentToNodeMessage, type AppConfig, type AppConfigYaml, type Confidence, ConfigError, ConsoleLogSink, type EnvelopeMeta, type Finding, type FindingSeverity, type IAgent, 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 ModelInfo, type ModelStatus, type NodeToAgentMessage, OMNINODE_VERSION, OmniNodeError, type OmniNodeErrorCode, type OmniNodeErrorOptions, type PipelineDefinition, PipelineError, type PipelineRun, type PipelineRunStatus, type PipelineStep, type PipelineStepCondition, type PipelineStepKind, type PipelineStepRun, type Project, type ProjectConfigYaml, ProtocolError, type ProviderConfig, type ProviderConfigYaml, ProviderError, type ProviderHealth, type ProviderStatus, type ProviderType, type Report, type RoleConfigYaml, type RoleDefinition, type Task, type TaskContext, TaskError, type TaskResult, type TaskStatus, type WritableLike, agentConfigSchema, appConfigSchema, defaultProjectConfigYaml, expandEnvRefs, findConfigFile, isOmniNodeError, loadConfig, logger, projectConfigSchema, providerConfigSchema, roleConfigSchema };