@hilbras/omninode 2.0.0-alpha.4 → 2.0.0-alpha.6

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
@@ -334,14 +334,25 @@ interface ModelCapabilities {
334
334
  embeddings?: boolean;
335
335
  }
336
336
  type ModelStatus = "available" | "unavailable" | "deprecated";
337
+ type Modality = "text" | "image" | "audio" | "video" | "embedding";
338
+ /** Model metadata (roadmap §10, Model Metadata). */
337
339
  interface ModelInfo {
338
340
  /** Name of the provider this model belongs to. */
339
341
  provider: string;
340
342
  /** Provider-specific model identifier, e.g. "qwen3-coder". */
341
343
  id: string;
342
344
  displayName?: string;
345
+ /** Human-readable model name reported by the provider, when available. */
346
+ name?: string;
343
347
  capabilities?: ModelCapabilities;
344
348
  contextWindow?: number;
349
+ inputTypes?: Modality[];
350
+ outputTypes?: Modality[];
351
+ supportsTools?: boolean;
352
+ supportsVision?: boolean;
353
+ supportsReasoning?: boolean;
354
+ supportsStructuredOutput?: boolean;
355
+ supportsStreaming?: boolean;
345
356
  status?: ModelStatus;
346
357
  metadata?: Record<string, unknown>;
347
358
  }
@@ -443,18 +454,37 @@ interface PipelineDefinition {
443
454
  * authoritative detail always lives in `stepRuns`/`taskRuns`.
444
455
  */
445
456
  type PipelineRunStatus = "pending" | "running" | "completed" | "failed" | "partial" | "cancelled";
457
+ /**
458
+ * One step execution inside a run (§9.1 — Step Run is NOT the Step).
459
+ */
446
460
  interface PipelineStepRun {
447
461
  stepId: string;
448
462
  status: TaskStatus;
449
463
  /** Tasks created for this step (research fans out to several). */
450
464
  taskIds?: string[];
465
+ /** Execution ids of the tasks this step created, for correlation (§6.5). */
466
+ executionIds?: string[];
467
+ /** Which attempt of this step produced this record (1 = first try). */
468
+ attempt?: number;
451
469
  /** Set on plan steps that produced a stored plan (§18). */
452
470
  planId?: string;
453
471
  error?: string;
454
472
  }
473
+ /** One execution attempt of a run (§9.1 — Attempt is not the Run). */
474
+ interface PipelineRunAttempt {
475
+ attempt: number;
476
+ startedAt: string;
477
+ finishedAt?: string;
478
+ status: PipelineRunStatus;
479
+ }
455
480
  interface PipelineRun {
456
481
  id: string;
457
482
  pipelineId: string;
483
+ /** Execution attempt counter: retries of the same run increment it. */
484
+ attempt: number;
485
+ /** Set when cancellation was requested; the run stops at the next check point. */
486
+ cancellationRequested?: boolean;
487
+ cancellationRequestedAt?: string;
458
488
  /** The objective this run is executing (persisted for retries). */
459
489
  objective?: string;
460
490
  status: PipelineRunStatus;
@@ -469,6 +499,28 @@ interface PipelineRun {
469
499
  planId?: string;
470
500
  /** Outcome summary of the final executed step (§28 — Result). */
471
501
  resultSummary?: string;
502
+ /** Per-attempt history (§9.1). */
503
+ attempts?: PipelineRunAttempt[];
504
+ }
505
+ /**
506
+ * Executor contract (roadmap §9.1 / §9.2): a Pipeline definition, a Run of
507
+ * it, Steps, Step Runs and Attempts are distinct concepts; this interface is
508
+ * what orchestration code depends on.
509
+ */
510
+ interface IPipelineExecutor {
511
+ validate(definition: PipelineDefinition): void;
512
+ run(definition: PipelineDefinition, options?: PipelineRunOptions): Promise<PipelineRun>;
513
+ cancel(runId: string): Promise<void>;
514
+ get(runId: string): Promise<PipelineRun | undefined>;
515
+ listRuns(filter?: {
516
+ pipelineId?: string;
517
+ }): Promise<PipelineRun[]>;
518
+ }
519
+ interface PipelineRunOptions {
520
+ objective?: string;
521
+ onStep?: (stepRun: PipelineStepRun) => void;
522
+ /** Total run attempts (1 = no automatic rerun of the whole run). */
523
+ maxAttempts?: number;
472
524
  }
473
525
 
474
526
  /** Plan types: the final implementation plan produced by the planner layer (§18). */
@@ -609,7 +661,20 @@ interface Project {
609
661
 
610
662
  type ProviderType = "openai-compatible" | "omnihilbras" | "openrouter" | "local" | "custom";
611
663
  type ProviderHealth = "unknown" | "healthy" | "degraded" | "unreachable";
664
+ /** Declared provider capabilities (roadmap §10, Provider Interface). */
665
+ type ProviderCapability = "chat" | "models" | "streaming" | "tools" | "embeddings" | "vision";
666
+ /** Normalized authentication description — never contains a secret value. */
667
+ interface ProviderAuthentication {
668
+ /** How the provider authenticates. */
669
+ method: "bearer" | "none" | "custom";
670
+ /** Environment variable that holds the credential, if any. */
671
+ envVar?: string;
672
+ /** True when the referenced variable is currently set. */
673
+ configured: boolean;
674
+ }
612
675
  interface ProviderConfig {
676
+ /** Stable identifier used in records and references (defaults to `name`). */
677
+ providerId?: string;
613
678
  /** Unique name used in project configuration and the model registry. */
614
679
  name: string;
615
680
  type: ProviderType;
@@ -620,6 +685,8 @@ interface ProviderConfig {
620
685
  */
621
686
  apiKeyEnvVar?: string;
622
687
  headers?: Record<string, string>;
688
+ /** Capabilities declared for this provider (discovered ones are merged in). */
689
+ capabilities?: ProviderCapability[];
623
690
  enabled?: boolean;
624
691
  metadata?: Record<string, unknown>;
625
692
  }
@@ -633,11 +700,22 @@ interface ProviderStatus {
633
700
  lastCheckedAt?: string;
634
701
  message?: string;
635
702
  }
636
- /** Contract every provider adapter implements (Phase 1+). */
703
+ /** Contract every provider adapter implements (roadmap §10). */
637
704
  interface IProvider {
638
705
  readonly config: ProviderConfig;
706
+ /** Stable identifier of this provider. */
707
+ readonly providerId: string;
708
+ /** Normalized authentication description (no secret values). */
709
+ readonly authentication: ProviderAuthentication;
710
+ /**
711
+ * Connect: authenticate and discover models (roadmap §10, Model Discovery).
712
+ * Returns the discovered models.
713
+ */
714
+ connect(): Promise<ModelInfo[]>;
639
715
  /** Discover models exposed by this provider. */
640
716
  listModels(): Promise<ModelInfo[]>;
717
+ /** Fetch a single model's metadata (from discovery; re-discovers if unknown). */
718
+ getModel(modelId: string): Promise<ModelInfo | undefined>;
641
719
  /** Check connectivity and authentication. */
642
720
  healthCheck(): Promise<ProviderStatus>;
643
721
  }
@@ -1801,11 +1879,56 @@ declare function requestJson(url: string, options?: HttpRequestOptions): Promise
1801
1879
  declare const OPENAI_COMPATIBLE_TYPES: readonly ProviderType[];
1802
1880
  declare function createProvider(config: ProviderConfig): IChatProvider;
1803
1881
 
1882
+ /**
1883
+ * Provider error normalization (roadmap §10).
1884
+ *
1885
+ * Every provider failure is mapped to one stable kind, so callers can react
1886
+ * (retry a rate limit, surface an auth problem, treat a missing model
1887
+ * differently) without string-matching provider-specific payloads.
1888
+ */
1889
+
1890
+ type ProviderErrorKind = "AUTHENTICATION_ERROR" | "RATE_LIMIT_ERROR" | "INVALID_REQUEST" | "MODEL_NOT_FOUND" | "TIMEOUT" | "NETWORK_ERROR" | "SERVER_ERROR" | "UNKNOWN_ERROR";
1891
+ interface ProviderErrorContext {
1892
+ provider: string;
1893
+ operation: string;
1894
+ status?: number;
1895
+ body?: unknown;
1896
+ retryAfterMs?: number;
1897
+ cause?: unknown;
1898
+ /** Maps the normalized kind onto the legacy stable error code. */
1899
+ code?: "PROVIDER_UNAVAILABLE" | "PROVIDER_AUTH_FAILED" | "MODEL_NOT_FOUND";
1900
+ }
1901
+ /** Kinds worth retrying automatically (rate limits and transient server errors). */
1902
+ declare function isRetryable(kind: ProviderErrorKind): boolean;
1903
+ /** Maps an HTTP status (and optional body) to a normalized kind. */
1904
+ declare function kindFromStatus(status: number): ProviderErrorKind;
1905
+ /** Extracts a human message from common provider error body shapes. */
1906
+ declare function extractMessage(body: unknown): string | undefined;
1907
+ /** Parses `Retry-After` (seconds or HTTP-date) into milliseconds. */
1908
+ declare function parseRetryAfter(value: string | null | undefined, now?: number): number | undefined;
1909
+ /** True for the abort/timeout errors raised by fetch's AbortSignal.timeout. */
1910
+ declare function isTimeoutError(error: unknown): boolean;
1911
+ /** True for transport failures (DNS, refused, TLS, offline). */
1912
+ declare function isNetworkError(error: unknown): boolean;
1913
+ declare function providerHttpError(context: ProviderErrorContext): ProviderError;
1914
+ /** Wraps a thrown transport/abort error into a normalized ProviderError. */
1915
+ declare function providerTransportError(context: Omit<ProviderErrorContext, "status" | "body">): ProviderError;
1916
+
1804
1917
  declare class OpenAICompatibleProvider implements IChatProvider {
1805
1918
  readonly config: ProviderConfig;
1919
+ readonly providerId: string;
1920
+ readonly authentication: ProviderAuthentication;
1806
1921
  private readonly log;
1807
- constructor(config: ProviderConfig, log?: Logger);
1922
+ /** Discovered models, so getModel() answers without another round-trip. */
1923
+ private discovered?;
1924
+ private readonly env;
1925
+ constructor(config: ProviderConfig, log?: Logger, env?: Record<string, string | undefined>);
1926
+ /** Authenticate + discover (roadmap §10, Model Discovery). */
1927
+ connect(): Promise<ModelInfo[]>;
1928
+ getModel(modelId: string): Promise<ModelInfo | undefined>;
1808
1929
  listModels(): Promise<ModelInfo[]>;
1930
+ /** Maps a raw model entry onto the normalized metadata shape (§10). */
1931
+ private toModelInfo;
1809
1932
  healthCheck(): Promise<ProviderStatus>;
1810
1933
  chat(request: ChatRequest): Promise<ChatResponse>;
1811
1934
  }
@@ -1852,7 +1975,7 @@ declare class OmniHilbrasProvider extends OpenAICompatibleProvider {
1852
1975
  * Run the full connect flow. Throws on authentication or transport failure
1853
1976
  * (use healthCheck() for a non-throwing probe).
1854
1977
  */
1855
- connect(registry?: ModelRegistry): Promise<OmniHilbrasConnectionResult>;
1978
+ connectAndRegister(registry?: ModelRegistry): Promise<OmniHilbrasConnectionResult>;
1856
1979
  }
1857
1980
 
1858
1981
  /**
@@ -2458,11 +2581,19 @@ interface RunPipelineOptions {
2458
2581
  objective?: string;
2459
2582
  onStep?: (stepRun: PipelineStepRun) => void;
2460
2583
  }
2461
- declare class PipelineEngine {
2584
+ declare class PipelineEngine implements IPipelineExecutor {
2462
2585
  private readonly options;
2463
2586
  private readonly log;
2587
+ /** Runs executing in THIS process — cancellation can terminate them directly. */
2588
+ private readonly activeRuns;
2464
2589
  constructor(options: PipelineEngineOptions);
2465
2590
  get store(): PipelineRunStore;
2591
+ /**
2592
+ * Saves the run while preserving fields that may be set by another process
2593
+ * (e.g. a cancellation request) — an in-memory snapshot must never clobber
2594
+ * externally requested cancellation (§9.2).
2595
+ */
2596
+ private persist;
2466
2597
  /** Structural + semantic validation (§27 Phase 5 — pipeline parser). */
2467
2598
  validate(def: PipelineDefinition): void;
2468
2599
  private assertAcyclic;
@@ -2471,13 +2602,18 @@ declare class PipelineEngine {
2471
2602
  * dependencies, which enable parallel branches.
2472
2603
  */
2473
2604
  private effectiveDependencies;
2474
- run(def: PipelineDefinition, options?: RunPipelineOptions): Promise<PipelineRun>;
2605
+ run(def: PipelineDefinition, options?: PipelineRunOptions): Promise<PipelineRun>;
2606
+ /** First-class cancellation (§9.2): requests cancellation and terminates
2607
+ * tasks that are running in this process immediately. */
2608
+ cancel(runId: string): Promise<void>;
2475
2609
  get(runId: string): Promise<PipelineRun | undefined>;
2476
2610
  listRuns(filter?: {
2477
2611
  pipelineId?: string;
2478
2612
  }): Promise<PipelineRun[]>;
2479
2613
  private shouldRun;
2480
2614
  private executeStep;
2615
+ /** Registers tasks created for a step as live, so cancellation can terminate them (§9.2). */
2616
+ private trackLiveTasks;
2481
2617
  private executeStepOnce;
2482
2618
  /** Research fan-out: one task per agent, in parallel (§15). */
2483
2619
  private runFanOut;
@@ -2509,6 +2645,6 @@ declare class ProjectStores {
2509
2645
  constructor(directory?: string);
2510
2646
  }
2511
2647
 
2512
- declare const OMNINODE_VERSION = "2.0.0-alpha.4";
2648
+ declare const OMNINODE_VERSION = "2.0.0-alpha.6";
2513
2649
 
2514
- export { AgentAdapterRegistry, type AgentConfig, type AgentConfigYaml, type AgentDescriptor, 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 ArtifactKind, type ArtifactPayload, type AskedQuestion, type AuditAction, type AuditEvent, type AuditSink, 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 CwdValidation, DEFAULT_MAX_OUTPUT_BYTES, type DecodeResult, type DiscoveryResult, type EnvPolicy, type EnvelopeMeta, type ExecutionRecord, type ExtractionMeta, FileAuditLog, FilePipelineRunStore, FilePlanStore, FileReportStore, FileTaskStore, type Finding, type FindingSeverity, type FindingSource, type HelloResult, HeuristicPlanner, type HttpRequestOptions, type HttpResponse, type IAgent, type IAgentAdapter, type IChatProvider, type IMemoryProvider, type IPlanner, type IProvider, type JsonDocument, JsonFileStore, type JsonFileStoreOptions, type LoadConfigOptions, LocalMemoryProvider, type LogLevel, type LogSink, Logger, type LoggerOptions, MAX_MESSAGE_BYTES, type MemoryContextQuery, type MemoryEntry, MemoryError, type MemoryProviderConfig, type MemoryQuery, type MemoryScope, MemoryService, type MessageEnvelope, type ModelCapabilities, type ModelFilter, type ModelInfo, ModelPlanner, ModelRegistry, type ModelStatus, type NodeToAgentMessage, OMNINODE_VERSION, OPENAI_COMPATIBLE_TYPES, type OmniHilbrasConnectionResult, OmniHilbrasProvider, OmniNodeError, type OmniNodeErrorCode, type OmniNodeErrorOptions, OpenAICompatibleProvider, PROTOCOL_V2, 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 PlanFilter, type PlanRequest, type PlanStep, type PlanStore, type PlannerConfigYaml, PlannerError, ProcessAgent, ProcessAgentAdapter, type Project, type ProjectConfigYaml, ProjectStores, type ProtocolAgentToNodeType, ProtocolDecoder, type ProtocolEnvelope, ProtocolError, type ProtocolMessageType, type ProtocolNodeToAgentType, ProtocolSession, type ProtocolViolation, type ProtocolViolationCode, type ProviderConfig, type ProviderConfigYaml, ProviderError, type ProviderHealth, type ProviderStatus, type ProviderType, type QuestionPayload, type QuestionResponder, type RememberaConfig, RememberaMemoryProvider, type Report, type ReportFilter, type ReportPayload, ReportService, type ReportStore, type RoleConfigYaml, type RoleDefinition, RoleRegistry, type RunPipelineOptions, SUPPORTED_PROTOCOL_VERSIONS, type SessionIds, TERMINAL_TASK_STATUSES, type Task, type TaskContext, TaskEngine, type TaskEngineOptions, TaskError, type TaskPayload, type TaskResult, type TaskStatus, type TaskStore, type TaskStoreFilter, type WritableLike, agentConfigSchema, aggregateReports, appConfigSchema, authHeaders, buildAgentRegistry, buildChildEnv, buildHello, buildHelloAck, buildPipelineEngine, buildPlanner, buildPlannerContext, buildRoleRegistry, composeTaskText, createAgent, createDefaultChatFn, createMemoryProvider, createProvider, createTaskEngine, decodeMessage, decodeStream, defaultProjectConfigYaml, describeExit, encodeMessage, envelope, expandEnvRefs, extractReportFromText, findConfigFile, isOmniNodeError, isSupportedProtocol, keywords, killTree, loadConfig, logger, newMessageId, parseHello, parsePlanJson, pipelineConfigSchema, pipelineStepConfigSchema, plannerConfigSchema, projectConfigSchema, providerConfigSchema, registryKey, requestJson, requireCompletion, resolveApiKey, resolveEnvPolicy, roleConfigSchema, sanitizeChunk, similar, validateEnvelope, validateWorkingDirectory };
2650
+ export { AgentAdapterRegistry, type AgentConfig, type AgentConfigYaml, type AgentDescriptor, 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 ArtifactKind, type ArtifactPayload, type AskedQuestion, type AuditAction, type AuditEvent, type AuditSink, 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 CwdValidation, DEFAULT_MAX_OUTPUT_BYTES, type DecodeResult, type DiscoveryResult, type EnvPolicy, type EnvelopeMeta, type ExecutionRecord, type ExtractionMeta, FileAuditLog, FilePipelineRunStore, FilePlanStore, FileReportStore, FileTaskStore, type Finding, type FindingSeverity, type FindingSource, type HelloResult, HeuristicPlanner, type HttpRequestOptions, type HttpResponse, type IAgent, type IAgentAdapter, type IChatProvider, type IMemoryProvider, type IPipelineExecutor, type IPlanner, type IProvider, type JsonDocument, JsonFileStore, type JsonFileStoreOptions, type LoadConfigOptions, LocalMemoryProvider, type LogLevel, type LogSink, Logger, type LoggerOptions, MAX_MESSAGE_BYTES, type MemoryContextQuery, type MemoryEntry, MemoryError, type MemoryProviderConfig, type MemoryQuery, type MemoryScope, MemoryService, type MessageEnvelope, type Modality, type ModelCapabilities, type ModelFilter, type ModelInfo, ModelPlanner, ModelRegistry, type ModelStatus, type NodeToAgentMessage, OMNINODE_VERSION, OPENAI_COMPATIBLE_TYPES, type OmniHilbrasConnectionResult, OmniHilbrasProvider, OmniNodeError, type OmniNodeErrorCode, type OmniNodeErrorOptions, OpenAICompatibleProvider, PROTOCOL_V2, type PipelineConfigYaml, type PipelineDefinition, PipelineEngine, type PipelineEngineOptions, PipelineError, type PipelineRun, type PipelineRunAttempt, type PipelineRunFilter, type PipelineRunOptions, type PipelineRunStatus, type PipelineRunStore, type PipelineStep, type PipelineStepCondition, type PipelineStepConfigYaml, type PipelineStepKind, type PipelineStepRun, type Plan, type PlanFilter, type PlanRequest, type PlanStep, type PlanStore, type PlannerConfigYaml, PlannerError, ProcessAgent, ProcessAgentAdapter, type Project, type ProjectConfigYaml, ProjectStores, type ProtocolAgentToNodeType, ProtocolDecoder, type ProtocolEnvelope, ProtocolError, type ProtocolMessageType, type ProtocolNodeToAgentType, ProtocolSession, type ProtocolViolation, type ProtocolViolationCode, type ProviderAuthentication, type ProviderCapability, type ProviderConfig, type ProviderConfigYaml, ProviderError, type ProviderErrorKind, type ProviderHealth, type ProviderStatus, type ProviderType, type QuestionPayload, type QuestionResponder, type RememberaConfig, RememberaMemoryProvider, type Report, type ReportFilter, type ReportPayload, ReportService, type ReportStore, type RoleConfigYaml, type RoleDefinition, RoleRegistry, type RunPipelineOptions, SUPPORTED_PROTOCOL_VERSIONS, type SessionIds, TERMINAL_TASK_STATUSES, type Task, type TaskContext, TaskEngine, type TaskEngineOptions, TaskError, type TaskPayload, type TaskResult, type TaskStatus, type TaskStore, type TaskStoreFilter, type WritableLike, agentConfigSchema, aggregateReports, appConfigSchema, authHeaders, buildAgentRegistry, buildChildEnv, buildHello, buildHelloAck, buildPipelineEngine, buildPlanner, buildPlannerContext, buildRoleRegistry, composeTaskText, createAgent, createDefaultChatFn, createMemoryProvider, createProvider, createTaskEngine, decodeMessage, decodeStream, defaultProjectConfigYaml, describeExit, encodeMessage, envelope, expandEnvRefs, extractMessage, extractReportFromText, findConfigFile, isNetworkError, isOmniNodeError, isRetryable, isSupportedProtocol, isTimeoutError, keywords, killTree, kindFromStatus, loadConfig, logger, newMessageId, parseHello, parsePlanJson, parseRetryAfter, pipelineConfigSchema, pipelineStepConfigSchema, plannerConfigSchema, projectConfigSchema, providerConfigSchema, providerHttpError, providerTransportError, registryKey, requestJson, requireCompletion, resolveApiKey, resolveEnvPolicy, roleConfigSchema, sanitizeChunk, similar, validateEnvelope, validateWorkingDirectory };