@hilbras/omninode 2.0.0-alpha.5 → 2.0.0-alpha.7

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
@@ -296,6 +296,14 @@ interface ChatResponse {
296
296
  * layer so adapters (e.g. planner) never depend on engine modules.
297
297
  */
298
298
  type ChatFn = (model: string, messages: ChatMessage[]) => Promise<string>;
299
+ /** One streamed chunk (SSE deltas from OpenAI-compatible gateways). */
300
+ interface ChatStreamChunk {
301
+ /** Text delta (empty for role-only or final chunks). */
302
+ delta: string;
303
+ /** Provider-reported finish reason, on the final chunk. */
304
+ finishReason?: string;
305
+ raw?: unknown;
306
+ }
299
307
 
300
308
  /**
301
309
  * Memory abstraction. Remembera is the preferred Hilbras integration, but the
@@ -334,14 +342,25 @@ interface ModelCapabilities {
334
342
  embeddings?: boolean;
335
343
  }
336
344
  type ModelStatus = "available" | "unavailable" | "deprecated";
345
+ type Modality = "text" | "image" | "audio" | "video" | "embedding";
346
+ /** Model metadata (roadmap §10, Model Metadata). */
337
347
  interface ModelInfo {
338
348
  /** Name of the provider this model belongs to. */
339
349
  provider: string;
340
350
  /** Provider-specific model identifier, e.g. "qwen3-coder". */
341
351
  id: string;
342
352
  displayName?: string;
353
+ /** Human-readable model name reported by the provider, when available. */
354
+ name?: string;
343
355
  capabilities?: ModelCapabilities;
344
356
  contextWindow?: number;
357
+ inputTypes?: Modality[];
358
+ outputTypes?: Modality[];
359
+ supportsTools?: boolean;
360
+ supportsVision?: boolean;
361
+ supportsReasoning?: boolean;
362
+ supportsStructuredOutput?: boolean;
363
+ supportsStreaming?: boolean;
345
364
  status?: ModelStatus;
346
365
  metadata?: Record<string, unknown>;
347
366
  }
@@ -650,7 +669,20 @@ interface Project {
650
669
 
651
670
  type ProviderType = "openai-compatible" | "omnihilbras" | "openrouter" | "local" | "custom";
652
671
  type ProviderHealth = "unknown" | "healthy" | "degraded" | "unreachable";
672
+ /** Declared provider capabilities (roadmap §10, Provider Interface). */
673
+ type ProviderCapability = "chat" | "models" | "streaming" | "tools" | "embeddings" | "vision";
674
+ /** Normalized authentication description — never contains a secret value. */
675
+ interface ProviderAuthentication {
676
+ /** How the provider authenticates. */
677
+ method: "bearer" | "none" | "custom";
678
+ /** Environment variable that holds the credential, if any. */
679
+ envVar?: string;
680
+ /** True when the referenced variable is currently set. */
681
+ configured: boolean;
682
+ }
653
683
  interface ProviderConfig {
684
+ /** Stable identifier used in records and references (defaults to `name`). */
685
+ providerId?: string;
654
686
  /** Unique name used in project configuration and the model registry. */
655
687
  name: string;
656
688
  type: ProviderType;
@@ -661,6 +693,10 @@ interface ProviderConfig {
661
693
  */
662
694
  apiKeyEnvVar?: string;
663
695
  headers?: Record<string, string>;
696
+ /** Provider-level request timeout in ms (distinct from agent/pipeline budgets). */
697
+ timeoutMs?: number;
698
+ /** Capabilities declared for this provider (discovered ones are merged in). */
699
+ capabilities?: ProviderCapability[];
664
700
  enabled?: boolean;
665
701
  metadata?: Record<string, unknown>;
666
702
  }
@@ -674,17 +710,33 @@ interface ProviderStatus {
674
710
  lastCheckedAt?: string;
675
711
  message?: string;
676
712
  }
677
- /** Contract every provider adapter implements (Phase 1+). */
713
+ /** Contract every provider adapter implements (roadmap §10). */
678
714
  interface IProvider {
679
715
  readonly config: ProviderConfig;
716
+ /** Stable identifier of this provider. */
717
+ readonly providerId: string;
718
+ /** Normalized authentication description (no secret values). */
719
+ readonly authentication: ProviderAuthentication;
720
+ /**
721
+ * Connect: authenticate and discover models (roadmap §10, Model Discovery).
722
+ * Returns the discovered models.
723
+ */
724
+ connect(): Promise<ModelInfo[]>;
680
725
  /** Discover models exposed by this provider. */
681
726
  listModels(): Promise<ModelInfo[]>;
727
+ /** Fetch a single model's metadata (from discovery; re-discovers if unknown). */
728
+ getModel(modelId: string): Promise<ModelInfo | undefined>;
682
729
  /** Check connectivity and authentication. */
683
730
  healthCheck(): Promise<ProviderStatus>;
684
731
  }
685
732
  /** Contract for providers that can run chat completions (foundation for planning). */
686
733
  interface IChatProvider extends IProvider {
687
734
  chat(request: ChatRequest): Promise<ChatResponse>;
735
+ /**
736
+ * Stream a completion where the provider supports it (§11). Chunks are
737
+ * delivered in order; the resolved ChatResponse carries the assembled text.
738
+ */
739
+ stream?(request: ChatRequest, onChunk: (chunk: ChatStreamChunk) => void): Promise<ChatResponse>;
688
740
  }
689
741
 
690
742
  /** Typed error hierarchy shared across the whole codebase (§4.1 — error model). */
@@ -769,6 +821,7 @@ declare const providerConfigSchema: z.ZodObject<{
769
821
  type: z.ZodEnum<["openai-compatible", "omnihilbras", "openrouter", "local", "custom"]>;
770
822
  base_url: z.ZodString;
771
823
  api_key_env_var: z.ZodOptional<z.ZodString>;
824
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
772
825
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
773
826
  enabled: z.ZodOptional<z.ZodBoolean>;
774
827
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -778,6 +831,7 @@ declare const providerConfigSchema: z.ZodObject<{
778
831
  base_url: string;
779
832
  metadata?: Record<string, unknown> | undefined;
780
833
  api_key_env_var?: string | undefined;
834
+ timeout_ms?: number | undefined;
781
835
  headers?: Record<string, string> | undefined;
782
836
  enabled?: boolean | undefined;
783
837
  }, {
@@ -786,6 +840,7 @@ declare const providerConfigSchema: z.ZodObject<{
786
840
  base_url: string;
787
841
  metadata?: Record<string, unknown> | undefined;
788
842
  api_key_env_var?: string | undefined;
843
+ timeout_ms?: number | undefined;
789
844
  headers?: Record<string, string> | undefined;
790
845
  enabled?: boolean | undefined;
791
846
  }>;
@@ -811,11 +866,11 @@ declare const agentConfigSchema: z.ZodObject<{
811
866
  type: "native" | "process" | "cli";
812
867
  input_mode: "protocol" | "stdin" | "arg";
813
868
  metadata?: Record<string, unknown> | undefined;
869
+ timeout_ms?: number | undefined;
814
870
  command?: string | undefined;
815
871
  args?: string[] | undefined;
816
872
  cwd?: string | undefined;
817
873
  env?: Record<string, string> | undefined;
818
- timeout_ms?: number | undefined;
819
874
  inherit_env?: boolean | undefined;
820
875
  env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
821
876
  env_allowlist?: string[] | undefined;
@@ -826,12 +881,12 @@ declare const agentConfigSchema: z.ZodObject<{
826
881
  name: string;
827
882
  metadata?: Record<string, unknown> | undefined;
828
883
  type?: "native" | "process" | "cli" | undefined;
884
+ timeout_ms?: number | undefined;
829
885
  command?: string | undefined;
830
886
  args?: string[] | undefined;
831
887
  cwd?: string | undefined;
832
888
  env?: Record<string, string> | undefined;
833
889
  input_mode?: "protocol" | "stdin" | "arg" | undefined;
834
- timeout_ms?: number | undefined;
835
890
  inherit_env?: boolean | undefined;
836
891
  env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
837
892
  env_allowlist?: string[] | undefined;
@@ -979,6 +1034,7 @@ declare const projectConfigSchema: z.ZodObject<{
979
1034
  type: z.ZodEnum<["openai-compatible", "omnihilbras", "openrouter", "local", "custom"]>;
980
1035
  base_url: z.ZodString;
981
1036
  api_key_env_var: z.ZodOptional<z.ZodString>;
1037
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
982
1038
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
983
1039
  enabled: z.ZodOptional<z.ZodBoolean>;
984
1040
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -988,6 +1044,7 @@ declare const projectConfigSchema: z.ZodObject<{
988
1044
  base_url: string;
989
1045
  metadata?: Record<string, unknown> | undefined;
990
1046
  api_key_env_var?: string | undefined;
1047
+ timeout_ms?: number | undefined;
991
1048
  headers?: Record<string, string> | undefined;
992
1049
  enabled?: boolean | undefined;
993
1050
  }, {
@@ -996,6 +1053,7 @@ declare const projectConfigSchema: z.ZodObject<{
996
1053
  base_url: string;
997
1054
  metadata?: Record<string, unknown> | undefined;
998
1055
  api_key_env_var?: string | undefined;
1056
+ timeout_ms?: number | undefined;
999
1057
  headers?: Record<string, string> | undefined;
1000
1058
  enabled?: boolean | undefined;
1001
1059
  }>, "many">>;
@@ -1021,11 +1079,11 @@ declare const projectConfigSchema: z.ZodObject<{
1021
1079
  type: "native" | "process" | "cli";
1022
1080
  input_mode: "protocol" | "stdin" | "arg";
1023
1081
  metadata?: Record<string, unknown> | undefined;
1082
+ timeout_ms?: number | undefined;
1024
1083
  command?: string | undefined;
1025
1084
  args?: string[] | undefined;
1026
1085
  cwd?: string | undefined;
1027
1086
  env?: Record<string, string> | undefined;
1028
- timeout_ms?: number | undefined;
1029
1087
  inherit_env?: boolean | undefined;
1030
1088
  env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
1031
1089
  env_allowlist?: string[] | undefined;
@@ -1036,12 +1094,12 @@ declare const projectConfigSchema: z.ZodObject<{
1036
1094
  name: string;
1037
1095
  metadata?: Record<string, unknown> | undefined;
1038
1096
  type?: "native" | "process" | "cli" | undefined;
1097
+ timeout_ms?: number | undefined;
1039
1098
  command?: string | undefined;
1040
1099
  args?: string[] | undefined;
1041
1100
  cwd?: string | undefined;
1042
1101
  env?: Record<string, string> | undefined;
1043
1102
  input_mode?: "protocol" | "stdin" | "arg" | undefined;
1044
- timeout_ms?: number | undefined;
1045
1103
  inherit_env?: boolean | undefined;
1046
1104
  env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
1047
1105
  env_allowlist?: string[] | undefined;
@@ -1158,13 +1216,16 @@ declare const projectConfigSchema: z.ZodObject<{
1158
1216
  provider: z.ZodDefault<z.ZodString>;
1159
1217
  base_url: z.ZodOptional<z.ZodString>;
1160
1218
  api_key_env_var: z.ZodOptional<z.ZodString>;
1219
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
1161
1220
  }, "strict", z.ZodTypeAny, {
1162
1221
  provider: string;
1163
1222
  base_url?: string | undefined;
1164
1223
  api_key_env_var?: string | undefined;
1224
+ timeout_ms?: number | undefined;
1165
1225
  }, {
1166
1226
  base_url?: string | undefined;
1167
1227
  api_key_env_var?: string | undefined;
1228
+ timeout_ms?: number | undefined;
1168
1229
  provider?: string | undefined;
1169
1230
  }>>;
1170
1231
  }, "strict", z.ZodTypeAny, {
@@ -1174,11 +1235,11 @@ declare const projectConfigSchema: z.ZodObject<{
1174
1235
  type: "native" | "process" | "cli";
1175
1236
  input_mode: "protocol" | "stdin" | "arg";
1176
1237
  metadata?: Record<string, unknown> | undefined;
1238
+ timeout_ms?: number | undefined;
1177
1239
  command?: string | undefined;
1178
1240
  args?: string[] | undefined;
1179
1241
  cwd?: string | undefined;
1180
1242
  env?: Record<string, string> | undefined;
1181
- timeout_ms?: number | undefined;
1182
1243
  inherit_env?: boolean | undefined;
1183
1244
  env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
1184
1245
  env_allowlist?: string[] | undefined;
@@ -1192,6 +1253,7 @@ declare const projectConfigSchema: z.ZodObject<{
1192
1253
  base_url: string;
1193
1254
  metadata?: Record<string, unknown> | undefined;
1194
1255
  api_key_env_var?: string | undefined;
1256
+ timeout_ms?: number | undefined;
1195
1257
  headers?: Record<string, string> | undefined;
1196
1258
  enabled?: boolean | undefined;
1197
1259
  }[];
@@ -1230,6 +1292,7 @@ declare const projectConfigSchema: z.ZodObject<{
1230
1292
  provider: string;
1231
1293
  base_url?: string | undefined;
1232
1294
  api_key_env_var?: string | undefined;
1295
+ timeout_ms?: number | undefined;
1233
1296
  } | undefined;
1234
1297
  }, {
1235
1298
  name: string;
@@ -1237,12 +1300,12 @@ declare const projectConfigSchema: z.ZodObject<{
1237
1300
  name: string;
1238
1301
  metadata?: Record<string, unknown> | undefined;
1239
1302
  type?: "native" | "process" | "cli" | undefined;
1303
+ timeout_ms?: number | undefined;
1240
1304
  command?: string | undefined;
1241
1305
  args?: string[] | undefined;
1242
1306
  cwd?: string | undefined;
1243
1307
  env?: Record<string, string> | undefined;
1244
1308
  input_mode?: "protocol" | "stdin" | "arg" | undefined;
1245
- timeout_ms?: number | undefined;
1246
1309
  inherit_env?: boolean | undefined;
1247
1310
  env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
1248
1311
  env_allowlist?: string[] | undefined;
@@ -1256,6 +1319,7 @@ declare const projectConfigSchema: z.ZodObject<{
1256
1319
  base_url: string;
1257
1320
  metadata?: Record<string, unknown> | undefined;
1258
1321
  api_key_env_var?: string | undefined;
1322
+ timeout_ms?: number | undefined;
1259
1323
  headers?: Record<string, string> | undefined;
1260
1324
  enabled?: boolean | undefined;
1261
1325
  }[] | undefined;
@@ -1293,6 +1357,7 @@ declare const projectConfigSchema: z.ZodObject<{
1293
1357
  memory?: {
1294
1358
  base_url?: string | undefined;
1295
1359
  api_key_env_var?: string | undefined;
1360
+ timeout_ms?: number | undefined;
1296
1361
  provider?: string | undefined;
1297
1362
  } | undefined;
1298
1363
  }>;
@@ -1304,6 +1369,7 @@ declare const appConfigSchema: z.ZodObject<{
1304
1369
  type: z.ZodEnum<["openai-compatible", "omnihilbras", "openrouter", "local", "custom"]>;
1305
1370
  base_url: z.ZodString;
1306
1371
  api_key_env_var: z.ZodOptional<z.ZodString>;
1372
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
1307
1373
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1308
1374
  enabled: z.ZodOptional<z.ZodBoolean>;
1309
1375
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -1313,6 +1379,7 @@ declare const appConfigSchema: z.ZodObject<{
1313
1379
  base_url: string;
1314
1380
  metadata?: Record<string, unknown> | undefined;
1315
1381
  api_key_env_var?: string | undefined;
1382
+ timeout_ms?: number | undefined;
1316
1383
  headers?: Record<string, string> | undefined;
1317
1384
  enabled?: boolean | undefined;
1318
1385
  }, {
@@ -1321,6 +1388,7 @@ declare const appConfigSchema: z.ZodObject<{
1321
1388
  base_url: string;
1322
1389
  metadata?: Record<string, unknown> | undefined;
1323
1390
  api_key_env_var?: string | undefined;
1391
+ timeout_ms?: number | undefined;
1324
1392
  headers?: Record<string, string> | undefined;
1325
1393
  enabled?: boolean | undefined;
1326
1394
  }>, "many">>;
@@ -1346,11 +1414,11 @@ declare const appConfigSchema: z.ZodObject<{
1346
1414
  type: "native" | "process" | "cli";
1347
1415
  input_mode: "protocol" | "stdin" | "arg";
1348
1416
  metadata?: Record<string, unknown> | undefined;
1417
+ timeout_ms?: number | undefined;
1349
1418
  command?: string | undefined;
1350
1419
  args?: string[] | undefined;
1351
1420
  cwd?: string | undefined;
1352
1421
  env?: Record<string, string> | undefined;
1353
- timeout_ms?: number | undefined;
1354
1422
  inherit_env?: boolean | undefined;
1355
1423
  env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
1356
1424
  env_allowlist?: string[] | undefined;
@@ -1361,12 +1429,12 @@ declare const appConfigSchema: z.ZodObject<{
1361
1429
  name: string;
1362
1430
  metadata?: Record<string, unknown> | undefined;
1363
1431
  type?: "native" | "process" | "cli" | undefined;
1432
+ timeout_ms?: number | undefined;
1364
1433
  command?: string | undefined;
1365
1434
  args?: string[] | undefined;
1366
1435
  cwd?: string | undefined;
1367
1436
  env?: Record<string, string> | undefined;
1368
1437
  input_mode?: "protocol" | "stdin" | "arg" | undefined;
1369
- timeout_ms?: number | undefined;
1370
1438
  inherit_env?: boolean | undefined;
1371
1439
  env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
1372
1440
  env_allowlist?: string[] | undefined;
@@ -1483,13 +1551,16 @@ declare const appConfigSchema: z.ZodObject<{
1483
1551
  provider: z.ZodDefault<z.ZodString>;
1484
1552
  base_url: z.ZodOptional<z.ZodString>;
1485
1553
  api_key_env_var: z.ZodOptional<z.ZodString>;
1554
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
1486
1555
  }, "strict", z.ZodTypeAny, {
1487
1556
  provider: string;
1488
1557
  base_url?: string | undefined;
1489
1558
  api_key_env_var?: string | undefined;
1559
+ timeout_ms?: number | undefined;
1490
1560
  }, {
1491
1561
  base_url?: string | undefined;
1492
1562
  api_key_env_var?: string | undefined;
1563
+ timeout_ms?: number | undefined;
1493
1564
  provider?: string | undefined;
1494
1565
  }>>;
1495
1566
  }, "strict", z.ZodTypeAny, {
@@ -1499,11 +1570,11 @@ declare const appConfigSchema: z.ZodObject<{
1499
1570
  type: "native" | "process" | "cli";
1500
1571
  input_mode: "protocol" | "stdin" | "arg";
1501
1572
  metadata?: Record<string, unknown> | undefined;
1573
+ timeout_ms?: number | undefined;
1502
1574
  command?: string | undefined;
1503
1575
  args?: string[] | undefined;
1504
1576
  cwd?: string | undefined;
1505
1577
  env?: Record<string, string> | undefined;
1506
- timeout_ms?: number | undefined;
1507
1578
  inherit_env?: boolean | undefined;
1508
1579
  env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
1509
1580
  env_allowlist?: string[] | undefined;
@@ -1517,6 +1588,7 @@ declare const appConfigSchema: z.ZodObject<{
1517
1588
  base_url: string;
1518
1589
  metadata?: Record<string, unknown> | undefined;
1519
1590
  api_key_env_var?: string | undefined;
1591
+ timeout_ms?: number | undefined;
1520
1592
  headers?: Record<string, string> | undefined;
1521
1593
  enabled?: boolean | undefined;
1522
1594
  }[];
@@ -1555,6 +1627,7 @@ declare const appConfigSchema: z.ZodObject<{
1555
1627
  provider: string;
1556
1628
  base_url?: string | undefined;
1557
1629
  api_key_env_var?: string | undefined;
1630
+ timeout_ms?: number | undefined;
1558
1631
  } | undefined;
1559
1632
  }, {
1560
1633
  name: string;
@@ -1562,12 +1635,12 @@ declare const appConfigSchema: z.ZodObject<{
1562
1635
  name: string;
1563
1636
  metadata?: Record<string, unknown> | undefined;
1564
1637
  type?: "native" | "process" | "cli" | undefined;
1638
+ timeout_ms?: number | undefined;
1565
1639
  command?: string | undefined;
1566
1640
  args?: string[] | undefined;
1567
1641
  cwd?: string | undefined;
1568
1642
  env?: Record<string, string> | undefined;
1569
1643
  input_mode?: "protocol" | "stdin" | "arg" | undefined;
1570
- timeout_ms?: number | undefined;
1571
1644
  inherit_env?: boolean | undefined;
1572
1645
  env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
1573
1646
  env_allowlist?: string[] | undefined;
@@ -1581,6 +1654,7 @@ declare const appConfigSchema: z.ZodObject<{
1581
1654
  base_url: string;
1582
1655
  metadata?: Record<string, unknown> | undefined;
1583
1656
  api_key_env_var?: string | undefined;
1657
+ timeout_ms?: number | undefined;
1584
1658
  headers?: Record<string, string> | undefined;
1585
1659
  enabled?: boolean | undefined;
1586
1660
  }[] | undefined;
@@ -1618,6 +1692,7 @@ declare const appConfigSchema: z.ZodObject<{
1618
1692
  memory?: {
1619
1693
  base_url?: string | undefined;
1620
1694
  api_key_env_var?: string | undefined;
1695
+ timeout_ms?: number | undefined;
1621
1696
  provider?: string | undefined;
1622
1697
  } | undefined;
1623
1698
  }>;
@@ -1636,11 +1711,11 @@ declare const appConfigSchema: z.ZodObject<{
1636
1711
  type: "native" | "process" | "cli";
1637
1712
  input_mode: "protocol" | "stdin" | "arg";
1638
1713
  metadata?: Record<string, unknown> | undefined;
1714
+ timeout_ms?: number | undefined;
1639
1715
  command?: string | undefined;
1640
1716
  args?: string[] | undefined;
1641
1717
  cwd?: string | undefined;
1642
1718
  env?: Record<string, string> | undefined;
1643
- timeout_ms?: number | undefined;
1644
1719
  inherit_env?: boolean | undefined;
1645
1720
  env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
1646
1721
  env_allowlist?: string[] | undefined;
@@ -1654,6 +1729,7 @@ declare const appConfigSchema: z.ZodObject<{
1654
1729
  base_url: string;
1655
1730
  metadata?: Record<string, unknown> | undefined;
1656
1731
  api_key_env_var?: string | undefined;
1732
+ timeout_ms?: number | undefined;
1657
1733
  headers?: Record<string, string> | undefined;
1658
1734
  enabled?: boolean | undefined;
1659
1735
  }[];
@@ -1692,6 +1768,7 @@ declare const appConfigSchema: z.ZodObject<{
1692
1768
  provider: string;
1693
1769
  base_url?: string | undefined;
1694
1770
  api_key_env_var?: string | undefined;
1771
+ timeout_ms?: number | undefined;
1695
1772
  } | undefined;
1696
1773
  };
1697
1774
  logging?: {
@@ -1704,12 +1781,12 @@ declare const appConfigSchema: z.ZodObject<{
1704
1781
  name: string;
1705
1782
  metadata?: Record<string, unknown> | undefined;
1706
1783
  type?: "native" | "process" | "cli" | undefined;
1784
+ timeout_ms?: number | undefined;
1707
1785
  command?: string | undefined;
1708
1786
  args?: string[] | undefined;
1709
1787
  cwd?: string | undefined;
1710
1788
  env?: Record<string, string> | undefined;
1711
1789
  input_mode?: "protocol" | "stdin" | "arg" | undefined;
1712
- timeout_ms?: number | undefined;
1713
1790
  inherit_env?: boolean | undefined;
1714
1791
  env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
1715
1792
  env_allowlist?: string[] | undefined;
@@ -1723,6 +1800,7 @@ declare const appConfigSchema: z.ZodObject<{
1723
1800
  base_url: string;
1724
1801
  metadata?: Record<string, unknown> | undefined;
1725
1802
  api_key_env_var?: string | undefined;
1803
+ timeout_ms?: number | undefined;
1726
1804
  headers?: Record<string, string> | undefined;
1727
1805
  enabled?: boolean | undefined;
1728
1806
  }[] | undefined;
@@ -1760,6 +1838,7 @@ declare const appConfigSchema: z.ZodObject<{
1760
1838
  memory?: {
1761
1839
  base_url?: string | undefined;
1762
1840
  api_key_env_var?: string | undefined;
1841
+ timeout_ms?: number | undefined;
1763
1842
  provider?: string | undefined;
1764
1843
  } | undefined;
1765
1844
  };
@@ -1842,11 +1921,63 @@ declare function requestJson(url: string, options?: HttpRequestOptions): Promise
1842
1921
  declare const OPENAI_COMPATIBLE_TYPES: readonly ProviderType[];
1843
1922
  declare function createProvider(config: ProviderConfig): IChatProvider;
1844
1923
 
1924
+ /**
1925
+ * Provider error normalization (roadmap §10).
1926
+ *
1927
+ * Every provider failure is mapped to one stable kind, so callers can react
1928
+ * (retry a rate limit, surface an auth problem, treat a missing model
1929
+ * differently) without string-matching provider-specific payloads.
1930
+ */
1931
+
1932
+ type ProviderErrorKind = "AUTHENTICATION_ERROR" | "RATE_LIMIT_ERROR" | "INVALID_REQUEST" | "MODEL_NOT_FOUND" | "TIMEOUT" | "NETWORK_ERROR" | "SERVER_ERROR" | "UNKNOWN_ERROR";
1933
+ interface ProviderErrorContext {
1934
+ provider: string;
1935
+ operation: string;
1936
+ status?: number;
1937
+ body?: unknown;
1938
+ retryAfterMs?: number;
1939
+ cause?: unknown;
1940
+ /** Maps the normalized kind onto the legacy stable error code. */
1941
+ code?: "PROVIDER_UNAVAILABLE" | "PROVIDER_AUTH_FAILED" | "MODEL_NOT_FOUND";
1942
+ }
1943
+ /** Kinds worth retrying automatically (rate limits and transient server errors). */
1944
+ declare function isRetryable(kind: ProviderErrorKind): boolean;
1945
+ /** Maps an HTTP status (and optional body) to a normalized kind. */
1946
+ declare function kindFromStatus(status: number): ProviderErrorKind;
1947
+ /** Extracts a human message from common provider error body shapes. */
1948
+ declare function extractMessage(body: unknown): string | undefined;
1949
+ /** Parses `Retry-After` (seconds or HTTP-date) into milliseconds. */
1950
+ declare function parseRetryAfter(value: string | null | undefined, now?: number): number | undefined;
1951
+ /** True for the abort/timeout errors raised by fetch's AbortSignal.timeout. */
1952
+ declare function isTimeoutError(error: unknown): boolean;
1953
+ /** True for transport failures (DNS, refused, TLS, offline). */
1954
+ declare function isNetworkError(error: unknown): boolean;
1955
+ declare function providerHttpError(context: ProviderErrorContext): ProviderError;
1956
+ /** Wraps a thrown transport/abort error into a normalized ProviderError. */
1957
+ declare function providerTransportError(context: Omit<ProviderErrorContext, "status" | "body">): ProviderError;
1958
+
1845
1959
  declare class OpenAICompatibleProvider implements IChatProvider {
1846
1960
  readonly config: ProviderConfig;
1961
+ readonly providerId: string;
1962
+ readonly authentication: ProviderAuthentication;
1847
1963
  private readonly log;
1848
- constructor(config: ProviderConfig, log?: Logger);
1964
+ /** Discovered models, so getModel() answers without another round-trip. */
1965
+ private discovered?;
1966
+ private readonly env;
1967
+ constructor(config: ProviderConfig, log?: Logger, env?: Record<string, string | undefined>);
1968
+ /** Provider-level request timeout (roadmap §6.6/§11) with the shared default. */
1969
+ private get requestTimeoutMs();
1970
+ /** Authenticate + discover (roadmap §10, Model Discovery). */
1971
+ connect(): Promise<ModelInfo[]>;
1972
+ getModel(modelId: string): Promise<ModelInfo | undefined>;
1973
+ /** Raw /models body (protected so adapters can capture gateway-level metadata). */
1974
+ protected rawModelsResponse(): Promise<unknown>;
1975
+ private modelsRequest;
1849
1976
  listModels(): Promise<ModelInfo[]>;
1977
+ /** Maps a raw model entry onto the normalized metadata shape (§10). */
1978
+ private toModelInfo;
1979
+ /** Streaming where the gateway supports it (§11). */
1980
+ stream(request: ChatRequest, onChunk: (chunk: ChatStreamChunk) => void): Promise<ChatResponse>;
1850
1981
  healthCheck(): Promise<ProviderStatus>;
1851
1982
  chat(request: ChatRequest): Promise<ChatResponse>;
1852
1983
  }
@@ -1889,11 +2020,19 @@ interface OmniHilbrasConnectionResult {
1889
2020
  registered: number;
1890
2021
  }
1891
2022
  declare class OmniHilbrasProvider extends OpenAICompatibleProvider {
2023
+ private gateway?;
2024
+ listModels(): Promise<ModelInfo[]>;
1892
2025
  /**
1893
2026
  * Run the full connect flow. Throws on authentication or transport failure
1894
2027
  * (use healthCheck() for a non-throwing probe).
1895
2028
  */
1896
- connect(registry?: ModelRegistry): Promise<OmniHilbrasConnectionResult>;
2029
+ /**
2030
+ * Gateway metadata reported alongside the model list (gateway version, tier,
2031
+ * region…), kept separate from per-model metadata (§11 — provider metadata).
2032
+ */
2033
+ gatewayMetadata(): Record<string, unknown> | undefined;
2034
+ protected extractGatewayMetadata(body: unknown): Promise<void>;
2035
+ connectAndRegister(registry?: ModelRegistry): Promise<OmniHilbrasConnectionResult>;
1897
2036
  }
1898
2037
 
1899
2038
  /**
@@ -2563,6 +2702,6 @@ declare class ProjectStores {
2563
2702
  constructor(directory?: string);
2564
2703
  }
2565
2704
 
2566
- declare const OMNINODE_VERSION = "2.0.0-alpha.5";
2705
+ declare const OMNINODE_VERSION = "2.0.0-alpha.7";
2567
2706
 
2568
- 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 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 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 };
2707
+ 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 ChatStreamChunk, 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 };