@sw4rm/js-sdk 0.4.0 → 0.5.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.
- package/README.md +13 -0
- package/dist/cjs/index.cjs +1220 -178
- package/dist/esm/index.js +1174 -172
- package/dist/types/agentConfig.d.ts +245 -0
- package/dist/types/audit.d.ts +214 -0
- package/dist/types/clients/negotiationRoom.d.ts +81 -5
- package/dist/types/clients/negotiationRoomStore.d.ts +155 -0
- package/dist/types/clients/workflow.d.ts +15 -0
- package/dist/types/constants/index.d.ts +100 -0
- package/dist/types/index.d.ts +10 -5
- package/dist/types/internal/baseClient.d.ts +6 -0
- package/dist/types/internal/envelope.d.ts +16 -0
- package/dist/types/internal/errorMapping.d.ts +114 -0
- package/dist/types/internal/worktreeState.d.ts +60 -0
- package/dist/types/persistentActivityBuffer.d.ts +94 -0
- package/package.json +4 -2
- package/protos/activity.proto +24 -0
- package/protos/common.proto +134 -0
- package/protos/connector.proto +29 -0
- package/protos/handoff.proto +63 -0
- package/protos/hitl.proto +23 -0
- package/protos/logging.proto +20 -0
- package/protos/negotiation.proto +57 -0
- package/protos/negotiation_room.proto +220 -0
- package/protos/policy.proto +55 -0
- package/protos/reasoning.proto +41 -0
- package/protos/registry.proto +36 -0
- package/protos/router.proto +16 -0
- package/protos/scheduler.proto +52 -0
- package/protos/scheduler_policy.proto +36 -0
- package/protos/tool.proto +47 -0
- package/protos/workflow.proto +116 -0
- package/protos/worktree.proto +33 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package sw4rm.activity;
|
|
4
|
+
|
|
5
|
+
message Artifact {
|
|
6
|
+
string negotiation_id = 1;
|
|
7
|
+
string kind = 2; // contract|diff|decision|score|note
|
|
8
|
+
string version = 3; // e.g., v3
|
|
9
|
+
string content_type = 4;
|
|
10
|
+
bytes content = 5;
|
|
11
|
+
string created_at = 6; // ISO-8601
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
message AppendArtifactRequest { Artifact artifact = 1; }
|
|
15
|
+
message AppendArtifactResponse { bool ok = 1; string reason = 2; }
|
|
16
|
+
|
|
17
|
+
message ListArtifactsRequest { string negotiation_id = 1; string kind = 2; }
|
|
18
|
+
message ListArtifactsResponse { repeated Artifact items = 1; }
|
|
19
|
+
|
|
20
|
+
service ActivityService {
|
|
21
|
+
rpc AppendArtifact(AppendArtifactRequest) returns (AppendArtifactResponse);
|
|
22
|
+
rpc ListArtifacts(ListArtifactsRequest) returns (ListArtifactsResponse);
|
|
23
|
+
}
|
|
24
|
+
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package sw4rm.common;
|
|
4
|
+
|
|
5
|
+
import "google/protobuf/timestamp.proto";
|
|
6
|
+
import "google/protobuf/duration.proto";
|
|
7
|
+
|
|
8
|
+
enum MessageType {
|
|
9
|
+
MESSAGE_TYPE_UNSPECIFIED = 0;
|
|
10
|
+
CONTROL = 1;
|
|
11
|
+
DATA = 2;
|
|
12
|
+
HEARTBEAT = 3;
|
|
13
|
+
NOTIFICATION = 4;
|
|
14
|
+
ACKNOWLEDGEMENT = 5;
|
|
15
|
+
HITL_INVOCATION = 6;
|
|
16
|
+
WORKTREE_CONTROL = 7;
|
|
17
|
+
NEGOTIATION = 8;
|
|
18
|
+
TOOL_CALL = 9;
|
|
19
|
+
TOOL_RESULT = 10;
|
|
20
|
+
TOOL_ERROR = 11;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
enum AckStage {
|
|
24
|
+
ACK_STAGE_UNSPECIFIED = 0;
|
|
25
|
+
RECEIVED = 1;
|
|
26
|
+
READ = 2;
|
|
27
|
+
FULFILLED = 3;
|
|
28
|
+
REJECTED = 4;
|
|
29
|
+
FAILED = 5;
|
|
30
|
+
TIMED_OUT = 6;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
enum ErrorCode {
|
|
34
|
+
ERROR_CODE_UNSPECIFIED = 0;
|
|
35
|
+
BUFFER_FULL = 1;
|
|
36
|
+
NO_ROUTE = 2;
|
|
37
|
+
ACK_TIMEOUT = 3;
|
|
38
|
+
AGENT_UNAVAILABLE = 4;
|
|
39
|
+
AGENT_SHUTDOWN = 5;
|
|
40
|
+
VALIDATION_ERROR = 6;
|
|
41
|
+
PERMISSION_DENIED = 7;
|
|
42
|
+
UNSUPPORTED_MESSAGE_TYPE = 8;
|
|
43
|
+
OVERSIZE_PAYLOAD = 9;
|
|
44
|
+
TOOL_TIMEOUT = 10;
|
|
45
|
+
PARTIAL_DELIVERY = 11; // reserved
|
|
46
|
+
FORCED_PREEMPTION = 12;
|
|
47
|
+
TTL_EXPIRED = 13;
|
|
48
|
+
DUPLICATE_DETECTED = 14;
|
|
49
|
+
ALREADY_IN_PROGRESS = 15;
|
|
50
|
+
INTERNAL_ERROR = 99;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
enum AgentState {
|
|
54
|
+
AGENT_STATE_UNSPECIFIED = 0;
|
|
55
|
+
INITIALIZING = 1;
|
|
56
|
+
RUNNABLE = 2;
|
|
57
|
+
SCHEDULED = 3;
|
|
58
|
+
RUNNING = 4;
|
|
59
|
+
WAITING = 5;
|
|
60
|
+
WAITING_RESOURCES = 6;
|
|
61
|
+
SUSPENDED = 7;
|
|
62
|
+
RESUMED = 8;
|
|
63
|
+
COMPLETED = 9;
|
|
64
|
+
FAILED_STATE = 10;
|
|
65
|
+
SHUTTING_DOWN = 11;
|
|
66
|
+
RECOVERING = 12;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
enum CommunicationClass {
|
|
70
|
+
COMM_CLASS_UNSPECIFIED = 0;
|
|
71
|
+
PRIVILEGED = 1;
|
|
72
|
+
STANDARD = 2;
|
|
73
|
+
BULK = 3;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
enum DebateIntensity {
|
|
77
|
+
DEBATE_INTENSITY_UNSPECIFIED = 0;
|
|
78
|
+
LOWEST = 1;
|
|
79
|
+
LOW = 2;
|
|
80
|
+
MEDIUM = 3;
|
|
81
|
+
HIGH = 4;
|
|
82
|
+
HIGHEST = 5;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
enum HitlReasonType {
|
|
86
|
+
HITL_REASON_UNSPECIFIED = 0;
|
|
87
|
+
CONFLICT = 1;
|
|
88
|
+
SECURITY_APPROVAL = 2;
|
|
89
|
+
TASK_ESCALATION = 3;
|
|
90
|
+
MANUAL_OVERRIDE = 4;
|
|
91
|
+
WORKTREE_OVERRIDE = 5;
|
|
92
|
+
DEBATE_DEADLOCK = 6;
|
|
93
|
+
TOOL_PRIVILEGE_ESCALATION = 7;
|
|
94
|
+
CONNECTOR_APPROVAL = 8;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
enum EnvelopeState {
|
|
98
|
+
ENVELOPE_STATE_UNSPECIFIED = 0;
|
|
99
|
+
ENVELOPE_STATE_SENT = 1;
|
|
100
|
+
ENVELOPE_STATE_RECEIVED = 2;
|
|
101
|
+
ENVELOPE_STATE_READ = 3;
|
|
102
|
+
ENVELOPE_STATE_FULFILLED = 4;
|
|
103
|
+
ENVELOPE_STATE_REJECTED = 5;
|
|
104
|
+
ENVELOPE_STATE_FAILED = 6;
|
|
105
|
+
ENVELOPE_STATE_TIMED_OUT = 7;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
message Envelope {
|
|
109
|
+
string message_id = 1; // UUIDv4 per attempt
|
|
110
|
+
string idempotency_token = 2; // stable across retries (optional)
|
|
111
|
+
string producer_id = 3;
|
|
112
|
+
string correlation_id = 4;
|
|
113
|
+
uint64 sequence_number = 5;
|
|
114
|
+
uint32 retry_count = 6;
|
|
115
|
+
MessageType message_type = 7;
|
|
116
|
+
string content_type = 8; // e.g., application/json
|
|
117
|
+
uint64 content_length = 9;
|
|
118
|
+
string repo_id = 10; // optional
|
|
119
|
+
string worktree_id = 11; // optional
|
|
120
|
+
string hlc_timestamp = 12; // optional, string-form HLC
|
|
121
|
+
uint64 ttl_ms = 13; // optional
|
|
122
|
+
google.protobuf.Timestamp timestamp = 14;
|
|
123
|
+
bytes payload = 15; // serialized content per content_type
|
|
124
|
+
EnvelopeState state = 16; // lifecycle state of the envelope
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
message Ack {
|
|
128
|
+
string ack_for_message_id = 1;
|
|
129
|
+
AckStage ack_stage = 2;
|
|
130
|
+
ErrorCode error_code = 3;
|
|
131
|
+
string note = 4;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
message Empty {}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package sw4rm.connector;
|
|
4
|
+
|
|
5
|
+
message ToolDescriptor {
|
|
6
|
+
string tool_name = 1;
|
|
7
|
+
string input_schema = 2; // JSON Schema or URL
|
|
8
|
+
string output_schema = 3;
|
|
9
|
+
bool idempotent = 4;
|
|
10
|
+
bool needs_worktree = 5;
|
|
11
|
+
uint32 default_timeout_s = 6;
|
|
12
|
+
uint32 max_concurrency = 7;
|
|
13
|
+
string side_effects = 8; // "filesystem","network", etc.
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
message ProviderRegisterRequest {
|
|
17
|
+
string provider_id = 1;
|
|
18
|
+
repeated ToolDescriptor tools = 2;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
message ProviderRegisterResponse { bool ok = 1; string reason = 2; }
|
|
22
|
+
|
|
23
|
+
message DescribeToolsRequest { string provider_id = 1; }
|
|
24
|
+
message DescribeToolsResponse { repeated ToolDescriptor tools = 1; }
|
|
25
|
+
|
|
26
|
+
service ConnectorService {
|
|
27
|
+
rpc RegisterProvider(ProviderRegisterRequest) returns (ProviderRegisterResponse);
|
|
28
|
+
rpc DescribeTools(DescribeToolsRequest) returns (DescribeToolsResponse);
|
|
29
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// SW4RM Protocol - Handoff Proto Definition
|
|
2
|
+
// Namespace Convention: sw4rm.{service} (e.g., sw4rm.handoff)
|
|
3
|
+
// See: docs/IMPLEMENTATION_PLAN.md Phase 1.1 for namespace standards.
|
|
4
|
+
|
|
5
|
+
syntax = "proto3";
|
|
6
|
+
|
|
7
|
+
package sw4rm.handoff;
|
|
8
|
+
|
|
9
|
+
import "common.proto";
|
|
10
|
+
import "google/protobuf/duration.proto";
|
|
11
|
+
|
|
12
|
+
enum HandoffStatus {
|
|
13
|
+
HANDOFF_STATUS_UNSPECIFIED = 0;
|
|
14
|
+
PENDING = 1;
|
|
15
|
+
ACCEPTED = 2;
|
|
16
|
+
REJECTED = 3;
|
|
17
|
+
COMPLETED = 4;
|
|
18
|
+
EXPIRED = 5;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
message HandoffRequest {
|
|
22
|
+
string request_id = 1;
|
|
23
|
+
string from_agent = 2;
|
|
24
|
+
string to_agent = 3;
|
|
25
|
+
string reason = 4;
|
|
26
|
+
bytes context_snapshot = 5;
|
|
27
|
+
repeated string capabilities_required = 6;
|
|
28
|
+
int32 priority = 7;
|
|
29
|
+
google.protobuf.Duration timeout = 8;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
message HandoffResponse {
|
|
33
|
+
string request_id = 1;
|
|
34
|
+
bool accepted = 2;
|
|
35
|
+
string accepting_agent = 3;
|
|
36
|
+
string rejection_reason = 4;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
message GetPendingHandoffsRequest {
|
|
40
|
+
string agent_id = 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
message GetPendingHandoffsResponse {
|
|
44
|
+
repeated HandoffRequest pending_requests = 1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
message CompleteHandoffRequest {
|
|
48
|
+
string request_id = 1;
|
|
49
|
+
HandoffStatus status = 2;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
message CompleteHandoffResponse {
|
|
53
|
+
bool success = 1;
|
|
54
|
+
string message = 2;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
service HandoffService {
|
|
58
|
+
rpc RequestHandoff(HandoffRequest) returns (sw4rm.common.Empty);
|
|
59
|
+
rpc AcceptHandoff(HandoffResponse) returns (sw4rm.common.Empty);
|
|
60
|
+
rpc RejectHandoff(HandoffResponse) returns (sw4rm.common.Empty);
|
|
61
|
+
rpc GetPendingHandoffs(GetPendingHandoffsRequest) returns (GetPendingHandoffsResponse);
|
|
62
|
+
rpc CompleteHandoff(CompleteHandoffRequest) returns (CompleteHandoffResponse);
|
|
63
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package sw4rm.hitl;
|
|
4
|
+
|
|
5
|
+
import "common.proto";
|
|
6
|
+
|
|
7
|
+
message HitlInvocation {
|
|
8
|
+
sw4rm.common.HitlReasonType reason_type = 1;
|
|
9
|
+
bytes context = 2; // JSON or protobuf, see content_type in envelope
|
|
10
|
+
repeated string proposed_actions = 3;
|
|
11
|
+
int32 priority = 4;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
message HitlDecision {
|
|
15
|
+
string action = 1;
|
|
16
|
+
bytes decision_payload = 2;
|
|
17
|
+
string rationale = 3;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
service HitlService {
|
|
21
|
+
// Invocation is carried in Envelope.payload; this service handles the decision side.
|
|
22
|
+
rpc Decide(HitlInvocation) returns (HitlDecision);
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package sw4rm.logging;
|
|
4
|
+
|
|
5
|
+
import "google/protobuf/timestamp.proto";
|
|
6
|
+
|
|
7
|
+
message LogEvent {
|
|
8
|
+
google.protobuf.Timestamp ts = 1;
|
|
9
|
+
string correlation_id = 2;
|
|
10
|
+
string agent_id = 3;
|
|
11
|
+
string event_type = 4;
|
|
12
|
+
string level = 5; // INFO|WARN|ERROR
|
|
13
|
+
string details_json = 6;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
message IngestResponse { bool ok = 1; }
|
|
17
|
+
|
|
18
|
+
service LoggingService {
|
|
19
|
+
rpc Ingest(LogEvent) returns (IngestResponse);
|
|
20
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package sw4rm.negotiation;
|
|
4
|
+
|
|
5
|
+
import "common.proto";
|
|
6
|
+
import "google/protobuf/duration.proto";
|
|
7
|
+
|
|
8
|
+
message NegotiationOpen {
|
|
9
|
+
string negotiation_id = 1;
|
|
10
|
+
string correlation_id = 2;
|
|
11
|
+
string topic = 3;
|
|
12
|
+
repeated string participants = 4;
|
|
13
|
+
sw4rm.common.DebateIntensity intensity = 5;
|
|
14
|
+
google.protobuf.Duration debate_timeout = 6;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
message Proposal {
|
|
18
|
+
string negotiation_id = 1;
|
|
19
|
+
string from_agent = 2;
|
|
20
|
+
string content_type = 3;
|
|
21
|
+
bytes payload = 4; // schema/proto/text as declared
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
message CounterProposal {
|
|
25
|
+
string negotiation_id = 1;
|
|
26
|
+
string from_agent = 2;
|
|
27
|
+
string content_type = 3;
|
|
28
|
+
bytes payload = 4;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
message Evaluation {
|
|
32
|
+
string negotiation_id = 1;
|
|
33
|
+
string from_agent = 2;
|
|
34
|
+
double confidence_score = 3; // optional; 0 if absent
|
|
35
|
+
string notes = 4;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
message Decision {
|
|
39
|
+
string negotiation_id = 1;
|
|
40
|
+
string decided_by = 2; // "consensus"|"hitl"|"policy"
|
|
41
|
+
string content_type = 3;
|
|
42
|
+
bytes result = 4;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
message AbortRequest {
|
|
46
|
+
string negotiation_id = 1;
|
|
47
|
+
string reason = 2;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
service NegotiationService {
|
|
51
|
+
rpc Open(NegotiationOpen) returns (sw4rm.common.Empty);
|
|
52
|
+
rpc Propose(Proposal) returns (sw4rm.common.Empty);
|
|
53
|
+
rpc Counter(CounterProposal) returns (sw4rm.common.Empty);
|
|
54
|
+
rpc Evaluate(Evaluation) returns (sw4rm.common.Empty);
|
|
55
|
+
rpc Decide(Decision) returns (sw4rm.common.Empty);
|
|
56
|
+
rpc Abort(AbortRequest) returns (sw4rm.common.Empty);
|
|
57
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
// SW4RM Protocol - Negotiation Room Proto Definition
|
|
2
|
+
// Namespace Convention: sw4rm.{service} (e.g., sw4rm.negotiation_room)
|
|
3
|
+
// See: docs/IMPLEMENTATION_PLAN.md Phase 1.1 for namespace standards.
|
|
4
|
+
|
|
5
|
+
syntax = "proto3";
|
|
6
|
+
|
|
7
|
+
package sw4rm.negotiation_room;
|
|
8
|
+
|
|
9
|
+
import "google/protobuf/timestamp.proto";
|
|
10
|
+
|
|
11
|
+
// ArtifactType enum represents the category of artifact being negotiated
|
|
12
|
+
// Maps to different stages of the workflow process
|
|
13
|
+
enum ArtifactType {
|
|
14
|
+
ARTIFACT_TYPE_UNSPECIFIED = 0;
|
|
15
|
+
REQUIREMENTS = 1;
|
|
16
|
+
PLAN = 2;
|
|
17
|
+
CODE = 3;
|
|
18
|
+
DEPLOYMENT = 4;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// DecisionOutcome enum represents the final decision made by the coordinator
|
|
22
|
+
// after aggregating critic votes and applying policy
|
|
23
|
+
enum DecisionOutcome {
|
|
24
|
+
DECISION_OUTCOME_UNSPECIFIED = 0;
|
|
25
|
+
APPROVED = 1;
|
|
26
|
+
REVISION_REQUESTED = 2;
|
|
27
|
+
ESCALATED_TO_HITL = 3;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// NegotiationProposal represents a proposal for artifact evaluation in a negotiation room.
|
|
31
|
+
// Submitted by a producer agent to request multi-agent review of an artifact.
|
|
32
|
+
message NegotiationProposal {
|
|
33
|
+
// Category of artifact (requirements, plan, code, deployment)
|
|
34
|
+
ArtifactType artifact_type = 1;
|
|
35
|
+
|
|
36
|
+
// Unique identifier for this artifact
|
|
37
|
+
string artifact_id = 2;
|
|
38
|
+
|
|
39
|
+
// Agent ID of the producer submitting the artifact
|
|
40
|
+
string producer_id = 3;
|
|
41
|
+
|
|
42
|
+
// Binary artifact content (e.g., serialized JSON, code files)
|
|
43
|
+
bytes artifact = 4;
|
|
44
|
+
|
|
45
|
+
// MIME type or content type identifier
|
|
46
|
+
string artifact_content_type = 5;
|
|
47
|
+
|
|
48
|
+
// List of critic agent IDs requested for evaluation
|
|
49
|
+
repeated string requested_critics = 6;
|
|
50
|
+
|
|
51
|
+
// Identifier for the negotiation room session
|
|
52
|
+
string negotiation_room_id = 7;
|
|
53
|
+
|
|
54
|
+
// Timestamp when proposal was created
|
|
55
|
+
google.protobuf.Timestamp created_at = 8;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// NegotiationVote represents a critic's evaluation of an artifact.
|
|
59
|
+
// Represents a single critic's assessment including numerical scoring,
|
|
60
|
+
// qualitative feedback, and confidence level based on POMDP uncertainty.
|
|
61
|
+
message NegotiationVote {
|
|
62
|
+
// Identifier of the artifact being evaluated
|
|
63
|
+
string artifact_id = 1;
|
|
64
|
+
|
|
65
|
+
// Agent ID of the critic providing this vote
|
|
66
|
+
string critic_id = 2;
|
|
67
|
+
|
|
68
|
+
// Numerical score from 0-10 (10 = excellent)
|
|
69
|
+
double score = 3;
|
|
70
|
+
|
|
71
|
+
// Confidence level from 0-1 (based on POMDP research)
|
|
72
|
+
double confidence = 4;
|
|
73
|
+
|
|
74
|
+
// Boolean indicating if artifact meets minimum criteria
|
|
75
|
+
bool passed = 5;
|
|
76
|
+
|
|
77
|
+
// List of identified strengths in the artifact
|
|
78
|
+
repeated string strengths = 6;
|
|
79
|
+
|
|
80
|
+
// List of identified weaknesses or concerns
|
|
81
|
+
repeated string weaknesses = 7;
|
|
82
|
+
|
|
83
|
+
// List of suggestions for improvement
|
|
84
|
+
repeated string recommendations = 8;
|
|
85
|
+
|
|
86
|
+
// Identifier for the negotiation room session
|
|
87
|
+
string negotiation_room_id = 9;
|
|
88
|
+
|
|
89
|
+
// Timestamp when vote was cast
|
|
90
|
+
google.protobuf.Timestamp voted_at = 10;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// AggregatedScore provides statistical aggregation of multiple critic votes.
|
|
94
|
+
// Provides multiple views of the voting results including basic statistics
|
|
95
|
+
// and confidence-weighted metrics for decision making.
|
|
96
|
+
message AggregatedScore {
|
|
97
|
+
// Arithmetic mean of all scores
|
|
98
|
+
double mean = 1;
|
|
99
|
+
|
|
100
|
+
// Minimum score from any critic
|
|
101
|
+
double min_score = 2;
|
|
102
|
+
|
|
103
|
+
// Maximum score from any critic
|
|
104
|
+
double max_score = 3;
|
|
105
|
+
|
|
106
|
+
// Standard deviation of scores (measures consensus)
|
|
107
|
+
double std_dev = 4;
|
|
108
|
+
|
|
109
|
+
// Confidence-weighted mean (higher confidence votes weighted more)
|
|
110
|
+
double weighted_mean = 5;
|
|
111
|
+
|
|
112
|
+
// Number of votes included in aggregation
|
|
113
|
+
int32 vote_count = 6;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// NegotiationDecision represents the final decision on an artifact after critic evaluation.
|
|
117
|
+
// Represents the coordinator's decision after aggregating all critic votes
|
|
118
|
+
// and applying policy thresholds. Includes full audit trail of votes and reasoning.
|
|
119
|
+
message NegotiationDecision {
|
|
120
|
+
// Identifier of the artifact that was evaluated
|
|
121
|
+
string artifact_id = 1;
|
|
122
|
+
|
|
123
|
+
// Final decision (approved, revision requested, escalated to HITL)
|
|
124
|
+
DecisionOutcome outcome = 2;
|
|
125
|
+
|
|
126
|
+
// Complete list of all critic votes considered
|
|
127
|
+
repeated NegotiationVote votes = 3;
|
|
128
|
+
|
|
129
|
+
// Statistical summary of the votes
|
|
130
|
+
AggregatedScore aggregated_score = 4;
|
|
131
|
+
|
|
132
|
+
// Version identifier of the policy used for decision
|
|
133
|
+
string policy_version = 5;
|
|
134
|
+
|
|
135
|
+
// Human-readable explanation of the decision
|
|
136
|
+
string reason = 6;
|
|
137
|
+
|
|
138
|
+
// Identifier for the negotiation room session
|
|
139
|
+
string negotiation_room_id = 7;
|
|
140
|
+
|
|
141
|
+
// Timestamp when decision was made
|
|
142
|
+
google.protobuf.Timestamp decided_at = 8;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Request to submit a proposal to the negotiation room
|
|
146
|
+
message SubmitProposalRequest {
|
|
147
|
+
NegotiationProposal proposal = 1;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Response after submitting a proposal
|
|
151
|
+
message SubmitProposalResponse {
|
|
152
|
+
string artifact_id = 1;
|
|
153
|
+
string negotiation_room_id = 2;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Request to submit a vote for an artifact
|
|
157
|
+
message SubmitVoteRequest {
|
|
158
|
+
NegotiationVote vote = 1;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Response after submitting a vote
|
|
162
|
+
message SubmitVoteResponse {
|
|
163
|
+
string artifact_id = 1;
|
|
164
|
+
string critic_id = 2;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Request to get all votes for an artifact
|
|
168
|
+
message GetVotesRequest {
|
|
169
|
+
string artifact_id = 1;
|
|
170
|
+
string negotiation_room_id = 2;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Response containing all votes for an artifact
|
|
174
|
+
message GetVotesResponse {
|
|
175
|
+
repeated NegotiationVote votes = 1;
|
|
176
|
+
int32 vote_count = 2;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Request to get the decision for an artifact
|
|
180
|
+
message GetDecisionRequest {
|
|
181
|
+
string artifact_id = 1;
|
|
182
|
+
string negotiation_room_id = 2;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Response containing the decision for an artifact
|
|
186
|
+
message GetDecisionResponse {
|
|
187
|
+
NegotiationDecision decision = 1;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Request to wait for a decision (blocking call)
|
|
191
|
+
message WaitForDecisionRequest {
|
|
192
|
+
string artifact_id = 1;
|
|
193
|
+
string negotiation_room_id = 2;
|
|
194
|
+
// Optional timeout in seconds
|
|
195
|
+
uint32 timeout_seconds = 3;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Response for waiting on a decision
|
|
199
|
+
message WaitForDecisionResponse {
|
|
200
|
+
NegotiationDecision decision = 1;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// NegotiationRoomService provides RPC endpoints for the Negotiation Room pattern
|
|
204
|
+
// enabling multi-agent artifact approval workflows
|
|
205
|
+
service NegotiationRoomService {
|
|
206
|
+
// SubmitProposal allows a producer agent to submit an artifact for review
|
|
207
|
+
rpc SubmitProposal(SubmitProposalRequest) returns (SubmitProposalResponse);
|
|
208
|
+
|
|
209
|
+
// SubmitVote allows a critic agent to submit their evaluation of an artifact
|
|
210
|
+
rpc SubmitVote(SubmitVoteRequest) returns (SubmitVoteResponse);
|
|
211
|
+
|
|
212
|
+
// GetVotes retrieves all votes submitted for a specific artifact
|
|
213
|
+
rpc GetVotes(GetVotesRequest) returns (GetVotesResponse);
|
|
214
|
+
|
|
215
|
+
// GetDecision retrieves the final decision for an artifact (non-blocking)
|
|
216
|
+
rpc GetDecision(GetDecisionRequest) returns (GetDecisionResponse);
|
|
217
|
+
|
|
218
|
+
// WaitForDecision blocks until a decision is made for an artifact
|
|
219
|
+
rpc WaitForDecision(WaitForDecisionRequest) returns (WaitForDecisionResponse);
|
|
220
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package sw4rm.policy;
|
|
4
|
+
|
|
5
|
+
message NegotiationPolicy {
|
|
6
|
+
uint32 max_rounds = 1;
|
|
7
|
+
float score_threshold = 2; // 0..1
|
|
8
|
+
float diff_tolerance = 3; // 0..1
|
|
9
|
+
uint64 round_timeout_ms = 4;
|
|
10
|
+
uint64 token_budget_per_round = 5;
|
|
11
|
+
uint64 total_token_budget = 6; // optional 0=unset
|
|
12
|
+
uint32 oscillation_limit = 7;
|
|
13
|
+
message Hitl { string mode = 1; } // None|PauseBetweenRounds|PauseOnFinalAccept
|
|
14
|
+
Hitl hitl = 8;
|
|
15
|
+
message Scoring { bool require_schema_valid = 1; bool require_examples_pass = 2; float llm_weight = 3; }
|
|
16
|
+
Scoring scoring = 9;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
message AgentPreferences {
|
|
20
|
+
// Same fields as NegotiationPolicy but advisory; scheduler clamps to guardrails
|
|
21
|
+
uint32 max_rounds = 1;
|
|
22
|
+
float score_threshold = 2;
|
|
23
|
+
float diff_tolerance = 3;
|
|
24
|
+
uint64 round_timeout_ms = 4;
|
|
25
|
+
uint64 token_budget_per_round = 5;
|
|
26
|
+
uint64 total_token_budget = 6;
|
|
27
|
+
uint32 oscillation_limit = 7;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
message EffectivePolicy {
|
|
31
|
+
NegotiationPolicy policy = 1; // derived authoritative policy
|
|
32
|
+
map<string, AgentPreferences> applied = 2; // per-agent clamped prefs (optional)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
message PolicyProfile {
|
|
36
|
+
string name = 1; // e.g., LOW/MEDIUM/HIGH
|
|
37
|
+
NegotiationPolicy policy = 2;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
message DeltaSummary { float magnitude = 1; repeated string changed_paths = 2; }
|
|
41
|
+
|
|
42
|
+
message EvaluationReport {
|
|
43
|
+
string from_agent = 1;
|
|
44
|
+
float deterministic_score = 2; // 0..1
|
|
45
|
+
float llm_confidence = 3; // 0..1, optional 0 if absent
|
|
46
|
+
string notes = 4;
|
|
47
|
+
DeltaSummary delta = 5;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
message DecisionReport {
|
|
51
|
+
string decided_by = 1; // consensus|hitl|policy
|
|
52
|
+
float final_score = 2;
|
|
53
|
+
string rationale = 3;
|
|
54
|
+
string stop_reason = 4; // threshold_met|max_rounds|oscillation|budget|timeout
|
|
55
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package sw4rm.reasoning;
|
|
4
|
+
|
|
5
|
+
message ParallelismCheckRequest { string scope_a = 1; string scope_b = 2; }
|
|
6
|
+
message ParallelismCheckResponse { double confidence_score = 1; string notes = 2; }
|
|
7
|
+
|
|
8
|
+
message DebateEvaluateRequest {
|
|
9
|
+
string negotiation_id = 1;
|
|
10
|
+
string proposal_a = 2;
|
|
11
|
+
string proposal_b = 3;
|
|
12
|
+
string intensity = 4; // map from enum if needed
|
|
13
|
+
}
|
|
14
|
+
message DebateEvaluateResponse { double confidence_score = 1; string notes = 2; }
|
|
15
|
+
|
|
16
|
+
service ReasoningProxy {
|
|
17
|
+
rpc CheckParallelism(ParallelismCheckRequest) returns (ParallelismCheckResponse);
|
|
18
|
+
rpc EvaluateDebate(DebateEvaluateRequest) returns (DebateEvaluateResponse);
|
|
19
|
+
rpc Summarize(SummarizeRequest) returns (SummarizeResponse);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message TextSegment {
|
|
23
|
+
string kind = 1;
|
|
24
|
+
string content = 2;
|
|
25
|
+
int64 seq = 3;
|
|
26
|
+
string at = 4;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
message SummarizeRequest {
|
|
30
|
+
string session_id = 1;
|
|
31
|
+
repeated TextSegment segments = 2;
|
|
32
|
+
uint32 max_tokens = 3;
|
|
33
|
+
string mode = 4;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
message SummarizeResponse {
|
|
37
|
+
string summary = 1;
|
|
38
|
+
uint32 tokens = 2;
|
|
39
|
+
double cost_cents = 3;
|
|
40
|
+
string model = 4;
|
|
41
|
+
}
|