@hilbras/omninode 2.0.0-alpha.2 → 2.0.0-alpha.4
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/README.md +26 -10
- package/dist/cli/index.js +618 -92
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +410 -51
- package/dist/index.js +651 -86
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { ChildProcess } from 'node:child_process';
|
|
2
3
|
|
|
3
4
|
/** Structured report format so reports can be processed programmatically (§16). */
|
|
4
5
|
type Confidence = "low" | "medium" | "high";
|
|
@@ -65,6 +66,99 @@ interface CombinedReport {
|
|
|
65
66
|
metadata?: Record<string, unknown>;
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
/**
|
|
70
|
+
* OmniNode Agent Protocol v2 — message model (roadmap §7.2–§7.4, §7.7).
|
|
71
|
+
*
|
|
72
|
+
* Every message is a JSON line carrying a `ProtocolEnvelope`. All ids are
|
|
73
|
+
* optional for inbound tolerance but OmniNode always emits them, so every
|
|
74
|
+
* message is traceable to agent / task / pipeline / execution / request.
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
/** Messages OmniNode sends to an agent. */
|
|
78
|
+
type ProtocolNodeToAgentType = "TASK" | "HELLO_ACK" | "CONTEXT" | "INSTRUCTION" | "RESPONSE" | "CANCEL";
|
|
79
|
+
/** Messages an agent sends to OmniNode. */
|
|
80
|
+
type ProtocolAgentToNodeType = "HELLO" | "TASK_REQUEST" | "TASK_ACCEPTED" | "TASK_STARTED" | "STATUS" | "QUESTION" | "REPORT" | "ARTIFACT" | "COMPLETION" | "ERROR" | "CANCELLED";
|
|
81
|
+
type ProtocolMessageType = ProtocolNodeToAgentType | ProtocolAgentToNodeType;
|
|
82
|
+
interface ProtocolEnvelope<T extends ProtocolMessageType = ProtocolMessageType> {
|
|
83
|
+
/** `omninode-agent-protocol/2`. Inbound messages without it are treated as v1. */
|
|
84
|
+
protocol: string;
|
|
85
|
+
/** Unique id of this message. */
|
|
86
|
+
messageId: string;
|
|
87
|
+
/** Id of the request/thread this message belongs to. */
|
|
88
|
+
requestId?: string;
|
|
89
|
+
taskId?: string;
|
|
90
|
+
agentId?: string;
|
|
91
|
+
pipelineId?: string;
|
|
92
|
+
/** Execution identity (roadmap §6.5) — ties the message to one attempt. */
|
|
93
|
+
executionId?: string;
|
|
94
|
+
timestamp: string;
|
|
95
|
+
type: T;
|
|
96
|
+
payload: unknown;
|
|
97
|
+
metadata?: Record<string, unknown>;
|
|
98
|
+
}
|
|
99
|
+
/** Standard artifact kinds (roadmap §7.7). */
|
|
100
|
+
type ArtifactKind = "file" | "patch" | "report" | "log" | "screenshot" | "document" | "data";
|
|
101
|
+
interface ArtifactPayload {
|
|
102
|
+
kind: ArtifactKind;
|
|
103
|
+
/** Path, URL or logical name. */
|
|
104
|
+
ref: string;
|
|
105
|
+
description?: string;
|
|
106
|
+
mediaType?: string;
|
|
107
|
+
bytes?: number;
|
|
108
|
+
metadata?: Record<string, unknown>;
|
|
109
|
+
}
|
|
110
|
+
interface QuestionPayload {
|
|
111
|
+
/** Question id to answer. */
|
|
112
|
+
questionId: string;
|
|
113
|
+
question: string;
|
|
114
|
+
/** What kind of answer is expected (free text, file path, options…). */
|
|
115
|
+
expected?: "text" | "path" | "choice";
|
|
116
|
+
options?: string[];
|
|
117
|
+
}
|
|
118
|
+
interface TaskPayload {
|
|
119
|
+
taskId: string;
|
|
120
|
+
objective: string;
|
|
121
|
+
}
|
|
122
|
+
interface ReportPayload {
|
|
123
|
+
report: Report | Report[];
|
|
124
|
+
}
|
|
125
|
+
/** A question an agent asked during a run, with the answer OmniNode gave (if any). */
|
|
126
|
+
interface AskedQuestion {
|
|
127
|
+
questionId: string;
|
|
128
|
+
question: string;
|
|
129
|
+
answer?: string;
|
|
130
|
+
}
|
|
131
|
+
declare function newMessageId(prefix?: string): string;
|
|
132
|
+
/** Builds a v2 envelope with ids and timestamp filled in. */
|
|
133
|
+
declare function envelope<T extends ProtocolMessageType>(type: T, payload: unknown, ids?: {
|
|
134
|
+
requestId?: string;
|
|
135
|
+
taskId?: string;
|
|
136
|
+
agentId?: string;
|
|
137
|
+
pipelineId?: string;
|
|
138
|
+
executionId?: string;
|
|
139
|
+
metadata?: Record<string, unknown>;
|
|
140
|
+
}): ProtocolEnvelope<T>;
|
|
141
|
+
|
|
142
|
+
interface AgentDescriptor {
|
|
143
|
+
/** Protocol the agent speaks. */
|
|
144
|
+
protocol: string;
|
|
145
|
+
name: string;
|
|
146
|
+
version?: string;
|
|
147
|
+
capabilities: string[];
|
|
148
|
+
/** Message types the agent can emit. */
|
|
149
|
+
supports: string[];
|
|
150
|
+
}
|
|
151
|
+
type HelloResult = {
|
|
152
|
+
ok: true;
|
|
153
|
+
descriptor: AgentDescriptor;
|
|
154
|
+
} | {
|
|
155
|
+
ok: false;
|
|
156
|
+
reason: string;
|
|
157
|
+
};
|
|
158
|
+
declare function parseHello(envelopeValue: ProtocolEnvelope): HelloResult;
|
|
159
|
+
declare function buildHello(descriptor: Omit<AgentDescriptor, "protocol">): ProtocolEnvelope<"HELLO">;
|
|
160
|
+
declare function buildHelloAck(descriptor: AgentDescriptor): ProtocolEnvelope<"HELLO_ACK">;
|
|
161
|
+
|
|
68
162
|
/** Role system: what an AI is supposed to do, independent of any provider (§11). */
|
|
69
163
|
interface RoleDefinition {
|
|
70
164
|
/** Slug identifier, e.g. "architecture-reviewer". */
|
|
@@ -98,8 +192,21 @@ interface AgentConfig {
|
|
|
98
192
|
inputMode?: AgentInputMode;
|
|
99
193
|
/** Per-task timeout in milliseconds; the process is killed when exceeded. */
|
|
100
194
|
timeoutMs?: number;
|
|
101
|
-
/**
|
|
195
|
+
/**
|
|
196
|
+
* When false, the agent process starts with a minimal environment (PATH +
|
|
197
|
+
* env). Deprecated in v2 — prefer `envPolicy`.
|
|
198
|
+
*/
|
|
102
199
|
inheritEnv?: boolean;
|
|
200
|
+
/** Explicit environment policy (roadmap §8). */
|
|
201
|
+
envPolicy?: "inherit" | "allowlist" | "denylist" | "explicit";
|
|
202
|
+
/** Variables forwarded from the parent under the `allowlist` policy. */
|
|
203
|
+
envAllowlist?: string[];
|
|
204
|
+
/** Variables removed from the parent under the `denylist` policy. */
|
|
205
|
+
envDenylist?: string[];
|
|
206
|
+
/** Per-stream byte budget for agent stdout/stderr (default 5 MiB). */
|
|
207
|
+
maxOutputBytes?: number;
|
|
208
|
+
/** Allow a working directory outside the project root. */
|
|
209
|
+
allowExternalCwd?: boolean;
|
|
103
210
|
/** Models (as "provider:model-id") this agent may use, if restricted. */
|
|
104
211
|
allowedModels?: string[];
|
|
105
212
|
metadata?: Record<string, unknown>;
|
|
@@ -117,6 +224,10 @@ interface AgentInfo {
|
|
|
117
224
|
interface AgentTaskInput {
|
|
118
225
|
taskId: string;
|
|
119
226
|
objective: string;
|
|
227
|
+
/** Pipeline run that owns this task (protocol correlation, §7.4). */
|
|
228
|
+
pipelineId?: string;
|
|
229
|
+
/** Execution identity for this attempt (protocol correlation, §7.4). */
|
|
230
|
+
executionId?: string;
|
|
120
231
|
role?: RoleDefinition;
|
|
121
232
|
/** Assembled task context (project, memory, files) already selected for this agent. */
|
|
122
233
|
context?: string;
|
|
@@ -132,6 +243,14 @@ interface AgentTaskOutput {
|
|
|
132
243
|
logs?: string[];
|
|
133
244
|
/** Structured reports extracted from protocol-mode runs (§16, §21). */
|
|
134
245
|
reports?: Report[];
|
|
246
|
+
/** Protocol diagnostics for protocol-mode runs (roadmap §7): questions asked, violations seen. */
|
|
247
|
+
protocol?: {
|
|
248
|
+
protocol: string;
|
|
249
|
+
legacy: boolean;
|
|
250
|
+
descriptor?: AgentDescriptor;
|
|
251
|
+
questions: AskedQuestion[];
|
|
252
|
+
violations: string[];
|
|
253
|
+
};
|
|
135
254
|
error?: string;
|
|
136
255
|
}
|
|
137
256
|
/** Contract every agent adapter implements (Phase 3+). */
|
|
@@ -616,18 +735,18 @@ declare const providerConfigSchema: z.ZodObject<{
|
|
|
616
735
|
name: string;
|
|
617
736
|
type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
|
|
618
737
|
base_url: string;
|
|
738
|
+
metadata?: Record<string, unknown> | undefined;
|
|
619
739
|
api_key_env_var?: string | undefined;
|
|
620
740
|
headers?: Record<string, string> | undefined;
|
|
621
741
|
enabled?: boolean | undefined;
|
|
622
|
-
metadata?: Record<string, unknown> | undefined;
|
|
623
742
|
}, {
|
|
624
743
|
name: string;
|
|
625
744
|
type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
|
|
626
745
|
base_url: string;
|
|
746
|
+
metadata?: Record<string, unknown> | undefined;
|
|
627
747
|
api_key_env_var?: string | undefined;
|
|
628
748
|
headers?: Record<string, string> | undefined;
|
|
629
749
|
enabled?: boolean | undefined;
|
|
630
|
-
metadata?: Record<string, unknown> | undefined;
|
|
631
750
|
}>;
|
|
632
751
|
declare const agentConfigSchema: z.ZodObject<{
|
|
633
752
|
name: z.ZodString;
|
|
@@ -640,11 +759,16 @@ declare const agentConfigSchema: z.ZodObject<{
|
|
|
640
759
|
input_mode: z.ZodDefault<z.ZodEnum<["stdin", "arg", "protocol"]>>;
|
|
641
760
|
timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
642
761
|
inherit_env: z.ZodOptional<z.ZodBoolean>;
|
|
762
|
+
env_policy: z.ZodOptional<z.ZodEnum<["inherit", "allowlist", "denylist", "explicit"]>>;
|
|
763
|
+
env_allowlist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
764
|
+
env_denylist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
765
|
+
max_output_bytes: z.ZodOptional<z.ZodNumber>;
|
|
766
|
+
allow_external_cwd: z.ZodOptional<z.ZodBoolean>;
|
|
643
767
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
644
768
|
}, "strict", z.ZodTypeAny, {
|
|
645
769
|
name: string;
|
|
646
770
|
type: "native" | "process" | "cli";
|
|
647
|
-
input_mode: "
|
|
771
|
+
input_mode: "protocol" | "stdin" | "arg";
|
|
648
772
|
metadata?: Record<string, unknown> | undefined;
|
|
649
773
|
command?: string | undefined;
|
|
650
774
|
args?: string[] | undefined;
|
|
@@ -652,17 +776,27 @@ declare const agentConfigSchema: z.ZodObject<{
|
|
|
652
776
|
env?: Record<string, string> | undefined;
|
|
653
777
|
timeout_ms?: number | undefined;
|
|
654
778
|
inherit_env?: boolean | undefined;
|
|
779
|
+
env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
|
|
780
|
+
env_allowlist?: string[] | undefined;
|
|
781
|
+
env_denylist?: string[] | undefined;
|
|
782
|
+
max_output_bytes?: number | undefined;
|
|
783
|
+
allow_external_cwd?: boolean | undefined;
|
|
655
784
|
}, {
|
|
656
785
|
name: string;
|
|
657
|
-
type?: "native" | "process" | "cli" | undefined;
|
|
658
786
|
metadata?: Record<string, unknown> | undefined;
|
|
787
|
+
type?: "native" | "process" | "cli" | undefined;
|
|
659
788
|
command?: string | undefined;
|
|
660
789
|
args?: string[] | undefined;
|
|
661
790
|
cwd?: string | undefined;
|
|
662
791
|
env?: Record<string, string> | undefined;
|
|
663
|
-
input_mode?: "
|
|
792
|
+
input_mode?: "protocol" | "stdin" | "arg" | undefined;
|
|
664
793
|
timeout_ms?: number | undefined;
|
|
665
794
|
inherit_env?: boolean | undefined;
|
|
795
|
+
env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
|
|
796
|
+
env_allowlist?: string[] | undefined;
|
|
797
|
+
env_denylist?: string[] | undefined;
|
|
798
|
+
max_output_bytes?: number | undefined;
|
|
799
|
+
allow_external_cwd?: boolean | undefined;
|
|
666
800
|
}>;
|
|
667
801
|
declare const roleConfigSchema: z.ZodObject<{
|
|
668
802
|
id: z.ZodString;
|
|
@@ -765,8 +899,8 @@ declare const pipelineConfigSchema: z.ZodObject<{
|
|
|
765
899
|
retries?: number | undefined;
|
|
766
900
|
condition?: "always" | "on-success" | "on-failure" | undefined;
|
|
767
901
|
}[];
|
|
768
|
-
role?: string | undefined;
|
|
769
902
|
name?: string | undefined;
|
|
903
|
+
role?: string | undefined;
|
|
770
904
|
objective?: string | undefined;
|
|
771
905
|
}, {
|
|
772
906
|
id: string;
|
|
@@ -780,8 +914,8 @@ declare const pipelineConfigSchema: z.ZodObject<{
|
|
|
780
914
|
retries?: number | undefined;
|
|
781
915
|
condition?: "always" | "on-success" | "on-failure" | undefined;
|
|
782
916
|
}[];
|
|
783
|
-
role?: string | undefined;
|
|
784
917
|
name?: string | undefined;
|
|
918
|
+
role?: string | undefined;
|
|
785
919
|
objective?: string | undefined;
|
|
786
920
|
}>;
|
|
787
921
|
declare const plannerConfigSchema: z.ZodObject<{
|
|
@@ -811,18 +945,18 @@ declare const projectConfigSchema: z.ZodObject<{
|
|
|
811
945
|
name: string;
|
|
812
946
|
type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
|
|
813
947
|
base_url: string;
|
|
948
|
+
metadata?: Record<string, unknown> | undefined;
|
|
814
949
|
api_key_env_var?: string | undefined;
|
|
815
950
|
headers?: Record<string, string> | undefined;
|
|
816
951
|
enabled?: boolean | undefined;
|
|
817
|
-
metadata?: Record<string, unknown> | undefined;
|
|
818
952
|
}, {
|
|
819
953
|
name: string;
|
|
820
954
|
type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
|
|
821
955
|
base_url: string;
|
|
956
|
+
metadata?: Record<string, unknown> | undefined;
|
|
822
957
|
api_key_env_var?: string | undefined;
|
|
823
958
|
headers?: Record<string, string> | undefined;
|
|
824
959
|
enabled?: boolean | undefined;
|
|
825
|
-
metadata?: Record<string, unknown> | undefined;
|
|
826
960
|
}>, "many">>;
|
|
827
961
|
agents: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
828
962
|
name: z.ZodString;
|
|
@@ -835,11 +969,16 @@ declare const projectConfigSchema: z.ZodObject<{
|
|
|
835
969
|
input_mode: z.ZodDefault<z.ZodEnum<["stdin", "arg", "protocol"]>>;
|
|
836
970
|
timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
837
971
|
inherit_env: z.ZodOptional<z.ZodBoolean>;
|
|
972
|
+
env_policy: z.ZodOptional<z.ZodEnum<["inherit", "allowlist", "denylist", "explicit"]>>;
|
|
973
|
+
env_allowlist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
974
|
+
env_denylist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
975
|
+
max_output_bytes: z.ZodOptional<z.ZodNumber>;
|
|
976
|
+
allow_external_cwd: z.ZodOptional<z.ZodBoolean>;
|
|
838
977
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
839
978
|
}, "strict", z.ZodTypeAny, {
|
|
840
979
|
name: string;
|
|
841
980
|
type: "native" | "process" | "cli";
|
|
842
|
-
input_mode: "
|
|
981
|
+
input_mode: "protocol" | "stdin" | "arg";
|
|
843
982
|
metadata?: Record<string, unknown> | undefined;
|
|
844
983
|
command?: string | undefined;
|
|
845
984
|
args?: string[] | undefined;
|
|
@@ -847,17 +986,27 @@ declare const projectConfigSchema: z.ZodObject<{
|
|
|
847
986
|
env?: Record<string, string> | undefined;
|
|
848
987
|
timeout_ms?: number | undefined;
|
|
849
988
|
inherit_env?: boolean | undefined;
|
|
989
|
+
env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
|
|
990
|
+
env_allowlist?: string[] | undefined;
|
|
991
|
+
env_denylist?: string[] | undefined;
|
|
992
|
+
max_output_bytes?: number | undefined;
|
|
993
|
+
allow_external_cwd?: boolean | undefined;
|
|
850
994
|
}, {
|
|
851
995
|
name: string;
|
|
852
|
-
type?: "native" | "process" | "cli" | undefined;
|
|
853
996
|
metadata?: Record<string, unknown> | undefined;
|
|
997
|
+
type?: "native" | "process" | "cli" | undefined;
|
|
854
998
|
command?: string | undefined;
|
|
855
999
|
args?: string[] | undefined;
|
|
856
1000
|
cwd?: string | undefined;
|
|
857
1001
|
env?: Record<string, string> | undefined;
|
|
858
|
-
input_mode?: "
|
|
1002
|
+
input_mode?: "protocol" | "stdin" | "arg" | undefined;
|
|
859
1003
|
timeout_ms?: number | undefined;
|
|
860
1004
|
inherit_env?: boolean | undefined;
|
|
1005
|
+
env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
|
|
1006
|
+
env_allowlist?: string[] | undefined;
|
|
1007
|
+
env_denylist?: string[] | undefined;
|
|
1008
|
+
max_output_bytes?: number | undefined;
|
|
1009
|
+
allow_external_cwd?: boolean | undefined;
|
|
861
1010
|
}>, "many">>;
|
|
862
1011
|
roles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
863
1012
|
id: z.ZodString;
|
|
@@ -932,8 +1081,8 @@ declare const projectConfigSchema: z.ZodObject<{
|
|
|
932
1081
|
retries?: number | undefined;
|
|
933
1082
|
condition?: "always" | "on-success" | "on-failure" | undefined;
|
|
934
1083
|
}[];
|
|
935
|
-
role?: string | undefined;
|
|
936
1084
|
name?: string | undefined;
|
|
1085
|
+
role?: string | undefined;
|
|
937
1086
|
objective?: string | undefined;
|
|
938
1087
|
}, {
|
|
939
1088
|
id: string;
|
|
@@ -947,8 +1096,8 @@ declare const projectConfigSchema: z.ZodObject<{
|
|
|
947
1096
|
retries?: number | undefined;
|
|
948
1097
|
condition?: "always" | "on-success" | "on-failure" | undefined;
|
|
949
1098
|
}[];
|
|
950
|
-
role?: string | undefined;
|
|
951
1099
|
name?: string | undefined;
|
|
1100
|
+
role?: string | undefined;
|
|
952
1101
|
objective?: string | undefined;
|
|
953
1102
|
}>, "many">>;
|
|
954
1103
|
planner: z.ZodOptional<z.ZodObject<{
|
|
@@ -982,7 +1131,7 @@ declare const projectConfigSchema: z.ZodObject<{
|
|
|
982
1131
|
agents: {
|
|
983
1132
|
name: string;
|
|
984
1133
|
type: "native" | "process" | "cli";
|
|
985
|
-
input_mode: "
|
|
1134
|
+
input_mode: "protocol" | "stdin" | "arg";
|
|
986
1135
|
metadata?: Record<string, unknown> | undefined;
|
|
987
1136
|
command?: string | undefined;
|
|
988
1137
|
args?: string[] | undefined;
|
|
@@ -990,15 +1139,20 @@ declare const projectConfigSchema: z.ZodObject<{
|
|
|
990
1139
|
env?: Record<string, string> | undefined;
|
|
991
1140
|
timeout_ms?: number | undefined;
|
|
992
1141
|
inherit_env?: boolean | undefined;
|
|
1142
|
+
env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
|
|
1143
|
+
env_allowlist?: string[] | undefined;
|
|
1144
|
+
env_denylist?: string[] | undefined;
|
|
1145
|
+
max_output_bytes?: number | undefined;
|
|
1146
|
+
allow_external_cwd?: boolean | undefined;
|
|
993
1147
|
}[];
|
|
994
1148
|
providers: {
|
|
995
1149
|
name: string;
|
|
996
1150
|
type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
|
|
997
1151
|
base_url: string;
|
|
1152
|
+
metadata?: Record<string, unknown> | undefined;
|
|
998
1153
|
api_key_env_var?: string | undefined;
|
|
999
1154
|
headers?: Record<string, string> | undefined;
|
|
1000
1155
|
enabled?: boolean | undefined;
|
|
1001
|
-
metadata?: Record<string, unknown> | undefined;
|
|
1002
1156
|
}[];
|
|
1003
1157
|
roles: {
|
|
1004
1158
|
name: string;
|
|
@@ -1022,8 +1176,8 @@ declare const projectConfigSchema: z.ZodObject<{
|
|
|
1022
1176
|
retries?: number | undefined;
|
|
1023
1177
|
condition?: "always" | "on-success" | "on-failure" | undefined;
|
|
1024
1178
|
}[];
|
|
1025
|
-
role?: string | undefined;
|
|
1026
1179
|
name?: string | undefined;
|
|
1180
|
+
role?: string | undefined;
|
|
1027
1181
|
objective?: string | undefined;
|
|
1028
1182
|
}[];
|
|
1029
1183
|
planner?: {
|
|
@@ -1040,24 +1194,29 @@ declare const projectConfigSchema: z.ZodObject<{
|
|
|
1040
1194
|
name: string;
|
|
1041
1195
|
agents?: {
|
|
1042
1196
|
name: string;
|
|
1043
|
-
type?: "native" | "process" | "cli" | undefined;
|
|
1044
1197
|
metadata?: Record<string, unknown> | undefined;
|
|
1198
|
+
type?: "native" | "process" | "cli" | undefined;
|
|
1045
1199
|
command?: string | undefined;
|
|
1046
1200
|
args?: string[] | undefined;
|
|
1047
1201
|
cwd?: string | undefined;
|
|
1048
1202
|
env?: Record<string, string> | undefined;
|
|
1049
|
-
input_mode?: "
|
|
1203
|
+
input_mode?: "protocol" | "stdin" | "arg" | undefined;
|
|
1050
1204
|
timeout_ms?: number | undefined;
|
|
1051
1205
|
inherit_env?: boolean | undefined;
|
|
1206
|
+
env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
|
|
1207
|
+
env_allowlist?: string[] | undefined;
|
|
1208
|
+
env_denylist?: string[] | undefined;
|
|
1209
|
+
max_output_bytes?: number | undefined;
|
|
1210
|
+
allow_external_cwd?: boolean | undefined;
|
|
1052
1211
|
}[] | undefined;
|
|
1053
1212
|
providers?: {
|
|
1054
1213
|
name: string;
|
|
1055
1214
|
type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
|
|
1056
1215
|
base_url: string;
|
|
1216
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1057
1217
|
api_key_env_var?: string | undefined;
|
|
1058
1218
|
headers?: Record<string, string> | undefined;
|
|
1059
1219
|
enabled?: boolean | undefined;
|
|
1060
|
-
metadata?: Record<string, unknown> | undefined;
|
|
1061
1220
|
}[] | undefined;
|
|
1062
1221
|
roles?: {
|
|
1063
1222
|
name: string;
|
|
@@ -1081,8 +1240,8 @@ declare const projectConfigSchema: z.ZodObject<{
|
|
|
1081
1240
|
retries?: number | undefined;
|
|
1082
1241
|
condition?: "always" | "on-success" | "on-failure" | undefined;
|
|
1083
1242
|
}[];
|
|
1084
|
-
role?: string | undefined;
|
|
1085
1243
|
name?: string | undefined;
|
|
1244
|
+
role?: string | undefined;
|
|
1086
1245
|
objective?: string | undefined;
|
|
1087
1246
|
}[] | undefined;
|
|
1088
1247
|
planner?: {
|
|
@@ -1111,18 +1270,18 @@ declare const appConfigSchema: z.ZodObject<{
|
|
|
1111
1270
|
name: string;
|
|
1112
1271
|
type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
|
|
1113
1272
|
base_url: string;
|
|
1273
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1114
1274
|
api_key_env_var?: string | undefined;
|
|
1115
1275
|
headers?: Record<string, string> | undefined;
|
|
1116
1276
|
enabled?: boolean | undefined;
|
|
1117
|
-
metadata?: Record<string, unknown> | undefined;
|
|
1118
1277
|
}, {
|
|
1119
1278
|
name: string;
|
|
1120
1279
|
type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
|
|
1121
1280
|
base_url: string;
|
|
1281
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1122
1282
|
api_key_env_var?: string | undefined;
|
|
1123
1283
|
headers?: Record<string, string> | undefined;
|
|
1124
1284
|
enabled?: boolean | undefined;
|
|
1125
|
-
metadata?: Record<string, unknown> | undefined;
|
|
1126
1285
|
}>, "many">>;
|
|
1127
1286
|
agents: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1128
1287
|
name: z.ZodString;
|
|
@@ -1135,11 +1294,16 @@ declare const appConfigSchema: z.ZodObject<{
|
|
|
1135
1294
|
input_mode: z.ZodDefault<z.ZodEnum<["stdin", "arg", "protocol"]>>;
|
|
1136
1295
|
timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
1137
1296
|
inherit_env: z.ZodOptional<z.ZodBoolean>;
|
|
1297
|
+
env_policy: z.ZodOptional<z.ZodEnum<["inherit", "allowlist", "denylist", "explicit"]>>;
|
|
1298
|
+
env_allowlist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1299
|
+
env_denylist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1300
|
+
max_output_bytes: z.ZodOptional<z.ZodNumber>;
|
|
1301
|
+
allow_external_cwd: z.ZodOptional<z.ZodBoolean>;
|
|
1138
1302
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1139
1303
|
}, "strict", z.ZodTypeAny, {
|
|
1140
1304
|
name: string;
|
|
1141
1305
|
type: "native" | "process" | "cli";
|
|
1142
|
-
input_mode: "
|
|
1306
|
+
input_mode: "protocol" | "stdin" | "arg";
|
|
1143
1307
|
metadata?: Record<string, unknown> | undefined;
|
|
1144
1308
|
command?: string | undefined;
|
|
1145
1309
|
args?: string[] | undefined;
|
|
@@ -1147,17 +1311,27 @@ declare const appConfigSchema: z.ZodObject<{
|
|
|
1147
1311
|
env?: Record<string, string> | undefined;
|
|
1148
1312
|
timeout_ms?: number | undefined;
|
|
1149
1313
|
inherit_env?: boolean | undefined;
|
|
1314
|
+
env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
|
|
1315
|
+
env_allowlist?: string[] | undefined;
|
|
1316
|
+
env_denylist?: string[] | undefined;
|
|
1317
|
+
max_output_bytes?: number | undefined;
|
|
1318
|
+
allow_external_cwd?: boolean | undefined;
|
|
1150
1319
|
}, {
|
|
1151
1320
|
name: string;
|
|
1152
|
-
type?: "native" | "process" | "cli" | undefined;
|
|
1153
1321
|
metadata?: Record<string, unknown> | undefined;
|
|
1322
|
+
type?: "native" | "process" | "cli" | undefined;
|
|
1154
1323
|
command?: string | undefined;
|
|
1155
1324
|
args?: string[] | undefined;
|
|
1156
1325
|
cwd?: string | undefined;
|
|
1157
1326
|
env?: Record<string, string> | undefined;
|
|
1158
|
-
input_mode?: "
|
|
1327
|
+
input_mode?: "protocol" | "stdin" | "arg" | undefined;
|
|
1159
1328
|
timeout_ms?: number | undefined;
|
|
1160
1329
|
inherit_env?: boolean | undefined;
|
|
1330
|
+
env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
|
|
1331
|
+
env_allowlist?: string[] | undefined;
|
|
1332
|
+
env_denylist?: string[] | undefined;
|
|
1333
|
+
max_output_bytes?: number | undefined;
|
|
1334
|
+
allow_external_cwd?: boolean | undefined;
|
|
1161
1335
|
}>, "many">>;
|
|
1162
1336
|
roles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1163
1337
|
id: z.ZodString;
|
|
@@ -1232,8 +1406,8 @@ declare const appConfigSchema: z.ZodObject<{
|
|
|
1232
1406
|
retries?: number | undefined;
|
|
1233
1407
|
condition?: "always" | "on-success" | "on-failure" | undefined;
|
|
1234
1408
|
}[];
|
|
1235
|
-
role?: string | undefined;
|
|
1236
1409
|
name?: string | undefined;
|
|
1410
|
+
role?: string | undefined;
|
|
1237
1411
|
objective?: string | undefined;
|
|
1238
1412
|
}, {
|
|
1239
1413
|
id: string;
|
|
@@ -1247,8 +1421,8 @@ declare const appConfigSchema: z.ZodObject<{
|
|
|
1247
1421
|
retries?: number | undefined;
|
|
1248
1422
|
condition?: "always" | "on-success" | "on-failure" | undefined;
|
|
1249
1423
|
}[];
|
|
1250
|
-
role?: string | undefined;
|
|
1251
1424
|
name?: string | undefined;
|
|
1425
|
+
role?: string | undefined;
|
|
1252
1426
|
objective?: string | undefined;
|
|
1253
1427
|
}>, "many">>;
|
|
1254
1428
|
planner: z.ZodOptional<z.ZodObject<{
|
|
@@ -1282,7 +1456,7 @@ declare const appConfigSchema: z.ZodObject<{
|
|
|
1282
1456
|
agents: {
|
|
1283
1457
|
name: string;
|
|
1284
1458
|
type: "native" | "process" | "cli";
|
|
1285
|
-
input_mode: "
|
|
1459
|
+
input_mode: "protocol" | "stdin" | "arg";
|
|
1286
1460
|
metadata?: Record<string, unknown> | undefined;
|
|
1287
1461
|
command?: string | undefined;
|
|
1288
1462
|
args?: string[] | undefined;
|
|
@@ -1290,15 +1464,20 @@ declare const appConfigSchema: z.ZodObject<{
|
|
|
1290
1464
|
env?: Record<string, string> | undefined;
|
|
1291
1465
|
timeout_ms?: number | undefined;
|
|
1292
1466
|
inherit_env?: boolean | undefined;
|
|
1467
|
+
env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
|
|
1468
|
+
env_allowlist?: string[] | undefined;
|
|
1469
|
+
env_denylist?: string[] | undefined;
|
|
1470
|
+
max_output_bytes?: number | undefined;
|
|
1471
|
+
allow_external_cwd?: boolean | undefined;
|
|
1293
1472
|
}[];
|
|
1294
1473
|
providers: {
|
|
1295
1474
|
name: string;
|
|
1296
1475
|
type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
|
|
1297
1476
|
base_url: string;
|
|
1477
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1298
1478
|
api_key_env_var?: string | undefined;
|
|
1299
1479
|
headers?: Record<string, string> | undefined;
|
|
1300
1480
|
enabled?: boolean | undefined;
|
|
1301
|
-
metadata?: Record<string, unknown> | undefined;
|
|
1302
1481
|
}[];
|
|
1303
1482
|
roles: {
|
|
1304
1483
|
name: string;
|
|
@@ -1322,8 +1501,8 @@ declare const appConfigSchema: z.ZodObject<{
|
|
|
1322
1501
|
retries?: number | undefined;
|
|
1323
1502
|
condition?: "always" | "on-success" | "on-failure" | undefined;
|
|
1324
1503
|
}[];
|
|
1325
|
-
role?: string | undefined;
|
|
1326
1504
|
name?: string | undefined;
|
|
1505
|
+
role?: string | undefined;
|
|
1327
1506
|
objective?: string | undefined;
|
|
1328
1507
|
}[];
|
|
1329
1508
|
planner?: {
|
|
@@ -1340,24 +1519,29 @@ declare const appConfigSchema: z.ZodObject<{
|
|
|
1340
1519
|
name: string;
|
|
1341
1520
|
agents?: {
|
|
1342
1521
|
name: string;
|
|
1343
|
-
type?: "native" | "process" | "cli" | undefined;
|
|
1344
1522
|
metadata?: Record<string, unknown> | undefined;
|
|
1523
|
+
type?: "native" | "process" | "cli" | undefined;
|
|
1345
1524
|
command?: string | undefined;
|
|
1346
1525
|
args?: string[] | undefined;
|
|
1347
1526
|
cwd?: string | undefined;
|
|
1348
1527
|
env?: Record<string, string> | undefined;
|
|
1349
|
-
input_mode?: "
|
|
1528
|
+
input_mode?: "protocol" | "stdin" | "arg" | undefined;
|
|
1350
1529
|
timeout_ms?: number | undefined;
|
|
1351
1530
|
inherit_env?: boolean | undefined;
|
|
1531
|
+
env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
|
|
1532
|
+
env_allowlist?: string[] | undefined;
|
|
1533
|
+
env_denylist?: string[] | undefined;
|
|
1534
|
+
max_output_bytes?: number | undefined;
|
|
1535
|
+
allow_external_cwd?: boolean | undefined;
|
|
1352
1536
|
}[] | undefined;
|
|
1353
1537
|
providers?: {
|
|
1354
1538
|
name: string;
|
|
1355
1539
|
type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
|
|
1356
1540
|
base_url: string;
|
|
1541
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1357
1542
|
api_key_env_var?: string | undefined;
|
|
1358
1543
|
headers?: Record<string, string> | undefined;
|
|
1359
1544
|
enabled?: boolean | undefined;
|
|
1360
|
-
metadata?: Record<string, unknown> | undefined;
|
|
1361
1545
|
}[] | undefined;
|
|
1362
1546
|
roles?: {
|
|
1363
1547
|
name: string;
|
|
@@ -1381,8 +1565,8 @@ declare const appConfigSchema: z.ZodObject<{
|
|
|
1381
1565
|
retries?: number | undefined;
|
|
1382
1566
|
condition?: "always" | "on-success" | "on-failure" | undefined;
|
|
1383
1567
|
}[];
|
|
1384
|
-
role?: string | undefined;
|
|
1385
1568
|
name?: string | undefined;
|
|
1569
|
+
role?: string | undefined;
|
|
1386
1570
|
objective?: string | undefined;
|
|
1387
1571
|
}[] | undefined;
|
|
1388
1572
|
planner?: {
|
|
@@ -1409,7 +1593,7 @@ declare const appConfigSchema: z.ZodObject<{
|
|
|
1409
1593
|
agents: {
|
|
1410
1594
|
name: string;
|
|
1411
1595
|
type: "native" | "process" | "cli";
|
|
1412
|
-
input_mode: "
|
|
1596
|
+
input_mode: "protocol" | "stdin" | "arg";
|
|
1413
1597
|
metadata?: Record<string, unknown> | undefined;
|
|
1414
1598
|
command?: string | undefined;
|
|
1415
1599
|
args?: string[] | undefined;
|
|
@@ -1417,15 +1601,20 @@ declare const appConfigSchema: z.ZodObject<{
|
|
|
1417
1601
|
env?: Record<string, string> | undefined;
|
|
1418
1602
|
timeout_ms?: number | undefined;
|
|
1419
1603
|
inherit_env?: boolean | undefined;
|
|
1604
|
+
env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
|
|
1605
|
+
env_allowlist?: string[] | undefined;
|
|
1606
|
+
env_denylist?: string[] | undefined;
|
|
1607
|
+
max_output_bytes?: number | undefined;
|
|
1608
|
+
allow_external_cwd?: boolean | undefined;
|
|
1420
1609
|
}[];
|
|
1421
1610
|
providers: {
|
|
1422
1611
|
name: string;
|
|
1423
1612
|
type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
|
|
1424
1613
|
base_url: string;
|
|
1614
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1425
1615
|
api_key_env_var?: string | undefined;
|
|
1426
1616
|
headers?: Record<string, string> | undefined;
|
|
1427
1617
|
enabled?: boolean | undefined;
|
|
1428
|
-
metadata?: Record<string, unknown> | undefined;
|
|
1429
1618
|
}[];
|
|
1430
1619
|
roles: {
|
|
1431
1620
|
name: string;
|
|
@@ -1449,8 +1638,8 @@ declare const appConfigSchema: z.ZodObject<{
|
|
|
1449
1638
|
retries?: number | undefined;
|
|
1450
1639
|
condition?: "always" | "on-success" | "on-failure" | undefined;
|
|
1451
1640
|
}[];
|
|
1452
|
-
role?: string | undefined;
|
|
1453
1641
|
name?: string | undefined;
|
|
1642
|
+
role?: string | undefined;
|
|
1454
1643
|
objective?: string | undefined;
|
|
1455
1644
|
}[];
|
|
1456
1645
|
planner?: {
|
|
@@ -1472,24 +1661,29 @@ declare const appConfigSchema: z.ZodObject<{
|
|
|
1472
1661
|
name: string;
|
|
1473
1662
|
agents?: {
|
|
1474
1663
|
name: string;
|
|
1475
|
-
type?: "native" | "process" | "cli" | undefined;
|
|
1476
1664
|
metadata?: Record<string, unknown> | undefined;
|
|
1665
|
+
type?: "native" | "process" | "cli" | undefined;
|
|
1477
1666
|
command?: string | undefined;
|
|
1478
1667
|
args?: string[] | undefined;
|
|
1479
1668
|
cwd?: string | undefined;
|
|
1480
1669
|
env?: Record<string, string> | undefined;
|
|
1481
|
-
input_mode?: "
|
|
1670
|
+
input_mode?: "protocol" | "stdin" | "arg" | undefined;
|
|
1482
1671
|
timeout_ms?: number | undefined;
|
|
1483
1672
|
inherit_env?: boolean | undefined;
|
|
1673
|
+
env_policy?: "inherit" | "allowlist" | "denylist" | "explicit" | undefined;
|
|
1674
|
+
env_allowlist?: string[] | undefined;
|
|
1675
|
+
env_denylist?: string[] | undefined;
|
|
1676
|
+
max_output_bytes?: number | undefined;
|
|
1677
|
+
allow_external_cwd?: boolean | undefined;
|
|
1484
1678
|
}[] | undefined;
|
|
1485
1679
|
providers?: {
|
|
1486
1680
|
name: string;
|
|
1487
1681
|
type: "custom" | "openai-compatible" | "omnihilbras" | "openrouter" | "local";
|
|
1488
1682
|
base_url: string;
|
|
1683
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1489
1684
|
api_key_env_var?: string | undefined;
|
|
1490
1685
|
headers?: Record<string, string> | undefined;
|
|
1491
1686
|
enabled?: boolean | undefined;
|
|
1492
|
-
metadata?: Record<string, unknown> | undefined;
|
|
1493
1687
|
}[] | undefined;
|
|
1494
1688
|
roles?: {
|
|
1495
1689
|
name: string;
|
|
@@ -1513,8 +1707,8 @@ declare const appConfigSchema: z.ZodObject<{
|
|
|
1513
1707
|
retries?: number | undefined;
|
|
1514
1708
|
condition?: "always" | "on-success" | "on-failure" | undefined;
|
|
1515
1709
|
}[];
|
|
1516
|
-
role?: string | undefined;
|
|
1517
1710
|
name?: string | undefined;
|
|
1711
|
+
role?: string | undefined;
|
|
1518
1712
|
objective?: string | undefined;
|
|
1519
1713
|
}[] | undefined;
|
|
1520
1714
|
planner?: {
|
|
@@ -1662,12 +1856,21 @@ declare class OmniHilbrasProvider extends OpenAICompatibleProvider {
|
|
|
1662
1856
|
}
|
|
1663
1857
|
|
|
1664
1858
|
/**
|
|
1665
|
-
*
|
|
1666
|
-
*
|
|
1667
|
-
*
|
|
1668
|
-
*
|
|
1859
|
+
* Process adapter (§9): runs CLI agents as child processes and communicates
|
|
1860
|
+
* over stdin/stdout, managing the process lifecycle, working directory,
|
|
1861
|
+
* environment, exit codes, logs and timeouts.
|
|
1862
|
+
*
|
|
1863
|
+
* Three input modes (§9, §21):
|
|
1864
|
+
* - "stdin": the composed task text is written to the agent's stdin.
|
|
1865
|
+
* - "arg": the composed task text is appended as the last command argument.
|
|
1866
|
+
* - "protocol": NodeToAgentMessage envelopes as JSON lines on stdin; the
|
|
1867
|
+
* agent answers with AgentToNodeMessage JSON lines (REPORT,
|
|
1868
|
+
* COMPLETION, ERROR, ...) whose structured payloads are parsed
|
|
1869
|
+
* into reports.
|
|
1669
1870
|
*/
|
|
1670
|
-
|
|
1871
|
+
|
|
1872
|
+
/** Per-stream byte budget before output is truncated and the agent killed. */
|
|
1873
|
+
declare const DEFAULT_MAX_OUTPUT_BYTES: number;
|
|
1671
1874
|
declare function composeTaskText(input: AgentTaskInput): string;
|
|
1672
1875
|
declare class ProcessAgent implements IAgent {
|
|
1673
1876
|
readonly config: AgentConfig;
|
|
@@ -1680,6 +1883,63 @@ declare class ProcessAgent implements IAgent {
|
|
|
1680
1883
|
cancel(taskId: string): Promise<void>;
|
|
1681
1884
|
runningTaskIds(): string[];
|
|
1682
1885
|
}
|
|
1886
|
+
/** Kills a child and, on POSIX, its whole process group (roadmap §8 tree cleanup). */
|
|
1887
|
+
declare function killTree(child: ChildProcess, signal: NodeJS.Signals): void;
|
|
1888
|
+
/** Human-readable exit reason, including signal terminations. */
|
|
1889
|
+
declare function describeExit(code: number | null, signal: NodeJS.Signals | null): string;
|
|
1890
|
+
/**
|
|
1891
|
+
* Decodes a stdout/stderr chunk safely: invalid UTF-8 becomes replacement
|
|
1892
|
+
* characters and NUL bytes are stripped, so binary noise cannot poison the
|
|
1893
|
+
* protocol decoder or the terminal (roadmap §8, encoding hardening).
|
|
1894
|
+
*/
|
|
1895
|
+
declare function sanitizeChunk(chunk: Buffer): string;
|
|
1896
|
+
|
|
1897
|
+
/**
|
|
1898
|
+
* Agent environment policies (roadmap §8, Environment Isolation).
|
|
1899
|
+
*
|
|
1900
|
+
* Four explicit policies, so operators decide exactly what an agent can see:
|
|
1901
|
+
* - `inherit` (default, backwards compatible): the full parent environment
|
|
1902
|
+
* - `allowlist`: only the allow-listed variables (+ PATH/HOME)
|
|
1903
|
+
* - `denylist`: the parent environment minus the deny-listed variables
|
|
1904
|
+
* - `explicit`: nothing from the parent; only PATH/HOME and `env`
|
|
1905
|
+
*
|
|
1906
|
+
* The v1 boolean `inherit_env: false` is still honored and maps to `explicit`.
|
|
1907
|
+
*/
|
|
1908
|
+
|
|
1909
|
+
type EnvPolicy = "inherit" | "allowlist" | "denylist" | "explicit";
|
|
1910
|
+
declare function resolveEnvPolicy(config: Partial<AgentConfig>): EnvPolicy;
|
|
1911
|
+
declare function buildChildEnv(config: AgentConfig): NodeJS.ProcessEnv;
|
|
1912
|
+
|
|
1913
|
+
interface CwdValidation {
|
|
1914
|
+
/** Normalized absolute path. */
|
|
1915
|
+
cwd: string;
|
|
1916
|
+
/** True when the directory sits outside the project root (project boundary). */
|
|
1917
|
+
outsideProject: boolean;
|
|
1918
|
+
}
|
|
1919
|
+
declare function validateWorkingDirectory(cwd: string | undefined, options?: {
|
|
1920
|
+
projectRoot?: string;
|
|
1921
|
+
allowExternal?: boolean;
|
|
1922
|
+
}): CwdValidation | undefined;
|
|
1923
|
+
|
|
1924
|
+
interface IAgentAdapter {
|
|
1925
|
+
/** Integration type this adapter serves, e.g. "native" or "process". */
|
|
1926
|
+
readonly integration: string;
|
|
1927
|
+
create(config: AgentConfig): IAgent;
|
|
1928
|
+
}
|
|
1929
|
+
declare class AgentAdapterRegistry {
|
|
1930
|
+
private readonly adapters;
|
|
1931
|
+
register(adapter: IAgentAdapter): void;
|
|
1932
|
+
get(integration: string): IAgentAdapter | undefined;
|
|
1933
|
+
list(): IAgentAdapter[];
|
|
1934
|
+
create(config: AgentConfig): IAgent;
|
|
1935
|
+
}
|
|
1936
|
+
/** Process-level adapter — the built-in CLI integration. */
|
|
1937
|
+
declare class ProcessAgentAdapter implements IAgentAdapter {
|
|
1938
|
+
private readonly factory;
|
|
1939
|
+
readonly integration = "process";
|
|
1940
|
+
constructor(factory: (config: AgentConfig) => IAgent);
|
|
1941
|
+
create(config: AgentConfig): IAgent;
|
|
1942
|
+
}
|
|
1683
1943
|
|
|
1684
1944
|
/** Agent registry (§10): the set of agents connected to OmniNode. */
|
|
1685
1945
|
|
|
@@ -1695,10 +1955,109 @@ declare class AgentRegistry {
|
|
|
1695
1955
|
* "cli" agent configs are mapped to the process integration by the loader.
|
|
1696
1956
|
*/
|
|
1697
1957
|
|
|
1698
|
-
declare function createAgent(config: AgentConfig): IAgent;
|
|
1958
|
+
declare function createAgent(config: AgentConfig, adapters?: AgentAdapterRegistry): IAgent;
|
|
1959
|
+
|
|
1699
1960
|
/** Builds an agent registry from the project configuration, skipping agents that fail to construct. */
|
|
1700
1961
|
declare function buildAgentRegistry(config: AppConfig, log?: Logger): AgentRegistry;
|
|
1701
1962
|
|
|
1963
|
+
/**
|
|
1964
|
+
* OmniNode Agent Protocol v2 — versioning (roadmap §7.1).
|
|
1965
|
+
*
|
|
1966
|
+
* Protocol identifiers are namespaced strings so an agent can negotiate the
|
|
1967
|
+
* dialect it speaks: `omninode-agent-protocol/2`.
|
|
1968
|
+
*/
|
|
1969
|
+
declare const PROTOCOL_V2 = "omninode-agent-protocol/2";
|
|
1970
|
+
/** Versions this build accepts. v1 is the unversioned dialect shipped with OmniNode 1.x. */
|
|
1971
|
+
declare const SUPPORTED_PROTOCOL_VERSIONS: readonly string[];
|
|
1972
|
+
declare const MAX_MESSAGE_BYTES = 1048576;
|
|
1973
|
+
declare function isSupportedProtocol(protocol: string): boolean;
|
|
1974
|
+
|
|
1975
|
+
type ProtocolViolationCode = "INVALID_JSON" | "NOT_AN_OBJECT" | "UNKNOWN_TYPE" | "MISSING_FIELD" | "UNSUPPORTED_VERSION" | "OVERSIZED" | "INVALID_PAYLOAD";
|
|
1976
|
+
interface ProtocolViolation {
|
|
1977
|
+
code: ProtocolViolationCode;
|
|
1978
|
+
message: string;
|
|
1979
|
+
/** Raw line (truncated) for diagnostics. */
|
|
1980
|
+
sample?: string;
|
|
1981
|
+
}
|
|
1982
|
+
type DecodeResult = {
|
|
1983
|
+
ok: true;
|
|
1984
|
+
envelope: ProtocolEnvelope;
|
|
1985
|
+
legacy: boolean;
|
|
1986
|
+
} | {
|
|
1987
|
+
ok: false;
|
|
1988
|
+
error: ProtocolViolation;
|
|
1989
|
+
};
|
|
1990
|
+
/** Validates one decoded JSON value as a protocol envelope. */
|
|
1991
|
+
declare function validateEnvelope(value: unknown, line?: string): DecodeResult;
|
|
1992
|
+
/** Decodes one protocol line (no trailing newline). */
|
|
1993
|
+
declare function decodeMessage(line: string, maxBytes?: number): DecodeResult;
|
|
1994
|
+
/** Serializes an envelope to a single JSON line. */
|
|
1995
|
+
declare function encodeMessage(envelope: ProtocolEnvelope, maxBytes?: number): string;
|
|
1996
|
+
/**
|
|
1997
|
+
* Streaming line decoder for agent stdout. Feed chunks; receive decoded
|
|
1998
|
+
* envelopes and violations in order. Survives garbage: a bad line yields a
|
|
1999
|
+
* violation and the stream continues.
|
|
2000
|
+
*/
|
|
2001
|
+
declare class ProtocolDecoder {
|
|
2002
|
+
private buffer;
|
|
2003
|
+
private readonly maxBytes;
|
|
2004
|
+
constructor(maxBytes?: number);
|
|
2005
|
+
push(chunk: string): DecodeResult[];
|
|
2006
|
+
/** Flush any trailing line when the process exits. */
|
|
2007
|
+
flush(): DecodeResult[];
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
/**
|
|
2011
|
+
* OmniNode Agent Protocol v2 — session (roadmap §7.6).
|
|
2012
|
+
*
|
|
2013
|
+
* A session drives a protocol-mode agent: it emits v2 envelopes with
|
|
2014
|
+
* correlation ids, tolerates legacy (unversioned) replies, answers agent
|
|
2015
|
+
* questions through a responder callback, and collects reports, artifacts
|
|
2016
|
+
* and the completion — never throwing on malformed input.
|
|
2017
|
+
*/
|
|
2018
|
+
|
|
2019
|
+
interface SessionIds {
|
|
2020
|
+
requestId: string;
|
|
2021
|
+
taskId: string;
|
|
2022
|
+
agentId: string;
|
|
2023
|
+
pipelineId?: string;
|
|
2024
|
+
executionId?: string;
|
|
2025
|
+
}
|
|
2026
|
+
interface QuestionResponder {
|
|
2027
|
+
(question: {
|
|
2028
|
+
questionId: string;
|
|
2029
|
+
question: string;
|
|
2030
|
+
expected?: string;
|
|
2031
|
+
}): Promise<string> | string;
|
|
2032
|
+
}
|
|
2033
|
+
declare class ProtocolSession {
|
|
2034
|
+
readonly decoder: ProtocolDecoder;
|
|
2035
|
+
private readonly ids;
|
|
2036
|
+
private readonly responder;
|
|
2037
|
+
readonly violations: ProtocolViolation[];
|
|
2038
|
+
readonly questions: AskedQuestion[];
|
|
2039
|
+
readonly artifacts: ProtocolEnvelope["payload"][];
|
|
2040
|
+
reports: ProtocolEnvelope["payload"][];
|
|
2041
|
+
descriptor?: AgentDescriptor;
|
|
2042
|
+
completionSummary?: string;
|
|
2043
|
+
errorMessage?: string;
|
|
2044
|
+
constructor(ids: SessionIds, options?: {
|
|
2045
|
+
responder?: QuestionResponder;
|
|
2046
|
+
maxBytes?: number;
|
|
2047
|
+
});
|
|
2048
|
+
/** The v2 messages OmniNode sends to open a task (written to the agent's stdin). */
|
|
2049
|
+
taskMessages(objective: string, role?: unknown, context?: string, instruction?: string): string[];
|
|
2050
|
+
helloAck(descriptor: AgentDescriptor): string;
|
|
2051
|
+
/** Consumes decoded stdout, answering questions as they arrive. */
|
|
2052
|
+
handle(decoded: DecodeResult): Promise<void>;
|
|
2053
|
+
private answerQuestion;
|
|
2054
|
+
readonly pendingAnswers: string[];
|
|
2055
|
+
/** True once any inbound message carried the v2 protocol field. */
|
|
2056
|
+
sawV2: boolean;
|
|
2057
|
+
}
|
|
2058
|
+
declare function decodeStream(session: ProtocolSession, chunk: string): Promise<string[]>;
|
|
2059
|
+
declare function requireCompletion(session: ProtocolSession): void;
|
|
2060
|
+
|
|
1702
2061
|
/** Role registry (§11): the set of roles available for task assignment. */
|
|
1703
2062
|
|
|
1704
2063
|
declare class RoleRegistry {
|
|
@@ -2150,6 +2509,6 @@ declare class ProjectStores {
|
|
|
2150
2509
|
constructor(directory?: string);
|
|
2151
2510
|
}
|
|
2152
2511
|
|
|
2153
|
-
declare const OMNINODE_VERSION = "2.0.0-alpha.
|
|
2512
|
+
declare const OMNINODE_VERSION = "2.0.0-alpha.4";
|
|
2154
2513
|
|
|
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 };
|
|
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 };
|