@hilbras/omninode 2.0.0-alpha.2 → 2.0.0-alpha.3

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
@@ -65,6 +65,99 @@ interface CombinedReport {
65
65
  metadata?: Record<string, unknown>;
66
66
  }
67
67
 
68
+ /**
69
+ * OmniNode Agent Protocol v2 — message model (roadmap §7.2–§7.4, §7.7).
70
+ *
71
+ * Every message is a JSON line carrying a `ProtocolEnvelope`. All ids are
72
+ * optional for inbound tolerance but OmniNode always emits them, so every
73
+ * message is traceable to agent / task / pipeline / execution / request.
74
+ */
75
+
76
+ /** Messages OmniNode sends to an agent. */
77
+ type ProtocolNodeToAgentType = "TASK" | "HELLO_ACK" | "CONTEXT" | "INSTRUCTION" | "RESPONSE" | "CANCEL";
78
+ /** Messages an agent sends to OmniNode. */
79
+ type ProtocolAgentToNodeType = "HELLO" | "TASK_REQUEST" | "TASK_ACCEPTED" | "TASK_STARTED" | "STATUS" | "QUESTION" | "REPORT" | "ARTIFACT" | "COMPLETION" | "ERROR" | "CANCELLED";
80
+ type ProtocolMessageType = ProtocolNodeToAgentType | ProtocolAgentToNodeType;
81
+ interface ProtocolEnvelope<T extends ProtocolMessageType = ProtocolMessageType> {
82
+ /** `omninode-agent-protocol/2`. Inbound messages without it are treated as v1. */
83
+ protocol: string;
84
+ /** Unique id of this message. */
85
+ messageId: string;
86
+ /** Id of the request/thread this message belongs to. */
87
+ requestId?: string;
88
+ taskId?: string;
89
+ agentId?: string;
90
+ pipelineId?: string;
91
+ /** Execution identity (roadmap §6.5) — ties the message to one attempt. */
92
+ executionId?: string;
93
+ timestamp: string;
94
+ type: T;
95
+ payload: unknown;
96
+ metadata?: Record<string, unknown>;
97
+ }
98
+ /** Standard artifact kinds (roadmap §7.7). */
99
+ type ArtifactKind = "file" | "patch" | "report" | "log" | "screenshot" | "document" | "data";
100
+ interface ArtifactPayload {
101
+ kind: ArtifactKind;
102
+ /** Path, URL or logical name. */
103
+ ref: string;
104
+ description?: string;
105
+ mediaType?: string;
106
+ bytes?: number;
107
+ metadata?: Record<string, unknown>;
108
+ }
109
+ interface QuestionPayload {
110
+ /** Question id to answer. */
111
+ questionId: string;
112
+ question: string;
113
+ /** What kind of answer is expected (free text, file path, options…). */
114
+ expected?: "text" | "path" | "choice";
115
+ options?: string[];
116
+ }
117
+ interface TaskPayload {
118
+ taskId: string;
119
+ objective: string;
120
+ }
121
+ interface ReportPayload {
122
+ report: Report | Report[];
123
+ }
124
+ /** A question an agent asked during a run, with the answer OmniNode gave (if any). */
125
+ interface AskedQuestion {
126
+ questionId: string;
127
+ question: string;
128
+ answer?: string;
129
+ }
130
+ declare function newMessageId(prefix?: string): string;
131
+ /** Builds a v2 envelope with ids and timestamp filled in. */
132
+ declare function envelope<T extends ProtocolMessageType>(type: T, payload: unknown, ids?: {
133
+ requestId?: string;
134
+ taskId?: string;
135
+ agentId?: string;
136
+ pipelineId?: string;
137
+ executionId?: string;
138
+ metadata?: Record<string, unknown>;
139
+ }): ProtocolEnvelope<T>;
140
+
141
+ interface AgentDescriptor {
142
+ /** Protocol the agent speaks. */
143
+ protocol: string;
144
+ name: string;
145
+ version?: string;
146
+ capabilities: string[];
147
+ /** Message types the agent can emit. */
148
+ supports: string[];
149
+ }
150
+ type HelloResult = {
151
+ ok: true;
152
+ descriptor: AgentDescriptor;
153
+ } | {
154
+ ok: false;
155
+ reason: string;
156
+ };
157
+ declare function parseHello(envelopeValue: ProtocolEnvelope): HelloResult;
158
+ declare function buildHello(descriptor: Omit<AgentDescriptor, "protocol">): ProtocolEnvelope<"HELLO">;
159
+ declare function buildHelloAck(descriptor: AgentDescriptor): ProtocolEnvelope<"HELLO_ACK">;
160
+
68
161
  /** Role system: what an AI is supposed to do, independent of any provider (§11). */
69
162
  interface RoleDefinition {
70
163
  /** Slug identifier, e.g. "architecture-reviewer". */
@@ -117,6 +210,10 @@ interface AgentInfo {
117
210
  interface AgentTaskInput {
118
211
  taskId: string;
119
212
  objective: string;
213
+ /** Pipeline run that owns this task (protocol correlation, §7.4). */
214
+ pipelineId?: string;
215
+ /** Execution identity for this attempt (protocol correlation, §7.4). */
216
+ executionId?: string;
120
217
  role?: RoleDefinition;
121
218
  /** Assembled task context (project, memory, files) already selected for this agent. */
122
219
  context?: string;
@@ -132,6 +229,14 @@ interface AgentTaskOutput {
132
229
  logs?: string[];
133
230
  /** Structured reports extracted from protocol-mode runs (§16, §21). */
134
231
  reports?: Report[];
232
+ /** Protocol diagnostics for protocol-mode runs (roadmap §7): questions asked, violations seen. */
233
+ protocol?: {
234
+ protocol: string;
235
+ legacy: boolean;
236
+ descriptor?: AgentDescriptor;
237
+ questions: AskedQuestion[];
238
+ violations: string[];
239
+ };
135
240
  error?: string;
136
241
  }
137
242
  /** Contract every agent adapter implements (Phase 3+). */
@@ -616,18 +721,18 @@ declare const providerConfigSchema: z.ZodObject<{
616
721
  name: string;
617
722
  type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
618
723
  base_url: string;
724
+ metadata?: Record<string, unknown> | undefined;
619
725
  api_key_env_var?: string | undefined;
620
726
  headers?: Record<string, string> | undefined;
621
727
  enabled?: boolean | undefined;
622
- metadata?: Record<string, unknown> | undefined;
623
728
  }, {
624
729
  name: string;
625
730
  type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
626
731
  base_url: string;
732
+ metadata?: Record<string, unknown> | undefined;
627
733
  api_key_env_var?: string | undefined;
628
734
  headers?: Record<string, string> | undefined;
629
735
  enabled?: boolean | undefined;
630
- metadata?: Record<string, unknown> | undefined;
631
736
  }>;
632
737
  declare const agentConfigSchema: z.ZodObject<{
633
738
  name: z.ZodString;
@@ -644,7 +749,7 @@ declare const agentConfigSchema: z.ZodObject<{
644
749
  }, "strict", z.ZodTypeAny, {
645
750
  name: string;
646
751
  type: "native" | "process" | "cli";
647
- input_mode: "stdin" | "arg" | "protocol";
752
+ input_mode: "protocol" | "stdin" | "arg";
648
753
  metadata?: Record<string, unknown> | undefined;
649
754
  command?: string | undefined;
650
755
  args?: string[] | undefined;
@@ -654,13 +759,13 @@ declare const agentConfigSchema: z.ZodObject<{
654
759
  inherit_env?: boolean | undefined;
655
760
  }, {
656
761
  name: string;
657
- type?: "native" | "process" | "cli" | undefined;
658
762
  metadata?: Record<string, unknown> | undefined;
763
+ type?: "native" | "process" | "cli" | undefined;
659
764
  command?: string | undefined;
660
765
  args?: string[] | undefined;
661
766
  cwd?: string | undefined;
662
767
  env?: Record<string, string> | undefined;
663
- input_mode?: "stdin" | "arg" | "protocol" | undefined;
768
+ input_mode?: "protocol" | "stdin" | "arg" | undefined;
664
769
  timeout_ms?: number | undefined;
665
770
  inherit_env?: boolean | undefined;
666
771
  }>;
@@ -765,8 +870,8 @@ declare const pipelineConfigSchema: z.ZodObject<{
765
870
  retries?: number | undefined;
766
871
  condition?: "always" | "on-success" | "on-failure" | undefined;
767
872
  }[];
768
- role?: string | undefined;
769
873
  name?: string | undefined;
874
+ role?: string | undefined;
770
875
  objective?: string | undefined;
771
876
  }, {
772
877
  id: string;
@@ -780,8 +885,8 @@ declare const pipelineConfigSchema: z.ZodObject<{
780
885
  retries?: number | undefined;
781
886
  condition?: "always" | "on-success" | "on-failure" | undefined;
782
887
  }[];
783
- role?: string | undefined;
784
888
  name?: string | undefined;
889
+ role?: string | undefined;
785
890
  objective?: string | undefined;
786
891
  }>;
787
892
  declare const plannerConfigSchema: z.ZodObject<{
@@ -811,18 +916,18 @@ declare const projectConfigSchema: z.ZodObject<{
811
916
  name: string;
812
917
  type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
813
918
  base_url: string;
919
+ metadata?: Record<string, unknown> | undefined;
814
920
  api_key_env_var?: string | undefined;
815
921
  headers?: Record<string, string> | undefined;
816
922
  enabled?: boolean | undefined;
817
- metadata?: Record<string, unknown> | undefined;
818
923
  }, {
819
924
  name: string;
820
925
  type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
821
926
  base_url: string;
927
+ metadata?: Record<string, unknown> | undefined;
822
928
  api_key_env_var?: string | undefined;
823
929
  headers?: Record<string, string> | undefined;
824
930
  enabled?: boolean | undefined;
825
- metadata?: Record<string, unknown> | undefined;
826
931
  }>, "many">>;
827
932
  agents: z.ZodDefault<z.ZodArray<z.ZodObject<{
828
933
  name: z.ZodString;
@@ -839,7 +944,7 @@ declare const projectConfigSchema: z.ZodObject<{
839
944
  }, "strict", z.ZodTypeAny, {
840
945
  name: string;
841
946
  type: "native" | "process" | "cli";
842
- input_mode: "stdin" | "arg" | "protocol";
947
+ input_mode: "protocol" | "stdin" | "arg";
843
948
  metadata?: Record<string, unknown> | undefined;
844
949
  command?: string | undefined;
845
950
  args?: string[] | undefined;
@@ -849,13 +954,13 @@ declare const projectConfigSchema: z.ZodObject<{
849
954
  inherit_env?: boolean | undefined;
850
955
  }, {
851
956
  name: string;
852
- type?: "native" | "process" | "cli" | undefined;
853
957
  metadata?: Record<string, unknown> | undefined;
958
+ type?: "native" | "process" | "cli" | undefined;
854
959
  command?: string | undefined;
855
960
  args?: string[] | undefined;
856
961
  cwd?: string | undefined;
857
962
  env?: Record<string, string> | undefined;
858
- input_mode?: "stdin" | "arg" | "protocol" | undefined;
963
+ input_mode?: "protocol" | "stdin" | "arg" | undefined;
859
964
  timeout_ms?: number | undefined;
860
965
  inherit_env?: boolean | undefined;
861
966
  }>, "many">>;
@@ -932,8 +1037,8 @@ declare const projectConfigSchema: z.ZodObject<{
932
1037
  retries?: number | undefined;
933
1038
  condition?: "always" | "on-success" | "on-failure" | undefined;
934
1039
  }[];
935
- role?: string | undefined;
936
1040
  name?: string | undefined;
1041
+ role?: string | undefined;
937
1042
  objective?: string | undefined;
938
1043
  }, {
939
1044
  id: string;
@@ -947,8 +1052,8 @@ declare const projectConfigSchema: z.ZodObject<{
947
1052
  retries?: number | undefined;
948
1053
  condition?: "always" | "on-success" | "on-failure" | undefined;
949
1054
  }[];
950
- role?: string | undefined;
951
1055
  name?: string | undefined;
1056
+ role?: string | undefined;
952
1057
  objective?: string | undefined;
953
1058
  }>, "many">>;
954
1059
  planner: z.ZodOptional<z.ZodObject<{
@@ -982,7 +1087,7 @@ declare const projectConfigSchema: z.ZodObject<{
982
1087
  agents: {
983
1088
  name: string;
984
1089
  type: "native" | "process" | "cli";
985
- input_mode: "stdin" | "arg" | "protocol";
1090
+ input_mode: "protocol" | "stdin" | "arg";
986
1091
  metadata?: Record<string, unknown> | undefined;
987
1092
  command?: string | undefined;
988
1093
  args?: string[] | undefined;
@@ -995,10 +1100,10 @@ declare const projectConfigSchema: z.ZodObject<{
995
1100
  name: string;
996
1101
  type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
997
1102
  base_url: string;
1103
+ metadata?: Record<string, unknown> | undefined;
998
1104
  api_key_env_var?: string | undefined;
999
1105
  headers?: Record<string, string> | undefined;
1000
1106
  enabled?: boolean | undefined;
1001
- metadata?: Record<string, unknown> | undefined;
1002
1107
  }[];
1003
1108
  roles: {
1004
1109
  name: string;
@@ -1022,8 +1127,8 @@ declare const projectConfigSchema: z.ZodObject<{
1022
1127
  retries?: number | undefined;
1023
1128
  condition?: "always" | "on-success" | "on-failure" | undefined;
1024
1129
  }[];
1025
- role?: string | undefined;
1026
1130
  name?: string | undefined;
1131
+ role?: string | undefined;
1027
1132
  objective?: string | undefined;
1028
1133
  }[];
1029
1134
  planner?: {
@@ -1040,13 +1145,13 @@ declare const projectConfigSchema: z.ZodObject<{
1040
1145
  name: string;
1041
1146
  agents?: {
1042
1147
  name: string;
1043
- type?: "native" | "process" | "cli" | undefined;
1044
1148
  metadata?: Record<string, unknown> | undefined;
1149
+ type?: "native" | "process" | "cli" | undefined;
1045
1150
  command?: string | undefined;
1046
1151
  args?: string[] | undefined;
1047
1152
  cwd?: string | undefined;
1048
1153
  env?: Record<string, string> | undefined;
1049
- input_mode?: "stdin" | "arg" | "protocol" | undefined;
1154
+ input_mode?: "protocol" | "stdin" | "arg" | undefined;
1050
1155
  timeout_ms?: number | undefined;
1051
1156
  inherit_env?: boolean | undefined;
1052
1157
  }[] | undefined;
@@ -1054,10 +1159,10 @@ declare const projectConfigSchema: z.ZodObject<{
1054
1159
  name: string;
1055
1160
  type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
1056
1161
  base_url: string;
1162
+ metadata?: Record<string, unknown> | undefined;
1057
1163
  api_key_env_var?: string | undefined;
1058
1164
  headers?: Record<string, string> | undefined;
1059
1165
  enabled?: boolean | undefined;
1060
- metadata?: Record<string, unknown> | undefined;
1061
1166
  }[] | undefined;
1062
1167
  roles?: {
1063
1168
  name: string;
@@ -1081,8 +1186,8 @@ declare const projectConfigSchema: z.ZodObject<{
1081
1186
  retries?: number | undefined;
1082
1187
  condition?: "always" | "on-success" | "on-failure" | undefined;
1083
1188
  }[];
1084
- role?: string | undefined;
1085
1189
  name?: string | undefined;
1190
+ role?: string | undefined;
1086
1191
  objective?: string | undefined;
1087
1192
  }[] | undefined;
1088
1193
  planner?: {
@@ -1111,18 +1216,18 @@ declare const appConfigSchema: z.ZodObject<{
1111
1216
  name: string;
1112
1217
  type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
1113
1218
  base_url: string;
1219
+ metadata?: Record<string, unknown> | undefined;
1114
1220
  api_key_env_var?: string | undefined;
1115
1221
  headers?: Record<string, string> | undefined;
1116
1222
  enabled?: boolean | undefined;
1117
- metadata?: Record<string, unknown> | undefined;
1118
1223
  }, {
1119
1224
  name: string;
1120
1225
  type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
1121
1226
  base_url: string;
1227
+ metadata?: Record<string, unknown> | undefined;
1122
1228
  api_key_env_var?: string | undefined;
1123
1229
  headers?: Record<string, string> | undefined;
1124
1230
  enabled?: boolean | undefined;
1125
- metadata?: Record<string, unknown> | undefined;
1126
1231
  }>, "many">>;
1127
1232
  agents: z.ZodDefault<z.ZodArray<z.ZodObject<{
1128
1233
  name: z.ZodString;
@@ -1139,7 +1244,7 @@ declare const appConfigSchema: z.ZodObject<{
1139
1244
  }, "strict", z.ZodTypeAny, {
1140
1245
  name: string;
1141
1246
  type: "native" | "process" | "cli";
1142
- input_mode: "stdin" | "arg" | "protocol";
1247
+ input_mode: "protocol" | "stdin" | "arg";
1143
1248
  metadata?: Record<string, unknown> | undefined;
1144
1249
  command?: string | undefined;
1145
1250
  args?: string[] | undefined;
@@ -1149,13 +1254,13 @@ declare const appConfigSchema: z.ZodObject<{
1149
1254
  inherit_env?: boolean | undefined;
1150
1255
  }, {
1151
1256
  name: string;
1152
- type?: "native" | "process" | "cli" | undefined;
1153
1257
  metadata?: Record<string, unknown> | undefined;
1258
+ type?: "native" | "process" | "cli" | undefined;
1154
1259
  command?: string | undefined;
1155
1260
  args?: string[] | undefined;
1156
1261
  cwd?: string | undefined;
1157
1262
  env?: Record<string, string> | undefined;
1158
- input_mode?: "stdin" | "arg" | "protocol" | undefined;
1263
+ input_mode?: "protocol" | "stdin" | "arg" | undefined;
1159
1264
  timeout_ms?: number | undefined;
1160
1265
  inherit_env?: boolean | undefined;
1161
1266
  }>, "many">>;
@@ -1232,8 +1337,8 @@ declare const appConfigSchema: z.ZodObject<{
1232
1337
  retries?: number | undefined;
1233
1338
  condition?: "always" | "on-success" | "on-failure" | undefined;
1234
1339
  }[];
1235
- role?: string | undefined;
1236
1340
  name?: string | undefined;
1341
+ role?: string | undefined;
1237
1342
  objective?: string | undefined;
1238
1343
  }, {
1239
1344
  id: string;
@@ -1247,8 +1352,8 @@ declare const appConfigSchema: z.ZodObject<{
1247
1352
  retries?: number | undefined;
1248
1353
  condition?: "always" | "on-success" | "on-failure" | undefined;
1249
1354
  }[];
1250
- role?: string | undefined;
1251
1355
  name?: string | undefined;
1356
+ role?: string | undefined;
1252
1357
  objective?: string | undefined;
1253
1358
  }>, "many">>;
1254
1359
  planner: z.ZodOptional<z.ZodObject<{
@@ -1282,7 +1387,7 @@ declare const appConfigSchema: z.ZodObject<{
1282
1387
  agents: {
1283
1388
  name: string;
1284
1389
  type: "native" | "process" | "cli";
1285
- input_mode: "stdin" | "arg" | "protocol";
1390
+ input_mode: "protocol" | "stdin" | "arg";
1286
1391
  metadata?: Record<string, unknown> | undefined;
1287
1392
  command?: string | undefined;
1288
1393
  args?: string[] | undefined;
@@ -1295,10 +1400,10 @@ declare const appConfigSchema: z.ZodObject<{
1295
1400
  name: string;
1296
1401
  type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
1297
1402
  base_url: string;
1403
+ metadata?: Record<string, unknown> | undefined;
1298
1404
  api_key_env_var?: string | undefined;
1299
1405
  headers?: Record<string, string> | undefined;
1300
1406
  enabled?: boolean | undefined;
1301
- metadata?: Record<string, unknown> | undefined;
1302
1407
  }[];
1303
1408
  roles: {
1304
1409
  name: string;
@@ -1322,8 +1427,8 @@ declare const appConfigSchema: z.ZodObject<{
1322
1427
  retries?: number | undefined;
1323
1428
  condition?: "always" | "on-success" | "on-failure" | undefined;
1324
1429
  }[];
1325
- role?: string | undefined;
1326
1430
  name?: string | undefined;
1431
+ role?: string | undefined;
1327
1432
  objective?: string | undefined;
1328
1433
  }[];
1329
1434
  planner?: {
@@ -1340,13 +1445,13 @@ declare const appConfigSchema: z.ZodObject<{
1340
1445
  name: string;
1341
1446
  agents?: {
1342
1447
  name: string;
1343
- type?: "native" | "process" | "cli" | undefined;
1344
1448
  metadata?: Record<string, unknown> | undefined;
1449
+ type?: "native" | "process" | "cli" | undefined;
1345
1450
  command?: string | undefined;
1346
1451
  args?: string[] | undefined;
1347
1452
  cwd?: string | undefined;
1348
1453
  env?: Record<string, string> | undefined;
1349
- input_mode?: "stdin" | "arg" | "protocol" | undefined;
1454
+ input_mode?: "protocol" | "stdin" | "arg" | undefined;
1350
1455
  timeout_ms?: number | undefined;
1351
1456
  inherit_env?: boolean | undefined;
1352
1457
  }[] | undefined;
@@ -1354,10 +1459,10 @@ declare const appConfigSchema: z.ZodObject<{
1354
1459
  name: string;
1355
1460
  type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
1356
1461
  base_url: string;
1462
+ metadata?: Record<string, unknown> | undefined;
1357
1463
  api_key_env_var?: string | undefined;
1358
1464
  headers?: Record<string, string> | undefined;
1359
1465
  enabled?: boolean | undefined;
1360
- metadata?: Record<string, unknown> | undefined;
1361
1466
  }[] | undefined;
1362
1467
  roles?: {
1363
1468
  name: string;
@@ -1381,8 +1486,8 @@ declare const appConfigSchema: z.ZodObject<{
1381
1486
  retries?: number | undefined;
1382
1487
  condition?: "always" | "on-success" | "on-failure" | undefined;
1383
1488
  }[];
1384
- role?: string | undefined;
1385
1489
  name?: string | undefined;
1490
+ role?: string | undefined;
1386
1491
  objective?: string | undefined;
1387
1492
  }[] | undefined;
1388
1493
  planner?: {
@@ -1409,7 +1514,7 @@ declare const appConfigSchema: z.ZodObject<{
1409
1514
  agents: {
1410
1515
  name: string;
1411
1516
  type: "native" | "process" | "cli";
1412
- input_mode: "stdin" | "arg" | "protocol";
1517
+ input_mode: "protocol" | "stdin" | "arg";
1413
1518
  metadata?: Record<string, unknown> | undefined;
1414
1519
  command?: string | undefined;
1415
1520
  args?: string[] | undefined;
@@ -1422,10 +1527,10 @@ declare const appConfigSchema: z.ZodObject<{
1422
1527
  name: string;
1423
1528
  type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
1424
1529
  base_url: string;
1530
+ metadata?: Record<string, unknown> | undefined;
1425
1531
  api_key_env_var?: string | undefined;
1426
1532
  headers?: Record<string, string> | undefined;
1427
1533
  enabled?: boolean | undefined;
1428
- metadata?: Record<string, unknown> | undefined;
1429
1534
  }[];
1430
1535
  roles: {
1431
1536
  name: string;
@@ -1449,8 +1554,8 @@ declare const appConfigSchema: z.ZodObject<{
1449
1554
  retries?: number | undefined;
1450
1555
  condition?: "always" | "on-success" | "on-failure" | undefined;
1451
1556
  }[];
1452
- role?: string | undefined;
1453
1557
  name?: string | undefined;
1558
+ role?: string | undefined;
1454
1559
  objective?: string | undefined;
1455
1560
  }[];
1456
1561
  planner?: {
@@ -1472,13 +1577,13 @@ declare const appConfigSchema: z.ZodObject<{
1472
1577
  name: string;
1473
1578
  agents?: {
1474
1579
  name: string;
1475
- type?: "native" | "process" | "cli" | undefined;
1476
1580
  metadata?: Record<string, unknown> | undefined;
1581
+ type?: "native" | "process" | "cli" | undefined;
1477
1582
  command?: string | undefined;
1478
1583
  args?: string[] | undefined;
1479
1584
  cwd?: string | undefined;
1480
1585
  env?: Record<string, string> | undefined;
1481
- input_mode?: "stdin" | "arg" | "protocol" | undefined;
1586
+ input_mode?: "protocol" | "stdin" | "arg" | undefined;
1482
1587
  timeout_ms?: number | undefined;
1483
1588
  inherit_env?: boolean | undefined;
1484
1589
  }[] | undefined;
@@ -1486,10 +1591,10 @@ declare const appConfigSchema: z.ZodObject<{
1486
1591
  name: string;
1487
1592
  type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
1488
1593
  base_url: string;
1594
+ metadata?: Record<string, unknown> | undefined;
1489
1595
  api_key_env_var?: string | undefined;
1490
1596
  headers?: Record<string, string> | undefined;
1491
1597
  enabled?: boolean | undefined;
1492
- metadata?: Record<string, unknown> | undefined;
1493
1598
  }[] | undefined;
1494
1599
  roles?: {
1495
1600
  name: string;
@@ -1513,8 +1618,8 @@ declare const appConfigSchema: z.ZodObject<{
1513
1618
  retries?: number | undefined;
1514
1619
  condition?: "always" | "on-success" | "on-failure" | undefined;
1515
1620
  }[];
1516
- role?: string | undefined;
1517
1621
  name?: string | undefined;
1622
+ role?: string | undefined;
1518
1623
  objective?: string | undefined;
1519
1624
  }[] | undefined;
1520
1625
  planner?: {
@@ -1699,6 +1804,104 @@ declare function createAgent(config: AgentConfig): IAgent;
1699
1804
  /** Builds an agent registry from the project configuration, skipping agents that fail to construct. */
1700
1805
  declare function buildAgentRegistry(config: AppConfig, log?: Logger): AgentRegistry;
1701
1806
 
1807
+ /**
1808
+ * OmniNode Agent Protocol v2 — versioning (roadmap §7.1).
1809
+ *
1810
+ * Protocol identifiers are namespaced strings so an agent can negotiate the
1811
+ * dialect it speaks: `omninode-agent-protocol/2`.
1812
+ */
1813
+ declare const PROTOCOL_V2 = "omninode-agent-protocol/2";
1814
+ /** Versions this build accepts. v1 is the unversioned dialect shipped with OmniNode 1.x. */
1815
+ declare const SUPPORTED_PROTOCOL_VERSIONS: readonly string[];
1816
+ declare const MAX_MESSAGE_BYTES = 1048576;
1817
+ declare function isSupportedProtocol(protocol: string): boolean;
1818
+
1819
+ type ProtocolViolationCode = "INVALID_JSON" | "NOT_AN_OBJECT" | "UNKNOWN_TYPE" | "MISSING_FIELD" | "UNSUPPORTED_VERSION" | "OVERSIZED" | "INVALID_PAYLOAD";
1820
+ interface ProtocolViolation {
1821
+ code: ProtocolViolationCode;
1822
+ message: string;
1823
+ /** Raw line (truncated) for diagnostics. */
1824
+ sample?: string;
1825
+ }
1826
+ type DecodeResult = {
1827
+ ok: true;
1828
+ envelope: ProtocolEnvelope;
1829
+ legacy: boolean;
1830
+ } | {
1831
+ ok: false;
1832
+ error: ProtocolViolation;
1833
+ };
1834
+ /** Validates one decoded JSON value as a protocol envelope. */
1835
+ declare function validateEnvelope(value: unknown, line?: string): DecodeResult;
1836
+ /** Decodes one protocol line (no trailing newline). */
1837
+ declare function decodeMessage(line: string, maxBytes?: number): DecodeResult;
1838
+ /** Serializes an envelope to a single JSON line. */
1839
+ declare function encodeMessage(envelope: ProtocolEnvelope, maxBytes?: number): string;
1840
+ /**
1841
+ * Streaming line decoder for agent stdout. Feed chunks; receive decoded
1842
+ * envelopes and violations in order. Survives garbage: a bad line yields a
1843
+ * violation and the stream continues.
1844
+ */
1845
+ declare class ProtocolDecoder {
1846
+ private buffer;
1847
+ private readonly maxBytes;
1848
+ constructor(maxBytes?: number);
1849
+ push(chunk: string): DecodeResult[];
1850
+ /** Flush any trailing line when the process exits. */
1851
+ flush(): DecodeResult[];
1852
+ }
1853
+
1854
+ /**
1855
+ * OmniNode Agent Protocol v2 — session (roadmap §7.6).
1856
+ *
1857
+ * A session drives a protocol-mode agent: it emits v2 envelopes with
1858
+ * correlation ids, tolerates legacy (unversioned) replies, answers agent
1859
+ * questions through a responder callback, and collects reports, artifacts
1860
+ * and the completion — never throwing on malformed input.
1861
+ */
1862
+
1863
+ interface SessionIds {
1864
+ requestId: string;
1865
+ taskId: string;
1866
+ agentId: string;
1867
+ pipelineId?: string;
1868
+ executionId?: string;
1869
+ }
1870
+ interface QuestionResponder {
1871
+ (question: {
1872
+ questionId: string;
1873
+ question: string;
1874
+ expected?: string;
1875
+ }): Promise<string> | string;
1876
+ }
1877
+ declare class ProtocolSession {
1878
+ readonly decoder: ProtocolDecoder;
1879
+ private readonly ids;
1880
+ private readonly responder;
1881
+ readonly violations: ProtocolViolation[];
1882
+ readonly questions: AskedQuestion[];
1883
+ readonly artifacts: ProtocolEnvelope["payload"][];
1884
+ reports: ProtocolEnvelope["payload"][];
1885
+ descriptor?: AgentDescriptor;
1886
+ completionSummary?: string;
1887
+ errorMessage?: string;
1888
+ constructor(ids: SessionIds, options?: {
1889
+ responder?: QuestionResponder;
1890
+ maxBytes?: number;
1891
+ });
1892
+ /** The v2 messages OmniNode sends to open a task (written to the agent's stdin). */
1893
+ taskMessages(objective: string, role?: unknown, context?: string, instruction?: string): string[];
1894
+ helloAck(descriptor: AgentDescriptor): string;
1895
+ /** Consumes decoded stdout, answering questions as they arrive. */
1896
+ handle(decoded: DecodeResult): Promise<void>;
1897
+ private answerQuestion;
1898
+ readonly pendingAnswers: string[];
1899
+ /** True once any inbound message carried the v2 protocol field. */
1900
+ sawV2: boolean;
1901
+ }
1902
+ declare function decodeStream(session: ProtocolSession, chunk: string): Promise<string[]>;
1903
+ declare function requireCompletion(session: ProtocolSession): void;
1904
+
1702
1905
  /** Role registry (§11): the set of roles available for task assignment. */
1703
1906
 
1704
1907
  declare class RoleRegistry {
@@ -2150,6 +2353,6 @@ declare class ProjectStores {
2150
2353
  constructor(directory?: string);
2151
2354
  }
2152
2355
 
2153
- declare const OMNINODE_VERSION = "2.0.0-alpha.2";
2356
+ declare const OMNINODE_VERSION = "2.0.0-alpha.3";
2154
2357
 
2155
- export { type AgentConfig, type AgentConfigYaml, AgentError, type AgentInfo, type AgentInputMode, type AgentIntegrationType, AgentRegistry, type AgentStatus, type AgentTaskInput, type AgentTaskOutput, type AgentToNodeMessage, type AggregateOptions, type AggregatedFinding, type AggregatedRecommendation, type AppConfig, type AppConfigYaml, type 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 DiscoveryResult, type EnvelopeMeta, type ExecutionRecord, type ExtractionMeta, FileAuditLog, FilePipelineRunStore, FilePlanStore, FileReportStore, FileTaskStore, type Finding, type FindingSeverity, type FindingSource, HeuristicPlanner, type HttpRequestOptions, type HttpResponse, type IAgent, type IChatProvider, type IMemoryProvider, type IPlanner, type IProvider, type JsonDocument, JsonFileStore, type JsonFileStoreOptions, type LoadConfigOptions, LocalMemoryProvider, type LogLevel, type LogSink, Logger, type LoggerOptions, type MemoryContextQuery, type MemoryEntry, MemoryError, type MemoryProviderConfig, type MemoryQuery, type MemoryScope, MemoryService, type MessageEnvelope, type ModelCapabilities, type ModelFilter, type ModelInfo, ModelPlanner, ModelRegistry, type ModelStatus, type NodeToAgentMessage, OMNINODE_VERSION, OPENAI_COMPATIBLE_TYPES, type OmniHilbrasConnectionResult, OmniHilbrasProvider, OmniNodeError, type OmniNodeErrorCode, type OmniNodeErrorOptions, OpenAICompatibleProvider, type PipelineConfigYaml, type PipelineDefinition, PipelineEngine, type PipelineEngineOptions, PipelineError, type PipelineRun, type PipelineRunFilter, type PipelineRunStatus, type PipelineRunStore, type PipelineStep, type PipelineStepCondition, type PipelineStepConfigYaml, type PipelineStepKind, type PipelineStepRun, type Plan, type PlanFilter, type PlanRequest, type PlanStep, type PlanStore, type PlannerConfigYaml, PlannerError, ProcessAgent, type Project, type ProjectConfigYaml, ProjectStores, ProtocolError, type ProviderConfig, type ProviderConfigYaml, ProviderError, type ProviderHealth, type ProviderStatus, type ProviderType, type RememberaConfig, RememberaMemoryProvider, type Report, type ReportFilter, ReportService, type ReportStore, type RoleConfigYaml, type RoleDefinition, RoleRegistry, type RunPipelineOptions, TERMINAL_TASK_STATUSES, type Task, type TaskContext, TaskEngine, type TaskEngineOptions, TaskError, type TaskResult, type TaskStatus, type TaskStore, type TaskStoreFilter, type WritableLike, agentConfigSchema, aggregateReports, appConfigSchema, authHeaders, buildAgentRegistry, buildChildEnv, buildPipelineEngine, buildPlanner, buildPlannerContext, buildRoleRegistry, composeTaskText, createAgent, createDefaultChatFn, createMemoryProvider, createProvider, createTaskEngine, defaultProjectConfigYaml, expandEnvRefs, extractReportFromText, findConfigFile, isOmniNodeError, keywords, loadConfig, logger, parsePlanJson, pipelineConfigSchema, pipelineStepConfigSchema, plannerConfigSchema, projectConfigSchema, providerConfigSchema, registryKey, requestJson, resolveApiKey, roleConfigSchema, similar };
2358
+ export { 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 DecodeResult, type DiscoveryResult, 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 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, 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, encodeMessage, envelope, expandEnvRefs, extractReportFromText, findConfigFile, isOmniNodeError, isSupportedProtocol, keywords, loadConfig, logger, newMessageId, parseHello, parsePlanJson, pipelineConfigSchema, pipelineStepConfigSchema, plannerConfigSchema, projectConfigSchema, providerConfigSchema, registryKey, requestJson, requireCompletion, resolveApiKey, roleConfigSchema, similar, validateEnvelope };