va-agent-protocol 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +558 -0
  3. package/bin/va-orchestrate.mjs +153 -0
  4. package/dist/adapter/agent-adapter.d.ts +79 -0
  5. package/dist/adapter/agent-adapter.d.ts.map +1 -0
  6. package/dist/adapter/agent-adapter.js +36 -0
  7. package/dist/adapter/agent-adapter.js.map +1 -0
  8. package/dist/adapter/codex-adapter.d.ts +54 -0
  9. package/dist/adapter/codex-adapter.d.ts.map +1 -0
  10. package/dist/adapter/codex-adapter.js +409 -0
  11. package/dist/adapter/codex-adapter.js.map +1 -0
  12. package/dist/adapter/va-auto-pilot-adapter.d.ts +51 -0
  13. package/dist/adapter/va-auto-pilot-adapter.d.ts.map +1 -0
  14. package/dist/adapter/va-auto-pilot-adapter.js +275 -0
  15. package/dist/adapter/va-auto-pilot-adapter.js.map +1 -0
  16. package/dist/index.d.ts +17 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +15 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/orchestrator/orchestrator.d.ts +101 -0
  21. package/dist/orchestrator/orchestrator.d.ts.map +1 -0
  22. package/dist/orchestrator/orchestrator.js +452 -0
  23. package/dist/orchestrator/orchestrator.js.map +1 -0
  24. package/dist/orchestrator/registry.d.ts +39 -0
  25. package/dist/orchestrator/registry.d.ts.map +1 -0
  26. package/dist/orchestrator/registry.js +62 -0
  27. package/dist/orchestrator/registry.js.map +1 -0
  28. package/dist/orchestrator/scheduler.d.ts +66 -0
  29. package/dist/orchestrator/scheduler.d.ts.map +1 -0
  30. package/dist/orchestrator/scheduler.js +155 -0
  31. package/dist/orchestrator/scheduler.js.map +1 -0
  32. package/dist/test/orchestrator-enqueue.test.d.ts +2 -0
  33. package/dist/test/orchestrator-enqueue.test.d.ts.map +1 -0
  34. package/dist/test/orchestrator-enqueue.test.js +64 -0
  35. package/dist/test/orchestrator-enqueue.test.js.map +1 -0
  36. package/dist/test/orchestrator-lifecycle.test.d.ts +2 -0
  37. package/dist/test/orchestrator-lifecycle.test.d.ts.map +1 -0
  38. package/dist/test/orchestrator-lifecycle.test.js +227 -0
  39. package/dist/test/orchestrator-lifecycle.test.js.map +1 -0
  40. package/dist/test/scheduler.test.d.ts +2 -0
  41. package/dist/test/scheduler.test.d.ts.map +1 -0
  42. package/dist/test/scheduler.test.js +140 -0
  43. package/dist/test/scheduler.test.js.map +1 -0
  44. package/dist/types/index.d.ts +209 -0
  45. package/dist/types/index.d.ts.map +1 -0
  46. package/dist/types/index.js +45 -0
  47. package/dist/types/index.js.map +1 -0
  48. package/dist/utils/logger.d.ts +17 -0
  49. package/dist/utils/logger.d.ts.map +1 -0
  50. package/dist/utils/logger.js +21 -0
  51. package/dist/utils/logger.js.map +1 -0
  52. package/package.json +61 -0
  53. package/schemas/agent-capability.schema.json +99 -0
  54. package/schemas/evidence.schema.json +201 -0
  55. package/schemas/lifecycle.schema.json +80 -0
  56. package/schemas/message.schema.json +181 -0
  57. package/schemas/task-unit.schema.json +137 -0
@@ -0,0 +1,209 @@
1
+ /**
2
+ * va-agent-protocol — TypeScript type definitions
3
+ *
4
+ * These types mirror the JSON Schemas in /schemas/.
5
+ * Schemas are the source of truth; these provide compile-time safety.
6
+ */
7
+ export interface Pitfall {
8
+ id: string;
9
+ failureType: "gate" | "acceptance" | "review" | "timeout" | "crash" | "unknown";
10
+ attempted: string;
11
+ hypothesis: string;
12
+ missingContext?: string;
13
+ }
14
+ export interface TaskContext {
15
+ codebaseRoot?: string;
16
+ files?: string[];
17
+ history?: string[];
18
+ pitfalls?: Pitfall[];
19
+ }
20
+ export type Priority = "P0" | "P1" | "P2" | "P3";
21
+ /** Reference to an output from a dependency task. Resolved by orchestrator before dispatch. */
22
+ export interface InputRef {
23
+ fromTask: string;
24
+ outputKey: string;
25
+ }
26
+ /** Check if a value is an InputRef (fromTask reference). */
27
+ export declare function isInputRef(value: unknown): value is InputRef;
28
+ export interface OutputContract {
29
+ /** Output keys this task promises to produce (stored in evidence.outputs). */
30
+ keys: string[];
31
+ }
32
+ export interface TaskUnit {
33
+ id: string;
34
+ objective: string;
35
+ constraints?: string[];
36
+ acceptanceCriteria: string[];
37
+ context?: TaskContext;
38
+ priority?: Priority;
39
+ dependsOn?: string[];
40
+ timeout?: number;
41
+ /** Named inputs. Values are static (any JSON) or InputRef (resolved by orchestrator from dependency outputs). */
42
+ inputs?: Record<string, unknown>;
43
+ /** Declares what structured outputs this task will produce. */
44
+ outputContract?: OutputContract;
45
+ metadata?: Record<string, unknown>;
46
+ }
47
+ export type InterfaceType = "cli" | "http" | "stdio";
48
+ export type ModelRequirement = "frontier" | "strong" | "any";
49
+ export interface AgentInterface {
50
+ type: InterfaceType;
51
+ command: string;
52
+ workingDirectory?: string;
53
+ env?: Record<string, string>;
54
+ }
55
+ export interface AgentConstraints {
56
+ maxConcurrent?: number;
57
+ requiresNetwork?: boolean;
58
+ requiresHumanApproval?: string[];
59
+ maxRetries?: number;
60
+ }
61
+ export interface AgentCapability {
62
+ agentId: string;
63
+ name: string;
64
+ version: string;
65
+ capabilities: string[];
66
+ modelRequirement?: ModelRequirement;
67
+ interface: AgentInterface;
68
+ constraints?: AgentConstraints;
69
+ }
70
+ export type TaskState = "pending" | "running" | "completed" | "failed" | "blocked" | "cancelled";
71
+ export declare const VALID_TRANSITIONS: Record<TaskState, TaskState[]>;
72
+ export interface StateTransition {
73
+ from: TaskState;
74
+ to: TaskState;
75
+ timestamp: string;
76
+ reason?: string;
77
+ actor?: string;
78
+ }
79
+ export interface TaskExecution {
80
+ taskId: string;
81
+ correlationId: string;
82
+ agentId?: string;
83
+ currentState: TaskState;
84
+ attempt?: number;
85
+ transitions: StateTransition[];
86
+ startedAt?: string;
87
+ completedAt?: string;
88
+ }
89
+ export type ArtifactType = "file" | "commit" | "report" | "diff" | "log";
90
+ export interface Artifact {
91
+ type: ArtifactType;
92
+ path?: string;
93
+ description: string;
94
+ }
95
+ export type GateType = "command" | "model-evaluation";
96
+ export type GateSeverity = "error" | "warning";
97
+ export interface GateResult {
98
+ gate: string;
99
+ /** Gate type. 'command' = CLI exit code. 'model-evaluation' = agent/model-as-judge with score. */
100
+ type?: GateType;
101
+ /** CLI command that was run. Required for type='command'. */
102
+ command?: string;
103
+ exitCode?: number;
104
+ passed: boolean;
105
+ output?: string;
106
+ durationMs?: number;
107
+ /** Agent/model ID that performed evaluation. For type='model-evaluation'. */
108
+ evaluator?: string;
109
+ /** Evaluation score (0.0–1.0). For type='model-evaluation'. */
110
+ score?: number;
111
+ /** Score threshold for passing. score >= threshold → passed. */
112
+ threshold?: number;
113
+ /** Soft threshold. Score between softThreshold and threshold = warning, not hard fail. */
114
+ softThreshold?: number;
115
+ /** When passed=false: 'error' = hard fail (retry), 'warning' = soft fail (consider blocked). */
116
+ severity?: GateSeverity;
117
+ /** Human-readable explanation. For type='model-evaluation'. */
118
+ rationale?: string;
119
+ }
120
+ export type FailureType = "gate" | "acceptance" | "review" | "timeout" | "crash" | "unknown";
121
+ export interface DimensionFeedback {
122
+ score?: number;
123
+ status: "ok" | "mismatch" | "missing";
124
+ detail?: string;
125
+ }
126
+ export interface FailureDetail {
127
+ failureType: FailureType;
128
+ attempted: string;
129
+ hypothesis: string;
130
+ missingContext?: string;
131
+ /** Per-dimension breakdown. Enables targeted retry on specific dimensions. */
132
+ dimensions?: Record<string, DimensionFeedback>;
133
+ }
134
+ export type BlockType = "human-decision" | "external-resource" | "dependency" | "permission";
135
+ export interface BlockReason {
136
+ type: BlockType;
137
+ description: string;
138
+ requiredAction?: string;
139
+ }
140
+ export type EvidenceStatus = "completed" | "failed" | "blocked";
141
+ export interface Evidence {
142
+ taskId: string;
143
+ status: EvidenceStatus;
144
+ artifacts?: Artifact[];
145
+ gateResults?: GateResult[];
146
+ verification?: string;
147
+ failureDetail?: FailureDetail;
148
+ blockReason?: BlockReason;
149
+ /** Structured outputs produced by this task. Downstream tasks reference these via inputs[].fromTask. */
150
+ outputs?: Record<string, unknown>;
151
+ }
152
+ export type MessageType = "dispatch" | "accepted" | "progress" | "completed" | "failed" | "blocked" | "cancel";
153
+ export interface DispatchPayload {
154
+ task: TaskUnit;
155
+ }
156
+ export interface AcceptedPayload {
157
+ taskId: string;
158
+ estimatedCapabilities?: string[];
159
+ }
160
+ export interface ProgressPayload {
161
+ taskId: string;
162
+ phase?: string;
163
+ summary?: string;
164
+ completionEstimate?: number;
165
+ /** Structured log entries from the agent's execution. */
166
+ logs?: ProgressLog[];
167
+ /** Key-value data the agent wants to expose to the orchestrator/UI. */
168
+ data?: Record<string, unknown>;
169
+ /** The agent currently handling this task (populated by orchestrator). */
170
+ agentId?: string;
171
+ }
172
+ export interface ProgressLog {
173
+ timestamp: string;
174
+ level: "info" | "warn" | "error" | "debug";
175
+ message: string;
176
+ }
177
+ export interface CompletedPayload {
178
+ evidence: Evidence;
179
+ }
180
+ export interface FailedPayload {
181
+ evidence: Evidence;
182
+ retryable?: boolean;
183
+ }
184
+ export interface BlockedPayload {
185
+ evidence: Evidence;
186
+ }
187
+ export interface CancelPayload {
188
+ taskId: string;
189
+ reason?: string;
190
+ }
191
+ export type MessagePayload = DispatchPayload | AcceptedPayload | ProgressPayload | CompletedPayload | FailedPayload | BlockedPayload | CancelPayload;
192
+ export interface ProtocolMessage<T extends MessagePayload = MessagePayload> {
193
+ protocol: "va-agent-protocol";
194
+ version: string;
195
+ type: MessageType;
196
+ timestamp: string;
197
+ correlationId: string;
198
+ sourceId?: string;
199
+ payload: T;
200
+ }
201
+ export declare const PROTOCOL_NAME: "va-agent-protocol";
202
+ export declare const PROTOCOL_VERSION: "0.1.0";
203
+ /** Create a protocol message with defaults filled in. */
204
+ export declare function createMessage<T extends MessagePayload>(type: MessageType, correlationId: string, payload: T, sourceId?: string): ProtocolMessage<T>;
205
+ /** Validate a state transition. */
206
+ export declare function isValidTransition(from: TaskState, to: TaskState): boolean;
207
+ /** Generate a correlation ID. */
208
+ export declare function generateCorrelationId(): string;
209
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IAChF,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB;AAED,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEjD,+FAA+F;AAC/F,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,4DAA4D;AAC5D,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAO5D;AAED,MAAM,WAAW,cAAc;IAC7B,8EAA8E;IAC9E,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,MA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,cAAc,GACtB,eAAe,GACf,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,aAAa,GACb,cAAc,GACd,aAAa,CAAC;AAElB,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc;IACxE,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,CAAC,CAAC;CACZ;AAID,eAAO,MAAM,aAAa,EAAG,mBAA4B,CAAC;AAC1D,eAAO,MAAM,gBAAgB,EAAG,OAAgB,CAAC;AAEjD,yDAAyD;AACzD,wBAAgB,aAAa,CAAC,CAAC,SAAS,cAAc,EACpD,IAAI,EAAE,WAAW,EACjB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,CAAC,EACV,QAAQ,CAAC,EAAE,MAAM,GAChB,eAAe,CAAC,CAAC,CAAC,CAUpB;AAED,mCAAmC;AACnC,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAEzE;AAED,iCAAiC;AACjC,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * va-agent-protocol — TypeScript type definitions
3
+ *
4
+ * These types mirror the JSON Schemas in /schemas/.
5
+ * Schemas are the source of truth; these provide compile-time safety.
6
+ */
7
+ /** Check if a value is an InputRef (fromTask reference). */
8
+ export function isInputRef(value) {
9
+ return (typeof value === "object" &&
10
+ value !== null &&
11
+ "fromTask" in value &&
12
+ "outputKey" in value);
13
+ }
14
+ export const VALID_TRANSITIONS = {
15
+ pending: ["running", "cancelled"],
16
+ running: ["completed", "failed", "blocked", "cancelled"],
17
+ blocked: ["running", "failed", "cancelled"],
18
+ completed: [],
19
+ failed: ["running"],
20
+ cancelled: [],
21
+ };
22
+ // ─── Helpers ─────────────────────────────────────────────────────────────────
23
+ export const PROTOCOL_NAME = "va-agent-protocol";
24
+ export const PROTOCOL_VERSION = "0.1.0";
25
+ /** Create a protocol message with defaults filled in. */
26
+ export function createMessage(type, correlationId, payload, sourceId) {
27
+ return {
28
+ protocol: PROTOCOL_NAME,
29
+ version: PROTOCOL_VERSION,
30
+ type,
31
+ timestamp: new Date().toISOString(),
32
+ correlationId,
33
+ sourceId,
34
+ payload,
35
+ };
36
+ }
37
+ /** Validate a state transition. */
38
+ export function isValidTransition(from, to) {
39
+ return VALID_TRANSITIONS[from]?.includes(to) ?? false;
40
+ }
41
+ /** Generate a correlation ID. */
42
+ export function generateCorrelationId() {
43
+ return `${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
44
+ }
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2BH,4DAA4D;AAC5D,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,UAAU,IAAI,KAAK;QACnB,WAAW,IAAI,KAAK,CACrB,CAAC;AACJ,CAAC;AA8DD,MAAM,CAAC,MAAM,iBAAiB,GAAmC;IAC/D,OAAO,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC;IACjC,OAAO,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC;IACxD,OAAO,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC;IAC3C,SAAS,EAAE,EAAE;IACb,MAAM,EAAE,CAAC,SAAS,CAAC;IACnB,SAAS,EAAE,EAAE;CACd,CAAC;AAuLF,gFAAgF;AAEhF,MAAM,CAAC,MAAM,aAAa,GAAG,mBAA4B,CAAC;AAC1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAgB,CAAC;AAEjD,yDAAyD;AACzD,MAAM,UAAU,aAAa,CAC3B,IAAiB,EACjB,aAAqB,EACrB,OAAU,EACV,QAAiB;IAEjB,OAAO;QACL,QAAQ,EAAE,aAAa;QACvB,OAAO,EAAE,gBAAgB;QACzB,IAAI;QACJ,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,aAAa;QACb,QAAQ;QACR,OAAO;KACR,CAAC;AACJ,CAAC;AAED,mCAAmC;AACnC,MAAM,UAAU,iBAAiB,CAAC,IAAe,EAAE,EAAa;IAC9D,OAAO,iBAAiB,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC;AACxD,CAAC;AAED,iCAAiC;AACjC,MAAM,UAAU,qBAAqB;IACnC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AACpE,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Logger — configurable logging interface for library consumers.
3
+ *
4
+ * Libraries should never spam stdout. All internal logging goes through
5
+ * this interface so consumers can redirect, filter, or silence output.
6
+ */
7
+ export interface Logger {
8
+ debug(message: string, ...args: unknown[]): void;
9
+ info(message: string, ...args: unknown[]): void;
10
+ warn(message: string, ...args: unknown[]): void;
11
+ error(message: string, ...args: unknown[]): void;
12
+ }
13
+ /** Default logger that delegates to console. */
14
+ export declare const consoleLogger: Logger;
15
+ /** Silent logger that discards all output. */
16
+ export declare const noopLogger: Logger;
17
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CAClD;AAED,gDAAgD;AAChD,eAAO,MAAM,aAAa,EAAE,MAK3B,CAAC;AAEF,8CAA8C;AAC9C,eAAO,MAAM,UAAU,EAAE,MAKxB,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Logger — configurable logging interface for library consumers.
3
+ *
4
+ * Libraries should never spam stdout. All internal logging goes through
5
+ * this interface so consumers can redirect, filter, or silence output.
6
+ */
7
+ /** Default logger that delegates to console. */
8
+ export const consoleLogger = {
9
+ debug: (message, ...args) => console.debug(message, ...args),
10
+ info: (message, ...args) => console.log(message, ...args),
11
+ warn: (message, ...args) => console.warn(message, ...args),
12
+ error: (message, ...args) => console.error(message, ...args),
13
+ };
14
+ /** Silent logger that discards all output. */
15
+ export const noopLogger = {
16
+ debug: () => { },
17
+ info: () => { },
18
+ warn: () => { },
19
+ error: () => { },
20
+ };
21
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,gDAAgD;AAChD,MAAM,CAAC,MAAM,aAAa,GAAW;IACnC,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IAC5D,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IACzD,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IAC1D,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;CAC7D,CAAC;AAEF,8CAA8C;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAW;IAChC,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;IACf,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;CAChB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "va-agent-protocol",
3
+ "version": "0.1.0",
4
+ "description": "Universal agent task protocol — the USB interface for CLI agents",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "engines": {
9
+ "node": ">=20"
10
+ },
11
+ "bin": {
12
+ "va-orchestrate": "./bin/va-orchestrate.mjs"
13
+ },
14
+ "exports": {
15
+ ".": "./dist/index.js",
16
+ "./schemas/*": "./schemas/*"
17
+ },
18
+ "files": [
19
+ "dist/",
20
+ "schemas/",
21
+ "bin/",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "scripts": {
26
+ "build": "tsc",
27
+ "check": "tsc --noEmit",
28
+ "test": "node --test dist/**/*.test.js",
29
+ "test:schemas": "node dist/test/schema-validation.test.js",
30
+ "example": "npm run build && npx tsx examples/full-lifecycle.ts",
31
+ "example:codex": "npm run build && npx tsx examples/codex-real.ts"
32
+ },
33
+ "dependencies": {
34
+ "ajv": "^8.17.1",
35
+ "yaml": "^2.8.2"
36
+ },
37
+ "optionalDependencies": {
38
+ "va-auto-pilot": "file:../auto-pilot"
39
+ },
40
+ "devDependencies": {
41
+ "@types/node": "^22.0.0",
42
+ "tsx": "^4.21.0",
43
+ "typescript": "^5.7.0"
44
+ },
45
+ "keywords": [
46
+ "agent-protocol",
47
+ "cli-agent",
48
+ "task-delegation",
49
+ "orchestration"
50
+ ],
51
+ "license": "MIT",
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "https://github.com/Vadaski/va-agent-protocol.git"
55
+ },
56
+ "homepage": "https://github.com/Vadaski/va-agent-protocol#readme",
57
+ "bugs": {
58
+ "url": "https://github.com/Vadaski/va-agent-protocol/issues"
59
+ },
60
+ "author": "Vadaski"
61
+ }
@@ -0,0 +1,99 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://va-agent-protocol.dev/schemas/agent-capability.schema.json",
4
+ "title": "AgentCapability",
5
+ "description": "Declares what an agent can do and how to invoke it. Like a USB device descriptor.",
6
+ "type": "object",
7
+ "required": ["agentId", "name", "version", "capabilities", "interface"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "agentId": {
11
+ "type": "string",
12
+ "description": "Unique identifier for this agent instance."
13
+ },
14
+ "name": {
15
+ "type": "string",
16
+ "description": "Human-readable agent name."
17
+ },
18
+ "version": {
19
+ "type": "string",
20
+ "description": "Semantic version of this agent."
21
+ },
22
+ "capabilities": {
23
+ "type": "array",
24
+ "items": { "type": "string" },
25
+ "minItems": 1,
26
+ "description": "What this agent can do. Well-known values: 'code-generation', 'code-review', 'testing', 'deployment', 'refactoring', 'documentation', 'security-audit', 'strategic-decomposition'. Custom values allowed."
27
+ },
28
+ "modelRequirement": {
29
+ "type": "string",
30
+ "enum": ["frontier", "strong", "any"],
31
+ "default": "any",
32
+ "description": "'frontier' = requires top-tier model (Opus 4.6+), 'strong' = requires capable model, 'any' = model-agnostic."
33
+ },
34
+ "interface": {
35
+ "$ref": "#/$defs/AgentInterface",
36
+ "description": "How to invoke this agent."
37
+ },
38
+ "constraints": {
39
+ "$ref": "#/$defs/AgentConstraints",
40
+ "description": "Operational limits."
41
+ }
42
+ },
43
+ "$defs": {
44
+ "AgentInterface": {
45
+ "type": "object",
46
+ "required": ["type", "command"],
47
+ "additionalProperties": false,
48
+ "properties": {
49
+ "type": {
50
+ "type": "string",
51
+ "enum": ["cli", "http", "stdio"],
52
+ "description": "'cli' = invoke via subprocess, 'http' = REST endpoint, 'stdio' = stdin/stdout streaming."
53
+ },
54
+ "command": {
55
+ "type": "string",
56
+ "description": "Base command or URL. For CLI: the executable + base args. For HTTP: the base URL."
57
+ },
58
+ "workingDirectory": {
59
+ "type": "string",
60
+ "description": "Working directory for CLI agents."
61
+ },
62
+ "env": {
63
+ "type": "object",
64
+ "additionalProperties": { "type": "string" },
65
+ "description": "Environment variables to set when invoking."
66
+ }
67
+ }
68
+ },
69
+ "AgentConstraints": {
70
+ "type": "object",
71
+ "additionalProperties": false,
72
+ "properties": {
73
+ "maxConcurrent": {
74
+ "type": "integer",
75
+ "minimum": 1,
76
+ "default": 1,
77
+ "description": "Maximum concurrent tasks this agent can handle."
78
+ },
79
+ "requiresNetwork": {
80
+ "type": "boolean",
81
+ "default": false,
82
+ "description": "Whether the agent needs network access."
83
+ },
84
+ "requiresHumanApproval": {
85
+ "type": "array",
86
+ "items": { "type": "string" },
87
+ "default": [],
88
+ "description": "Actions that require human confirmation before execution."
89
+ },
90
+ "maxRetries": {
91
+ "type": "integer",
92
+ "minimum": 0,
93
+ "default": 3,
94
+ "description": "Maximum retry attempts on failure."
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }