cap-sdk-python 2.13.3__py3-none-any.whl → 2.16.1__py3-none-any.whl

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 (45) hide show
  1. cap/__init__.py +92 -25
  2. cap/client.py +14 -11
  3. cap/handshake.py +24 -13
  4. cap/heartbeat.py +56 -36
  5. cap/metrics.py +16 -1
  6. cap/packet_boundary.py +155 -0
  7. cap/pb/cordum/agent/v1/alert_pb2_grpc.py +1 -1
  8. cap/pb/cordum/agent/v1/buspacket_pb2.py +4 -2
  9. cap/pb/cordum/agent/v1/buspacket_pb2_grpc.py +1 -1
  10. cap/pb/cordum/agent/v1/handshake_pb2.py +22 -7
  11. cap/pb/cordum/agent/v1/handshake_pb2_grpc.py +1 -1
  12. cap/pb/cordum/agent/v1/heartbeat_pb2_grpc.py +1 -1
  13. cap/pb/cordum/agent/v1/job_pb2.py +42 -35
  14. cap/pb/cordum/agent/v1/job_pb2_grpc.py +1 -1
  15. cap/pb/cordum/agent/v1/policy_pb2_grpc.py +1 -1
  16. cap/pb/cordum/agent/v1/safety_pb2.py +28 -28
  17. cap/pb/cordum/agent/v1/safety_pb2_grpc.py +1 -1
  18. cap/production_events.py +222 -0
  19. cap/production_replay.py +79 -0
  20. cap/production_resource.py +163 -0
  21. cap/production_signing.py +293 -0
  22. cap/production_validation.py +50 -0
  23. cap/progress.py +25 -23
  24. cap/py.typed +1 -0
  25. cap/runtime.py +882 -116
  26. cap/subjects.py +2 -0
  27. cap/testing.py +10 -2
  28. cap/trust_signing.py +148 -0
  29. cap/validate.py +119 -78
  30. cap/worker.py +272 -121
  31. cap/worker_trust.py +223 -0
  32. cap/worker_trust_async.py +85 -0
  33. cap/worker_trust_build.py +128 -0
  34. cap/worker_trust_codec.py +34 -0
  35. cap/worker_trust_runtime.py +272 -0
  36. cap/worker_trust_runtime_config.py +148 -0
  37. cap/worker_trust_validate.py +213 -0
  38. cap/worker_trust_verify.py +117 -0
  39. cap_sdk_python-2.16.1.dist-info/METADATA +414 -0
  40. cap_sdk_python-2.16.1.dist-info/RECORD +54 -0
  41. cap_sdk_python-2.16.1.dist-info/licenses/LICENSE +190 -0
  42. cap_sdk_python-2.13.3.dist-info/METADATA +0 -241
  43. cap_sdk_python-2.13.3.dist-info/RECORD +0 -37
  44. {cap_sdk_python-2.13.3.dist-info → cap_sdk_python-2.16.1.dist-info}/WHEEL +0 -0
  45. {cap_sdk_python-2.13.3.dist-info → cap_sdk_python-2.16.1.dist-info}/top_level.txt +0 -0
@@ -29,7 +29,7 @@ from cordum.agent.v1 import alert_pb2 as cordum_dot_agent_dot_v1_dot_alert__pb2
29
29
  from cordum.agent.v1 import handshake_pb2 as cordum_dot_agent_dot_v1_dot_handshake__pb2
30
30
 
31
31
 
32
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1f\x63ordum/agent/v1/buspacket.proto\x12\x0f\x63ordum.agent.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x19\x63ordum/agent/v1/job.proto\x1a\x1f\x63ordum/agent/v1/heartbeat.proto\x1a\x1b\x63ordum/agent/v1/alert.proto\x1a\x1f\x63ordum/agent/v1/handshake.proto\"\x8b\x04\n\tBusPacket\x12\x10\n\x08trace_id\x18\x01 \x01(\t\x12\x11\n\tsender_id\x18\x02 \x01(\t\x12.\n\ncreated_at\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x18\n\x10protocol_version\x18\x04 \x01(\x05\x12\x32\n\x0bjob_request\x18\n \x01(\x0b\x32\x1b.cordum.agent.v1.JobRequestH\x00\x12\x30\n\njob_result\x18\x0b \x01(\x0b\x32\x1a.cordum.agent.v1.JobResultH\x00\x12/\n\theartbeat\x18\x0c \x01(\x0b\x32\x1a.cordum.agent.v1.HeartbeatH\x00\x12-\n\x05\x61lert\x18\r \x01(\x0b\x32\x1c.cordum.agent.v1.SystemAlertH\x00\x12\x34\n\x0cjob_progress\x18\x0f \x01(\x0b\x32\x1c.cordum.agent.v1.JobProgressH\x00\x12\x30\n\njob_cancel\x18\x10 \x01(\x0b\x32\x1a.cordum.agent.v1.JobCancelH\x00\x12/\n\thandshake\x18\x11 \x01(\x0b\x32\x1a.cordum.agent.v1.HandshakeH\x00\x12\x11\n\tsignature\x18\x0e \x01(\x0c\x12\x12\n\nauth_token\x18\x12 \x01(\tB\t\n\x07payloadB\x7f\n\x16io.cordum.cap.agent.v1P\x01Z+github.com/cordum-io/cap/v2/cordum/agent/v1\xaa\x02\x0f\x43ordum.Agent.V1\xca\x02\x0f\x63ordum\\Agent\\V1\xea\x02\x11\x43ordum::Agent::V1b\x06proto3')
32
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1f\x63ordum/agent/v1/buspacket.proto\x12\x0f\x63ordum.agent.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x19\x63ordum/agent/v1/job.proto\x1a\x1f\x63ordum/agent/v1/heartbeat.proto\x1a\x1b\x63ordum/agent/v1/alert.proto\x1a\x1f\x63ordum/agent/v1/handshake.proto\"\xd8\x07\n\tBusPacket\x12\x10\n\x08trace_id\x18\x01 \x01(\t\x12\x11\n\tsender_id\x18\x02 \x01(\t\x12.\n\ncreated_at\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x18\n\x10protocol_version\x18\x04 \x01(\x05\x12>\n\x12signature_metadata\x18\x05 \x01(\x0b\x32\".cordum.agent.v1.SignatureMetadata\x12\x32\n\x08identity\x18\x06 \x01(\x0b\x32 .cordum.agent.v1.IdentityBinding\x12\x32\n\x0bjob_request\x18\n \x01(\x0b\x32\x1b.cordum.agent.v1.JobRequestH\x00\x12\x30\n\njob_result\x18\x0b \x01(\x0b\x32\x1a.cordum.agent.v1.JobResultH\x00\x12/\n\theartbeat\x18\x0c \x01(\x0b\x32\x1a.cordum.agent.v1.HeartbeatH\x00\x12-\n\x05\x61lert\x18\r \x01(\x0b\x32\x1c.cordum.agent.v1.SystemAlertH\x00\x12\x34\n\x0cjob_progress\x18\x0f \x01(\x0b\x32\x1c.cordum.agent.v1.JobProgressH\x00\x12\x30\n\njob_cancel\x18\x10 \x01(\x0b\x32\x1a.cordum.agent.v1.JobCancelH\x00\x12/\n\thandshake\x18\x11 \x01(\x0b\x32\x1a.cordum.agent.v1.HandshakeH\x00\x12^\n\"worker_handshake_challenge_request\x18\x13 \x01(\x0b\x32\x30.cordum.agent.v1.WorkerHandshakeChallengeRequestH\x00\x12O\n\x1aworker_handshake_challenge\x18\x14 \x01(\x0b\x32).cordum.agent.v1.WorkerHandshakeChallengeH\x00\x12U\n\x1dworker_handshake_authenticate\x18\x15 \x01(\x0b\x32,.cordum.agent.v1.WorkerHandshakeAuthenticateH\x00\x12I\n\x17worker_handshake_result\x18\x16 \x01(\x0b\x32&.cordum.agent.v1.WorkerHandshakeResultH\x00\x12\x11\n\tsignature\x18\x0e \x01(\x0c\x12\x12\n\nauth_token\x18\x12 \x01(\tB\t\n\x07payloadJ\x04\x08\x17\x10\x1c\"\xa5\x01\n\x11SignatureMetadata\x12\x17\n\x0fprofile_version\x18\x01 \x01(\t\x12\x11\n\talgorithm\x18\x02 \x01(\t\x12\x12\n\nmessage_id\x18\x03 \x01(\x0c\x12\x10\n\x08\x61udience\x18\x04 \x01(\t\x12.\n\nexpires_at\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0e\n\x06key_id\x18\x06 \x01(\tB\x7f\n\x16io.cordum.cap.agent.v1P\x01Z+github.com/cordum-io/cap/v2/cordum/agent/v1\xaa\x02\x0f\x43ordum.Agent.V1\xca\x02\x0f\x63ordum\\Agent\\V1\xea\x02\x11\x43ordum::Agent::V1b\x06proto3')
33
33
 
34
34
  _globals = globals()
35
35
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -38,5 +38,7 @@ if not _descriptor._USE_C_DESCRIPTORS:
38
38
  _globals['DESCRIPTOR']._loaded_options = None
39
39
  _globals['DESCRIPTOR']._serialized_options = b'\n\026io.cordum.cap.agent.v1P\001Z+github.com/cordum-io/cap/v2/cordum/agent/v1\252\002\017Cordum.Agent.V1\312\002\017cordum\\Agent\\V1\352\002\021Cordum::Agent::V1'
40
40
  _globals['_BUSPACKET']._serialized_start=208
41
- _globals['_BUSPACKET']._serialized_end=731
41
+ _globals['_BUSPACKET']._serialized_end=1192
42
+ _globals['_SIGNATUREMETADATA']._serialized_start=1195
43
+ _globals['_SIGNATUREMETADATA']._serialized_end=1360
42
44
  # @@protoc_insertion_point(module_scope)
@@ -4,7 +4,7 @@ import grpc
4
4
  import warnings
5
5
 
6
6
 
7
- GRPC_GENERATED_VERSION = '1.80.0'
7
+ GRPC_GENERATED_VERSION = '1.76.0'
8
8
  GRPC_VERSION = grpc.__version__
9
9
  _version_not_supported = False
10
10
 
@@ -22,9 +22,10 @@ _runtime_version.ValidateProtobufRuntimeVersion(
22
22
  _sym_db = _symbol_database.Default()
23
23
 
24
24
 
25
+ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
25
26
 
26
27
 
27
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1f\x63ordum/agent/v1/handshake.proto\x12\x0f\x63ordum.agent.v1\"\xa3\x02\n\tHandshake\x12\x14\n\x0c\x63omponent_id\x18\x01 \x01(\t\x12,\n\x04role\x18\x02 \x01(\x0e\x32\x1e.cordum.agent.v1.ComponentRole\x12\x1a\n\x12supported_versions\x18\x03 \x03(\x05\x12\x42\n\x0c\x63\x61pabilities\x18\x04 \x03(\x0b\x32,.cordum.agent.v1.Handshake.CapabilitiesEntry\x12\x13\n\x0bsdk_version\x18\x05 \x01(\t\x12\x14\n\x0cready_topics\x18\x06 \x03(\t\x12\x12\n\nagent_name\x18\x07 \x01(\t\x1a\x33\n\x11\x43\x61pabilitiesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01*\xc4\x01\n\rComponentRole\x12\x1e\n\x1a\x43OMPONENT_ROLE_UNSPECIFIED\x10\x00\x12\x1a\n\x16\x43OMPONENT_ROLE_GATEWAY\x10\x01\x12\x1c\n\x18\x43OMPONENT_ROLE_SCHEDULER\x10\x02\x12\x19\n\x15\x43OMPONENT_ROLE_WORKER\x10\x03\x12\x1f\n\x1b\x43OMPONENT_ROLE_ORCHESTRATOR\x10\x04\x12\x1d\n\x19\x43OMPONENT_ROLE_CONTROLLER\x10\x05\x42\x7f\n\x16io.cordum.cap.agent.v1P\x01Z+github.com/cordum-io/cap/v2/cordum/agent/v1\xaa\x02\x0f\x43ordum.Agent.V1\xca\x02\x0f\x63ordum\\Agent\\V1\xea\x02\x11\x43ordum::Agent::V1b\x06proto3')
28
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1f\x63ordum/agent/v1/handshake.proto\x12\x0f\x63ordum.agent.v1\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa3\x02\n\tHandshake\x12\x14\n\x0c\x63omponent_id\x18\x01 \x01(\t\x12,\n\x04role\x18\x02 \x01(\x0e\x32\x1e.cordum.agent.v1.ComponentRole\x12\x1a\n\x12supported_versions\x18\x03 \x03(\x05\x12\x42\n\x0c\x63\x61pabilities\x18\x04 \x03(\x0b\x32,.cordum.agent.v1.Handshake.CapabilitiesEntry\x12\x13\n\x0bsdk_version\x18\x05 \x01(\t\x12\x14\n\x0cready_topics\x18\x06 \x03(\t\x12\x12\n\nagent_name\x18\x07 \x01(\t\x1a\x33\n\x11\x43\x61pabilitiesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01\"\xca\x02\n\x1fWorkerHandshakeChallengeRequest\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12\x10\n\x08trace_id\x18\x02 \x01(\t\x12\x11\n\tworker_id\x18\x03 \x01(\t\x12\x14\n\x0cproof_key_id\x18\x04 \x01(\t\x12G\n\x0fproof_algorithm\x18\x05 \x01(\x0e\x32..cordum.agent.v1.WorkerHandshakeProofAlgorithm\x12\x10\n\x08\x61udience\x18\x06 \x01(\t\x12\x38\n\x07purpose\x18\x07 \x01(\x0e\x32\'.cordum.agent.v1.WorkerHandshakePurpose\x12\x14\n\x0c\x63lient_nonce\x18\x08 \x01(\x0c\x12\x18\n\x10protocol_version\x18\t \x01(\x05\x12\x13\n\x0bsdk_version\x18\n \x01(\t\"\x8a\x04\n\x18WorkerHandshakeChallenge\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12\x14\n\x0c\x63hallenge_id\x18\x02 \x01(\t\x12\x10\n\x08trace_id\x18\x03 \x01(\t\x12\x11\n\tworker_id\x18\x04 \x01(\t\x12\x10\n\x08\x61gent_id\x18\x05 \x01(\t\x12\x11\n\ttenant_id\x18\x06 \x01(\t\x12\x14\n\x0cproof_key_id\x18\x07 \x01(\t\x12G\n\x0fproof_algorithm\x18\x08 \x01(\x0e\x32..cordum.agent.v1.WorkerHandshakeProofAlgorithm\x12\x15\n\rserver_key_id\x18\t \x01(\t\x12\x10\n\x08\x61udience\x18\n \x01(\t\x12\x38\n\x07purpose\x18\x0b \x01(\x0e\x32\'.cordum.agent.v1.WorkerHandshakePurpose\x12\x14\n\x0c\x63lient_nonce\x18\x0c \x01(\x0c\x12\x14\n\x0cserver_nonce\x18\r \x01(\x0c\x12\x18\n\x10protocol_version\x18\x0e \x01(\x05\x12\x13\n\x0bsdk_version\x18\x0f \x01(\t\x12-\n\tissued_at\x18\x10 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\nexpires_at\x18\x11 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\x95\x01\n\x1bWorkerHandshakeAuthenticate\x12<\n\tchallenge\x18\x01 \x01(\x0b\x32).cordum.agent.v1.WorkerHandshakeChallenge\x12\x38\n\x14\x63\x61pability_handshake\x18\x02 \x01(\x0b\x32\x1a.cordum.agent.v1.Handshake\"\x97\x02\n\x15WorkerHandshakeResult\x12<\n\tchallenge\x18\x01 \x01(\x0b\x32).cordum.agent.v1.WorkerHandshakeChallenge\x12\x10\n\x08\x61\x63\x63\x65pted\x18\x02 \x01(\x08\x12I\n\x10rejection_reason\x18\x03 \x01(\x0e\x32/.cordum.agent.v1.WorkerHandshakeRejectionReason\x12\x34\n\x10token_expires_at\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12-\n\tissued_at\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp*\xc4\x01\n\rComponentRole\x12\x1e\n\x1a\x43OMPONENT_ROLE_UNSPECIFIED\x10\x00\x12\x1a\n\x16\x43OMPONENT_ROLE_GATEWAY\x10\x01\x12\x1c\n\x18\x43OMPONENT_ROLE_SCHEDULER\x10\x02\x12\x19\n\x15\x43OMPONENT_ROLE_WORKER\x10\x03\x12\x1f\n\x1b\x43OMPONENT_ROLE_ORCHESTRATOR\x10\x04\x12\x1d\n\x19\x43OMPONENT_ROLE_CONTROLLER\x10\x05*\x8a\x01\n\x16WorkerHandshakePurpose\x12(\n$WORKER_HANDSHAKE_PURPOSE_UNSPECIFIED\x10\x00\x12\"\n\x1eWORKER_HANDSHAKE_PURPOSE_ISSUE\x10\x01\x12\"\n\x1eWORKER_HANDSHAKE_PURPOSE_RENEW\x10\x02*\x89\x01\n\x1dWorkerHandshakeProofAlgorithm\x12\x30\n,WORKER_HANDSHAKE_PROOF_ALGORITHM_UNSPECIFIED\x10\x00\x12\x36\n2WORKER_HANDSHAKE_PROOF_ALGORITHM_ECDSA_P256_SHA256\x10\x01*\xc9\x04\n\x1eWorkerHandshakeRejectionReason\x12\x31\n-WORKER_HANDSHAKE_REJECTION_REASON_UNSPECIFIED\x10\x00\x12\x35\n1WORKER_HANDSHAKE_REJECTION_REASON_INVALID_REQUEST\x10\x01\x12;\n7WORKER_HANDSHAKE_REJECTION_REASON_AUTHENTICATION_FAILED\x10\x02\x12\x35\n1WORKER_HANDSHAKE_REJECTION_REASON_REPLAY_DETECTED\x10\x03\x12\x30\n,WORKER_HANDSHAKE_REJECTION_REASON_CLOCK_SKEW\x10\x04\x12\x37\n3WORKER_HANDSHAKE_REJECTION_REASON_CHALLENGE_EXPIRED\x10\x05\x12\x36\n2WORKER_HANDSHAKE_REJECTION_REASON_SESSION_REQUIRED\x10\x06\x12\x35\n1WORKER_HANDSHAKE_REJECTION_REASON_SESSION_INVALID\x10\x07\x12\x39\n5WORKER_HANDSHAKE_REJECTION_REASON_UNSUPPORTED_VERSION\x10\x08\x12\x34\n0WORKER_HANDSHAKE_REJECTION_REASON_INTERNAL_ERROR\x10\tB\x7f\n\x16io.cordum.cap.agent.v1P\x01Z+github.com/cordum-io/cap/v2/cordum/agent/v1\xaa\x02\x0f\x43ordum.Agent.V1\xca\x02\x0f\x63ordum\\Agent\\V1\xea\x02\x11\x43ordum::Agent::V1b\x06proto3')
28
29
 
29
30
  _globals = globals()
30
31
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -34,10 +35,24 @@ if not _descriptor._USE_C_DESCRIPTORS:
34
35
  _globals['DESCRIPTOR']._serialized_options = b'\n\026io.cordum.cap.agent.v1P\001Z+github.com/cordum-io/cap/v2/cordum/agent/v1\252\002\017Cordum.Agent.V1\312\002\017cordum\\Agent\\V1\352\002\021Cordum::Agent::V1'
35
36
  _globals['_HANDSHAKE_CAPABILITIESENTRY']._loaded_options = None
36
37
  _globals['_HANDSHAKE_CAPABILITIESENTRY']._serialized_options = b'8\001'
37
- _globals['_COMPONENTROLE']._serialized_start=347
38
- _globals['_COMPONENTROLE']._serialized_end=543
39
- _globals['_HANDSHAKE']._serialized_start=53
40
- _globals['_HANDSHAKE']._serialized_end=344
41
- _globals['_HANDSHAKE_CAPABILITIESENTRY']._serialized_start=293
42
- _globals['_HANDSHAKE_CAPABILITIESENTRY']._serialized_end=344
38
+ _globals['_COMPONENTROLE']._serialized_start=1672
39
+ _globals['_COMPONENTROLE']._serialized_end=1868
40
+ _globals['_WORKERHANDSHAKEPURPOSE']._serialized_start=1871
41
+ _globals['_WORKERHANDSHAKEPURPOSE']._serialized_end=2009
42
+ _globals['_WORKERHANDSHAKEPROOFALGORITHM']._serialized_start=2012
43
+ _globals['_WORKERHANDSHAKEPROOFALGORITHM']._serialized_end=2149
44
+ _globals['_WORKERHANDSHAKEREJECTIONREASON']._serialized_start=2152
45
+ _globals['_WORKERHANDSHAKEREJECTIONREASON']._serialized_end=2737
46
+ _globals['_HANDSHAKE']._serialized_start=86
47
+ _globals['_HANDSHAKE']._serialized_end=377
48
+ _globals['_HANDSHAKE_CAPABILITIESENTRY']._serialized_start=326
49
+ _globals['_HANDSHAKE_CAPABILITIESENTRY']._serialized_end=377
50
+ _globals['_WORKERHANDSHAKECHALLENGEREQUEST']._serialized_start=380
51
+ _globals['_WORKERHANDSHAKECHALLENGEREQUEST']._serialized_end=710
52
+ _globals['_WORKERHANDSHAKECHALLENGE']._serialized_start=713
53
+ _globals['_WORKERHANDSHAKECHALLENGE']._serialized_end=1235
54
+ _globals['_WORKERHANDSHAKEAUTHENTICATE']._serialized_start=1238
55
+ _globals['_WORKERHANDSHAKEAUTHENTICATE']._serialized_end=1387
56
+ _globals['_WORKERHANDSHAKERESULT']._serialized_start=1390
57
+ _globals['_WORKERHANDSHAKERESULT']._serialized_end=1669
43
58
  # @@protoc_insertion_point(module_scope)
@@ -4,7 +4,7 @@ import grpc
4
4
  import warnings
5
5
 
6
6
 
7
- GRPC_GENERATED_VERSION = '1.80.0'
7
+ GRPC_GENERATED_VERSION = '1.76.0'
8
8
  GRPC_VERSION = grpc.__version__
9
9
  _version_not_supported = False
10
10
 
@@ -4,7 +4,7 @@ import grpc
4
4
  import warnings
5
5
 
6
6
 
7
- GRPC_GENERATED_VERSION = '1.80.0'
7
+ GRPC_GENERATED_VERSION = '1.76.0'
8
8
  GRPC_VERSION = grpc.__version__
9
9
  _version_not_supported = False
10
10
 
@@ -22,9 +22,10 @@ _runtime_version.ValidateProtobufRuntimeVersion(
22
22
  _sym_db = _symbol_database.Default()
23
23
 
24
24
 
25
+ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
25
26
 
26
27
 
27
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19\x63ordum/agent/v1/job.proto\x12\x0f\x63ordum.agent.v1\"l\n\x0c\x43ontextHints\x12\x18\n\x10max_input_tokens\x18\x01 \x01(\x05\x12\x1b\n\x13\x61llow_summarization\x18\x02 \x01(\x08\x12\x17\n\x0f\x61llow_retrieval\x18\x03 \x01(\x08\x12\x0c\n\x04tags\x18\x04 \x03(\t\"l\n\x06\x42udget\x12\x18\n\x10max_input_tokens\x18\x01 \x01(\x03\x12\x19\n\x11max_output_tokens\x18\x02 \x01(\x03\x12\x18\n\x10max_total_tokens\x18\x03 \x01(\x03\x12\x13\n\x0b\x64\x65\x61\x64line_ms\x18\x04 \x01(\x03\"\xae\x02\n\x0bJobMetadata\x12\x11\n\ttenant_id\x18\x01 \x01(\t\x12\x10\n\x08\x61\x63tor_id\x18\x02 \x01(\t\x12.\n\nactor_type\x18\x03 \x01(\x0e\x32\x1a.cordum.agent.v1.ActorType\x12\x17\n\x0fidempotency_key\x18\x04 \x01(\t\x12\x12\n\ncapability\x18\x05 \x01(\t\x12\x11\n\trisk_tags\x18\x06 \x03(\t\x12\x10\n\x08requires\x18\x07 \x03(\t\x12\x0f\n\x07pack_id\x18\x08 \x01(\t\x12\x38\n\x06labels\x18\t \x03(\x0b\x32(.cordum.agent.v1.JobMetadata.LabelsEntry\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\x88\x04\n\x0c\x43ompensation\x12\r\n\x05topic\x18\x01 \x01(\t\x12\x13\n\x0b\x63ontext_ptr\x18\x02 \x01(\t\x12.\n\x08priority\x18\x03 \x01(\x0e\x32\x1c.cordum.agent.v1.JobPriority\x12\x12\n\nadapter_id\x18\x04 \x01(\t\x12\x33\n\x03\x65nv\x18\x05 \x03(\x0b\x32&.cordum.agent.v1.Compensation.EnvEntry\x12\x11\n\tmemory_id\x18\x06 \x01(\t\x12\x34\n\rcontext_hints\x18\x07 \x01(\x0b\x32\x1d.cordum.agent.v1.ContextHints\x12\'\n\x06\x62udget\x18\x08 \x01(\x0b\x32\x17.cordum.agent.v1.Budget\x12\x11\n\ttenant_id\x18\t \x01(\t\x12\x14\n\x0cprincipal_id\x18\n \x01(\t\x12\x39\n\x06labels\x18\x0b \x03(\x0b\x32).cordum.agent.v1.Compensation.LabelsEntry\x12*\n\x04meta\x18\x0c \x01(\x0b\x32\x1c.cordum.agent.v1.JobMetadata\x1a*\n\x08\x45nvEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\x87\x05\n\nJobRequest\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12\r\n\x05topic\x18\x02 \x01(\t\x12.\n\x08priority\x18\x03 \x01(\x0e\x32\x1c.cordum.agent.v1.JobPriority\x12\x13\n\x0b\x63ontext_ptr\x18\x04 \x01(\t\x12\x12\n\nadapter_id\x18\x05 \x01(\t\x12\x31\n\x03\x65nv\x18\x06 \x03(\x0b\x32$.cordum.agent.v1.JobRequest.EnvEntry\x12\x15\n\rparent_job_id\x18\x07 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x08 \x01(\t\x12\x12\n\nstep_index\x18\t \x01(\x05\x12\x11\n\tmemory_id\x18\n \x01(\t\x12\x34\n\rcontext_hints\x18\x0b \x01(\x0b\x32\x1d.cordum.agent.v1.ContextHints\x12\'\n\x06\x62udget\x18\x0c \x01(\x0b\x32\x17.cordum.agent.v1.Budget\x12\x11\n\ttenant_id\x18\r \x01(\t\x12\x14\n\x0cprincipal_id\x18\x0e \x01(\t\x12\x37\n\x06labels\x18\x0f \x03(\x0b\x32\'.cordum.agent.v1.JobRequest.LabelsEntry\x12*\n\x04meta\x18\x10 \x01(\x0b\x32\x1c.cordum.agent.v1.JobMetadata\x12\x33\n\x0c\x63ompensation\x18\x11 \x01(\x0b\x32\x1d.cordum.agent.v1.Compensation\x1a*\n\x08\x45nvEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xfb\x01\n\tJobResult\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12*\n\x06status\x18\x02 \x01(\x0e\x32\x1a.cordum.agent.v1.JobStatus\x12\x12\n\nresult_ptr\x18\x03 \x01(\t\x12\x11\n\tworker_id\x18\x04 \x01(\t\x12\x14\n\x0c\x65xecution_ms\x18\x05 \x01(\x03\x12\x12\n\nerror_code\x18\x06 \x01(\t\x12\x15\n\rerror_message\x18\x07 \x01(\t\x12\x15\n\rartifact_ptrs\x18\x08 \x03(\t\x12\x33\n\x0f\x65rror_code_enum\x18\t \x01(\x0e\x32\x1a.cordum.agent.v1.ErrorCode\"\xa7\x01\n\x0bJobProgress\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12\x0f\n\x07step_id\x18\x02 \x01(\t\x12\x0f\n\x07percent\x18\x03 \x01(\x05\x12\x0f\n\x07message\x18\x04 \x01(\t\x12\x12\n\nresult_ptr\x18\x05 \x01(\t\x12\x15\n\rartifact_ptrs\x18\x06 \x03(\t\x12*\n\x06status\x18\x07 \x01(\x0e\x32\x1a.cordum.agent.v1.JobStatus\"A\n\tJobCancel\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12\x0e\n\x06reason\x18\x02 \x01(\t\x12\x14\n\x0crequested_by\x18\x03 \x01(\t*|\n\x0bJobPriority\x12\x1c\n\x18JOB_PRIORITY_UNSPECIFIED\x10\x00\x12\x1c\n\x18JOB_PRIORITY_INTERACTIVE\x10\x01\x12\x16\n\x12JOB_PRIORITY_BATCH\x10\x02\x12\x19\n\x15JOB_PRIORITY_CRITICAL\x10\x03*\xc4\x02\n\tJobStatus\x12\x1a\n\x16JOB_STATUS_UNSPECIFIED\x10\x00\x12\x16\n\x12JOB_STATUS_PENDING\x10\x01\x12\x18\n\x14JOB_STATUS_SCHEDULED\x10\x02\x12\x19\n\x15JOB_STATUS_DISPATCHED\x10\x03\x12\x16\n\x12JOB_STATUS_RUNNING\x10\x04\x12\x18\n\x14JOB_STATUS_SUCCEEDED\x10\x05\x12\x15\n\x11JOB_STATUS_FAILED\x10\x06\x12\x18\n\x14JOB_STATUS_CANCELLED\x10\x07\x12\x15\n\x11JOB_STATUS_DENIED\x10\x08\x12\x16\n\x12JOB_STATUS_TIMEOUT\x10\t\x12\x1f\n\x1bJOB_STATUS_FAILED_RETRYABLE\x10\n\x12\x1b\n\x17JOB_STATUS_FAILED_FATAL\x10\x0b*U\n\tActorType\x12\x1a\n\x16\x41\x43TOR_TYPE_UNSPECIFIED\x10\x00\x12\x14\n\x10\x41\x43TOR_TYPE_HUMAN\x10\x01\x12\x16\n\x12\x41\x43TOR_TYPE_SERVICE\x10\x02*\xe1\x05\n\tErrorCode\x12\x1a\n\x16\x45RROR_CODE_UNSPECIFIED\x10\x00\x12(\n$ERROR_CODE_PROTOCOL_VERSION_MISMATCH\x10\x64\x12(\n$ERROR_CODE_PROTOCOL_MALFORMED_PACKET\x10\x65\x12\'\n#ERROR_CODE_PROTOCOL_UNKNOWN_PAYLOAD\x10\x66\x12)\n%ERROR_CODE_PROTOCOL_SIGNATURE_INVALID\x10g\x12)\n%ERROR_CODE_PROTOCOL_SIGNATURE_MISSING\x10h\x12\x1b\n\x16\x45RROR_CODE_JOB_TIMEOUT\x10\xc8\x01\x12&\n!ERROR_CODE_JOB_RESOURCE_EXHAUSTED\x10\xc9\x01\x12%\n ERROR_CODE_JOB_PERMISSION_DENIED\x10\xca\x01\x12!\n\x1c\x45RROR_CODE_JOB_INVALID_INPUT\x10\xcb\x01\x12\x1d\n\x18\x45RROR_CODE_JOB_NOT_FOUND\x10\xcc\x01\x12\x1d\n\x18\x45RROR_CODE_JOB_DUPLICATE\x10\xcd\x01\x12&\n!ERROR_CODE_JOB_WORKER_UNAVAILABLE\x10\xce\x01\x12\x1d\n\x18\x45RROR_CODE_SAFETY_DENIED\x10\xac\x02\x12\'\n\"ERROR_CODE_SAFETY_POLICY_VIOLATION\x10\xad\x02\x12\'\n\"ERROR_CODE_SAFETY_RISK_TAG_BLOCKED\x10\xae\x02\x12(\n#ERROR_CODE_TRANSPORT_PUBLISH_FAILED\x10\x90\x03\x12*\n%ERROR_CODE_TRANSPORT_SUBSCRIBE_FAILED\x10\x91\x03\x12)\n$ERROR_CODE_TRANSPORT_CONNECTION_LOST\x10\x92\x03\x42\x7f\n\x16io.cordum.cap.agent.v1P\x01Z+github.com/cordum-io/cap/v2/cordum/agent/v1\xaa\x02\x0f\x43ordum.Agent.V1\xca\x02\x0f\x63ordum\\Agent\\V1\xea\x02\x11\x43ordum::Agent::V1b\x06proto3')
28
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19\x63ordum/agent/v1/job.proto\x12\x0f\x63ordum.agent.v1\x1a\x1fgoogle/protobuf/timestamp.proto\"c\n\x0fIdentityBinding\x12\x11\n\ttenant_id\x18\x01 \x01(\t\x12\x14\n\x0cprincipal_id\x18\x02 \x01(\t\x12\x10\n\x08\x61\x63tor_id\x18\x03 \x01(\t\x12\x15\n\rdelegation_id\x18\x04 \x01(\t\"T\n\x10\x44ispatchIdentity\x12\x13\n\x0b\x64ispatch_id\x18\x01 \x01(\t\x12\x0f\n\x07\x61ttempt\x18\x02 \x01(\x04\x12\x1a\n\x12\x61ssigned_worker_id\x18\x03 \x01(\t\"\xa8\x01\n\x0bResourceRef\x12\x13\n\x0bresolver_id\x18\x01 \x01(\t\x12\x0b\n\x03uri\x18\x02 \x01(\t\x12\x0e\n\x06sha256\x18\x03 \x01(\x0c\x12\x12\n\nmedia_type\x18\x04 \x01(\t\x12\x12\n\nsize_bytes\x18\x05 \x01(\x04\x12.\n\nexpires_at\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0f\n\x07purpose\x18\x07 \x01(\t\"l\n\x0c\x43ontextHints\x12\x18\n\x10max_input_tokens\x18\x01 \x01(\x05\x12\x1b\n\x13\x61llow_summarization\x18\x02 \x01(\x08\x12\x17\n\x0f\x61llow_retrieval\x18\x03 \x01(\x08\x12\x0c\n\x04tags\x18\x04 \x03(\t\"l\n\x06\x42udget\x12\x18\n\x10max_input_tokens\x18\x01 \x01(\x03\x12\x19\n\x11max_output_tokens\x18\x02 \x01(\x03\x12\x18\n\x10max_total_tokens\x18\x03 \x01(\x03\x12\x13\n\x0b\x64\x65\x61\x64line_ms\x18\x04 \x01(\x03\"\xae\x02\n\x0bJobMetadata\x12\x11\n\ttenant_id\x18\x01 \x01(\t\x12\x10\n\x08\x61\x63tor_id\x18\x02 \x01(\t\x12.\n\nactor_type\x18\x03 \x01(\x0e\x32\x1a.cordum.agent.v1.ActorType\x12\x17\n\x0fidempotency_key\x18\x04 \x01(\t\x12\x12\n\ncapability\x18\x05 \x01(\t\x12\x11\n\trisk_tags\x18\x06 \x03(\t\x12\x10\n\x08requires\x18\x07 \x03(\t\x12\x0f\n\x07pack_id\x18\x08 \x01(\t\x12\x38\n\x06labels\x18\t \x03(\x0b\x32(.cordum.agent.v1.JobMetadata.LabelsEntry\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xa4\x05\n\x0c\x43ompensation\x12\r\n\x05topic\x18\x01 \x01(\t\x12\x13\n\x0b\x63ontext_ptr\x18\x02 \x01(\t\x12.\n\x08priority\x18\x03 \x01(\x0e\x32\x1c.cordum.agent.v1.JobPriority\x12\x12\n\nadapter_id\x18\x04 \x01(\t\x12\x33\n\x03\x65nv\x18\x05 \x03(\x0b\x32&.cordum.agent.v1.Compensation.EnvEntry\x12\x11\n\tmemory_id\x18\x06 \x01(\t\x12\x34\n\rcontext_hints\x18\x07 \x01(\x0b\x32\x1d.cordum.agent.v1.ContextHints\x12\'\n\x06\x62udget\x18\x08 \x01(\x0b\x32\x17.cordum.agent.v1.Budget\x12\x11\n\ttenant_id\x18\t \x01(\t\x12\x14\n\x0cprincipal_id\x18\n \x01(\t\x12\x39\n\x06labels\x18\x0b \x03(\x0b\x32).cordum.agent.v1.Compensation.LabelsEntry\x12*\n\x04meta\x18\x0c \x01(\x0b\x32\x1c.cordum.agent.v1.JobMetadata\x12\x32\n\x08identity\x18\r \x01(\x0b\x32 .cordum.agent.v1.IdentityBinding\x12\x33\n\x08\x64ispatch\x18\x0e \x01(\x0b\x32!.cordum.agent.v1.DispatchIdentity\x12\x31\n\x0b\x63ontext_ref\x18\x0f \x01(\x0b\x32\x1c.cordum.agent.v1.ResourceRef\x1a*\n\x08\x45nvEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xa3\x06\n\nJobRequest\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12\r\n\x05topic\x18\x02 \x01(\t\x12.\n\x08priority\x18\x03 \x01(\x0e\x32\x1c.cordum.agent.v1.JobPriority\x12\x13\n\x0b\x63ontext_ptr\x18\x04 \x01(\t\x12\x12\n\nadapter_id\x18\x05 \x01(\t\x12\x31\n\x03\x65nv\x18\x06 \x03(\x0b\x32$.cordum.agent.v1.JobRequest.EnvEntry\x12\x15\n\rparent_job_id\x18\x07 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x08 \x01(\t\x12\x12\n\nstep_index\x18\t \x01(\x05\x12\x11\n\tmemory_id\x18\n \x01(\t\x12\x34\n\rcontext_hints\x18\x0b \x01(\x0b\x32\x1d.cordum.agent.v1.ContextHints\x12\'\n\x06\x62udget\x18\x0c \x01(\x0b\x32\x17.cordum.agent.v1.Budget\x12\x11\n\ttenant_id\x18\r \x01(\t\x12\x14\n\x0cprincipal_id\x18\x0e \x01(\t\x12\x37\n\x06labels\x18\x0f \x03(\x0b\x32\'.cordum.agent.v1.JobRequest.LabelsEntry\x12*\n\x04meta\x18\x10 \x01(\x0b\x32\x1c.cordum.agent.v1.JobMetadata\x12\x33\n\x0c\x63ompensation\x18\x11 \x01(\x0b\x32\x1d.cordum.agent.v1.Compensation\x12\x32\n\x08identity\x18\x12 \x01(\x0b\x32 .cordum.agent.v1.IdentityBinding\x12\x33\n\x08\x64ispatch\x18\x13 \x01(\x0b\x32!.cordum.agent.v1.DispatchIdentity\x12\x31\n\x0b\x63ontext_ref\x18\x14 \x01(\x0b\x32\x1c.cordum.agent.v1.ResourceRef\x1a*\n\x08\x45nvEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xcb\x03\n\tJobResult\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12*\n\x06status\x18\x02 \x01(\x0e\x32\x1a.cordum.agent.v1.JobStatus\x12\x12\n\nresult_ptr\x18\x03 \x01(\t\x12\x11\n\tworker_id\x18\x04 \x01(\t\x12\x14\n\x0c\x65xecution_ms\x18\x05 \x01(\x03\x12\x12\n\nerror_code\x18\x06 \x01(\t\x12\x15\n\rerror_message\x18\x07 \x01(\t\x12\x15\n\rartifact_ptrs\x18\x08 \x03(\t\x12\x33\n\x0f\x65rror_code_enum\x18\t \x01(\x0e\x32\x1a.cordum.agent.v1.ErrorCode\x12\x33\n\x08\x64ispatch\x18\n \x01(\x0b\x32!.cordum.agent.v1.DispatchIdentity\x12\x32\n\x08identity\x18\x0b \x01(\x0b\x32 .cordum.agent.v1.IdentityBinding\x12\x30\n\nresult_ref\x18\x0c \x01(\x0b\x32\x1c.cordum.agent.v1.ResourceRef\x12\x33\n\rartifact_refs\x18\r \x03(\x0b\x32\x1c.cordum.agent.v1.ResourceRef\"\xf7\x02\n\x0bJobProgress\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12\x0f\n\x07step_id\x18\x02 \x01(\t\x12\x0f\n\x07percent\x18\x03 \x01(\x05\x12\x0f\n\x07message\x18\x04 \x01(\t\x12\x12\n\nresult_ptr\x18\x05 \x01(\t\x12\x15\n\rartifact_ptrs\x18\x06 \x03(\t\x12*\n\x06status\x18\x07 \x01(\x0e\x32\x1a.cordum.agent.v1.JobStatus\x12\x33\n\x08\x64ispatch\x18\x08 \x01(\x0b\x32!.cordum.agent.v1.DispatchIdentity\x12\x32\n\x08identity\x18\t \x01(\x0b\x32 .cordum.agent.v1.IdentityBinding\x12\x30\n\nresult_ref\x18\n \x01(\x0b\x32\x1c.cordum.agent.v1.ResourceRef\x12\x33\n\rartifact_refs\x18\x0b \x03(\x0b\x32\x1c.cordum.agent.v1.ResourceRef\"\xaa\x01\n\tJobCancel\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12\x0e\n\x06reason\x18\x02 \x01(\t\x12\x14\n\x0crequested_by\x18\x03 \x01(\t\x12\x33\n\x08\x64ispatch\x18\x04 \x01(\x0b\x32!.cordum.agent.v1.DispatchIdentity\x12\x32\n\x08identity\x18\x05 \x01(\x0b\x32 .cordum.agent.v1.IdentityBinding*|\n\x0bJobPriority\x12\x1c\n\x18JOB_PRIORITY_UNSPECIFIED\x10\x00\x12\x1c\n\x18JOB_PRIORITY_INTERACTIVE\x10\x01\x12\x16\n\x12JOB_PRIORITY_BATCH\x10\x02\x12\x19\n\x15JOB_PRIORITY_CRITICAL\x10\x03*\xc4\x02\n\tJobStatus\x12\x1a\n\x16JOB_STATUS_UNSPECIFIED\x10\x00\x12\x16\n\x12JOB_STATUS_PENDING\x10\x01\x12\x18\n\x14JOB_STATUS_SCHEDULED\x10\x02\x12\x19\n\x15JOB_STATUS_DISPATCHED\x10\x03\x12\x16\n\x12JOB_STATUS_RUNNING\x10\x04\x12\x18\n\x14JOB_STATUS_SUCCEEDED\x10\x05\x12\x15\n\x11JOB_STATUS_FAILED\x10\x06\x12\x18\n\x14JOB_STATUS_CANCELLED\x10\x07\x12\x15\n\x11JOB_STATUS_DENIED\x10\x08\x12\x16\n\x12JOB_STATUS_TIMEOUT\x10\t\x12\x1f\n\x1bJOB_STATUS_FAILED_RETRYABLE\x10\n\x12\x1b\n\x17JOB_STATUS_FAILED_FATAL\x10\x0b*U\n\tActorType\x12\x1a\n\x16\x41\x43TOR_TYPE_UNSPECIFIED\x10\x00\x12\x14\n\x10\x41\x43TOR_TYPE_HUMAN\x10\x01\x12\x16\n\x12\x41\x43TOR_TYPE_SERVICE\x10\x02*\xe1\x05\n\tErrorCode\x12\x1a\n\x16\x45RROR_CODE_UNSPECIFIED\x10\x00\x12(\n$ERROR_CODE_PROTOCOL_VERSION_MISMATCH\x10\x64\x12(\n$ERROR_CODE_PROTOCOL_MALFORMED_PACKET\x10\x65\x12\'\n#ERROR_CODE_PROTOCOL_UNKNOWN_PAYLOAD\x10\x66\x12)\n%ERROR_CODE_PROTOCOL_SIGNATURE_INVALID\x10g\x12)\n%ERROR_CODE_PROTOCOL_SIGNATURE_MISSING\x10h\x12\x1b\n\x16\x45RROR_CODE_JOB_TIMEOUT\x10\xc8\x01\x12&\n!ERROR_CODE_JOB_RESOURCE_EXHAUSTED\x10\xc9\x01\x12%\n ERROR_CODE_JOB_PERMISSION_DENIED\x10\xca\x01\x12!\n\x1c\x45RROR_CODE_JOB_INVALID_INPUT\x10\xcb\x01\x12\x1d\n\x18\x45RROR_CODE_JOB_NOT_FOUND\x10\xcc\x01\x12\x1d\n\x18\x45RROR_CODE_JOB_DUPLICATE\x10\xcd\x01\x12&\n!ERROR_CODE_JOB_WORKER_UNAVAILABLE\x10\xce\x01\x12\x1d\n\x18\x45RROR_CODE_SAFETY_DENIED\x10\xac\x02\x12\'\n\"ERROR_CODE_SAFETY_POLICY_VIOLATION\x10\xad\x02\x12\'\n\"ERROR_CODE_SAFETY_RISK_TAG_BLOCKED\x10\xae\x02\x12(\n#ERROR_CODE_TRANSPORT_PUBLISH_FAILED\x10\x90\x03\x12*\n%ERROR_CODE_TRANSPORT_SUBSCRIBE_FAILED\x10\x91\x03\x12)\n$ERROR_CODE_TRANSPORT_CONNECTION_LOST\x10\x92\x03\x42\x7f\n\x16io.cordum.cap.agent.v1P\x01Z+github.com/cordum-io/cap/v2/cordum/agent/v1\xaa\x02\x0f\x43ordum.Agent.V1\xca\x02\x0f\x63ordum\\Agent\\V1\xea\x02\x11\x43ordum::Agent::V1b\x06proto3')
28
29
 
29
30
  _globals = globals()
30
31
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -42,38 +43,44 @@ if not _descriptor._USE_C_DESCRIPTORS:
42
43
  _globals['_JOBREQUEST_ENVENTRY']._serialized_options = b'8\001'
43
44
  _globals['_JOBREQUEST_LABELSENTRY']._loaded_options = None
44
45
  _globals['_JOBREQUEST_LABELSENTRY']._serialized_options = b'8\001'
45
- _globals['_JOBPRIORITY']._serialized_start=2235
46
- _globals['_JOBPRIORITY']._serialized_end=2359
47
- _globals['_JOBSTATUS']._serialized_start=2362
48
- _globals['_JOBSTATUS']._serialized_end=2686
49
- _globals['_ACTORTYPE']._serialized_start=2688
50
- _globals['_ACTORTYPE']._serialized_end=2773
51
- _globals['_ERRORCODE']._serialized_start=2776
52
- _globals['_ERRORCODE']._serialized_end=3513
53
- _globals['_CONTEXTHINTS']._serialized_start=46
54
- _globals['_CONTEXTHINTS']._serialized_end=154
55
- _globals['_BUDGET']._serialized_start=156
56
- _globals['_BUDGET']._serialized_end=264
57
- _globals['_JOBMETADATA']._serialized_start=267
58
- _globals['_JOBMETADATA']._serialized_end=569
59
- _globals['_JOBMETADATA_LABELSENTRY']._serialized_start=524
60
- _globals['_JOBMETADATA_LABELSENTRY']._serialized_end=569
61
- _globals['_COMPENSATION']._serialized_start=572
62
- _globals['_COMPENSATION']._serialized_end=1092
63
- _globals['_COMPENSATION_ENVENTRY']._serialized_start=1003
64
- _globals['_COMPENSATION_ENVENTRY']._serialized_end=1045
65
- _globals['_COMPENSATION_LABELSENTRY']._serialized_start=524
66
- _globals['_COMPENSATION_LABELSENTRY']._serialized_end=569
67
- _globals['_JOBREQUEST']._serialized_start=1095
68
- _globals['_JOBREQUEST']._serialized_end=1742
69
- _globals['_JOBREQUEST_ENVENTRY']._serialized_start=1003
70
- _globals['_JOBREQUEST_ENVENTRY']._serialized_end=1045
71
- _globals['_JOBREQUEST_LABELSENTRY']._serialized_start=524
72
- _globals['_JOBREQUEST_LABELSENTRY']._serialized_end=569
73
- _globals['_JOBRESULT']._serialized_start=1745
74
- _globals['_JOBRESULT']._serialized_end=1996
75
- _globals['_JOBPROGRESS']._serialized_start=1999
76
- _globals['_JOBPROGRESS']._serialized_end=2166
77
- _globals['_JOBCANCEL']._serialized_start=2168
78
- _globals['_JOBCANCEL']._serialized_end=2233
46
+ _globals['_JOBPRIORITY']._serialized_start=3460
47
+ _globals['_JOBPRIORITY']._serialized_end=3584
48
+ _globals['_JOBSTATUS']._serialized_start=3587
49
+ _globals['_JOBSTATUS']._serialized_end=3911
50
+ _globals['_ACTORTYPE']._serialized_start=3913
51
+ _globals['_ACTORTYPE']._serialized_end=3998
52
+ _globals['_ERRORCODE']._serialized_start=4001
53
+ _globals['_ERRORCODE']._serialized_end=4738
54
+ _globals['_IDENTITYBINDING']._serialized_start=79
55
+ _globals['_IDENTITYBINDING']._serialized_end=178
56
+ _globals['_DISPATCHIDENTITY']._serialized_start=180
57
+ _globals['_DISPATCHIDENTITY']._serialized_end=264
58
+ _globals['_RESOURCEREF']._serialized_start=267
59
+ _globals['_RESOURCEREF']._serialized_end=435
60
+ _globals['_CONTEXTHINTS']._serialized_start=437
61
+ _globals['_CONTEXTHINTS']._serialized_end=545
62
+ _globals['_BUDGET']._serialized_start=547
63
+ _globals['_BUDGET']._serialized_end=655
64
+ _globals['_JOBMETADATA']._serialized_start=658
65
+ _globals['_JOBMETADATA']._serialized_end=960
66
+ _globals['_JOBMETADATA_LABELSENTRY']._serialized_start=915
67
+ _globals['_JOBMETADATA_LABELSENTRY']._serialized_end=960
68
+ _globals['_COMPENSATION']._serialized_start=963
69
+ _globals['_COMPENSATION']._serialized_end=1639
70
+ _globals['_COMPENSATION_ENVENTRY']._serialized_start=1550
71
+ _globals['_COMPENSATION_ENVENTRY']._serialized_end=1592
72
+ _globals['_COMPENSATION_LABELSENTRY']._serialized_start=915
73
+ _globals['_COMPENSATION_LABELSENTRY']._serialized_end=960
74
+ _globals['_JOBREQUEST']._serialized_start=1642
75
+ _globals['_JOBREQUEST']._serialized_end=2445
76
+ _globals['_JOBREQUEST_ENVENTRY']._serialized_start=1550
77
+ _globals['_JOBREQUEST_ENVENTRY']._serialized_end=1592
78
+ _globals['_JOBREQUEST_LABELSENTRY']._serialized_start=915
79
+ _globals['_JOBREQUEST_LABELSENTRY']._serialized_end=960
80
+ _globals['_JOBRESULT']._serialized_start=2448
81
+ _globals['_JOBRESULT']._serialized_end=2907
82
+ _globals['_JOBPROGRESS']._serialized_start=2910
83
+ _globals['_JOBPROGRESS']._serialized_end=3285
84
+ _globals['_JOBCANCEL']._serialized_start=3288
85
+ _globals['_JOBCANCEL']._serialized_end=3458
79
86
  # @@protoc_insertion_point(module_scope)
@@ -4,7 +4,7 @@ import grpc
4
4
  import warnings
5
5
 
6
6
 
7
- GRPC_GENERATED_VERSION = '1.80.0'
7
+ GRPC_GENERATED_VERSION = '1.76.0'
8
8
  GRPC_VERSION = grpc.__version__
9
9
  _version_not_supported = False
10
10
 
@@ -5,7 +5,7 @@ import warnings
5
5
 
6
6
  from cordum.agent.v1 import policy_pb2 as cordum_dot_agent_dot_v1_dot_policy__pb2
7
7
 
8
- GRPC_GENERATED_VERSION = '1.80.0'
8
+ GRPC_GENERATED_VERSION = '1.76.0'
9
9
  GRPC_VERSION = grpc.__version__
10
10
  _version_not_supported = False
11
11
 
@@ -25,7 +25,7 @@ _sym_db = _symbol_database.Default()
25
25
  from cordum.agent.v1 import job_pb2 as cordum_dot_agent_dot_v1_dot_job__pb2
26
26
 
27
27
 
28
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1c\x63ordum/agent/v1/safety.proto\x12\x0f\x63ordum.agent.v1\x1a\x19\x63ordum/agent/v1/job.proto\"\xe0\x03\n\x12PolicyCheckRequest\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12\r\n\x05topic\x18\x02 \x01(\t\x12\x0e\n\x06tenant\x18\x03 \x01(\t\x12.\n\x08priority\x18\x04 \x01(\x0e\x32\x1c.cordum.agent.v1.JobPriority\x12\x16\n\x0e\x65stimated_cost\x18\x05 \x01(\x01\x12\'\n\x06\x62udget\x18\x06 \x01(\x0b\x32\x17.cordum.agent.v1.Budget\x12\x14\n\x0cprincipal_id\x18\x07 \x01(\t\x12?\n\x06labels\x18\x08 \x03(\x0b\x32/.cordum.agent.v1.PolicyCheckRequest.LabelsEntry\x12\x11\n\tmemory_id\x18\t \x01(\t\x12\x18\n\x10\x65\x66\x66\x65\x63tive_config\x18\n \x01(\x0c\x12*\n\x04meta\x18\x0b \x01(\x0b\x32\x1c.cordum.agent.v1.JobMetadata\x12\x15\n\rinput_content\x18\x14 \x01(\x0c\x12\x1a\n\x12input_content_type\x18\x15 \x01(\t\x12\x18\n\x10input_size_bytes\x18\x16 \x01(\x03\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"y\n\x11\x42udgetConstraints\x12\x16\n\x0emax_runtime_ms\x18\x01 \x01(\x03\x12\x13\n\x0bmax_retries\x18\x02 \x01(\x05\x12\x1a\n\x12max_artifact_bytes\x18\x03 \x01(\x03\x12\x1b\n\x13max_concurrent_jobs\x18\x04 \x01(\x05\"j\n\x0eSandboxProfile\x12\x10\n\x08isolated\x18\x01 \x01(\x08\x12\x19\n\x11network_allowlist\x18\x02 \x03(\t\x12\x14\n\x0c\x66s_read_only\x18\x03 \x03(\t\x12\x15\n\rfs_read_write\x18\x04 \x03(\t\"G\n\x14ToolchainConstraints\x12\x15\n\rallowed_tools\x18\x01 \x03(\t\x12\x18\n\x10\x61llowed_commands\x18\x02 \x03(\t\"P\n\x0f\x44iffConstraints\x12\x11\n\tmax_files\x18\x01 \x01(\x05\x12\x11\n\tmax_lines\x18\x02 \x01(\x05\x12\x17\n\x0f\x64\x65ny_path_globs\x18\x03 \x03(\t\"\xfd\x01\n\x11PolicyConstraints\x12\x33\n\x07\x62udgets\x18\x01 \x01(\x0b\x32\".cordum.agent.v1.BudgetConstraints\x12\x30\n\x07sandbox\x18\x02 \x01(\x0b\x32\x1f.cordum.agent.v1.SandboxProfile\x12\x38\n\ttoolchain\x18\x03 \x01(\x0b\x32%.cordum.agent.v1.ToolchainConstraints\x12.\n\x04\x64iff\x18\x04 \x01(\x0b\x32 .cordum.agent.v1.DiffConstraints\x12\x17\n\x0fredaction_level\x18\x05 \x01(\t\"\x8a\x02\n\x11PolicyRemediation\x12\n\n\x02id\x18\x01 \x01(\t\x12\r\n\x05title\x18\x02 \x01(\t\x12\x0f\n\x07summary\x18\x03 \x01(\t\x12\x19\n\x11replacement_topic\x18\x04 \x01(\t\x12\x1e\n\x16replacement_capability\x18\x05 \x01(\t\x12\x45\n\nadd_labels\x18\x06 \x03(\x0b\x32\x31.cordum.agent.v1.PolicyRemediation.AddLabelsEntry\x12\x15\n\rremove_labels\x18\x07 \x03(\t\x1a\x30\n\x0e\x41\x64\x64LabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xc2\x02\n\x13PolicyCheckResponse\x12/\n\x08\x64\x65\x63ision\x18\x01 \x01(\x0e\x32\x1d.cordum.agent.v1.DecisionType\x12\x0e\n\x06reason\x18\x02 \x01(\t\x12\x1c\n\x14redacted_context_ptr\x18\x03 \x01(\t\x12\x17\n\x0fpolicy_snapshot\x18\x04 \x01(\t\x12\x0f\n\x07rule_id\x18\x05 \x01(\t\x12\x37\n\x0b\x63onstraints\x18\x06 \x01(\x0b\x32\".cordum.agent.v1.PolicyConstraints\x12\x19\n\x11\x61pproval_required\x18\x07 \x01(\x08\x12\x14\n\x0c\x61pproval_ref\x18\x08 \x01(\t\x12\x38\n\x0cremediations\x18\t \x03(\x0b\x32\".cordum.agent.v1.PolicyRemediation\"\x16\n\x14ListSnapshotsRequest\"*\n\x15ListSnapshotsResponse\x12\x11\n\tsnapshots\x18\x01 \x03(\t*\xfd\x01\n\x0c\x44\x65\x63isionType\x12\x1d\n\x19\x44\x45\x43ISION_TYPE_UNSPECIFIED\x10\x00\x12\x17\n\x13\x44\x45\x43ISION_TYPE_ALLOW\x10\x01\x12\x16\n\x12\x44\x45\x43ISION_TYPE_DENY\x10\x02\x12\x1f\n\x1b\x44\x45\x43ISION_TYPE_REQUIRE_HUMAN\x10\x03\x12\x1a\n\x16\x44\x45\x43ISION_TYPE_THROTTLE\x10\x04\x12(\n$DECISION_TYPE_ALLOW_WITH_CONSTRAINTS\x10\x05\x12\x1c\n\x18\x44\x45\x43ISION_TYPE_QUARANTINE\x10\x06\x12\x18\n\x14\x44\x45\x43ISION_TYPE_REDACT\x10\x07\x32\xc6\x03\n\x0cSafetyKernel\x12R\n\x05\x43heck\x12#.cordum.agent.v1.PolicyCheckRequest\x1a$.cordum.agent.v1.PolicyCheckResponse\x12U\n\x08\x45valuate\x12#.cordum.agent.v1.PolicyCheckRequest\x1a$.cordum.agent.v1.PolicyCheckResponse\x12T\n\x07\x45xplain\x12#.cordum.agent.v1.PolicyCheckRequest\x1a$.cordum.agent.v1.PolicyCheckResponse\x12U\n\x08Simulate\x12#.cordum.agent.v1.PolicyCheckRequest\x1a$.cordum.agent.v1.PolicyCheckResponse\x12^\n\rListSnapshots\x12%.cordum.agent.v1.ListSnapshotsRequest\x1a&.cordum.agent.v1.ListSnapshotsResponseB\x7f\n\x16io.cordum.cap.agent.v1P\x01Z+github.com/cordum-io/cap/v2/cordum/agent/v1\xaa\x02\x0f\x43ordum.Agent.V1\xca\x02\x0f\x63ordum\\Agent\\V1\xea\x02\x11\x43ordum::Agent::V1b\x06proto3')
28
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1c\x63ordum/agent/v1/safety.proto\x12\x0f\x63ordum.agent.v1\x1a\x19\x63ordum/agent/v1/job.proto\"\xc5\x04\n\x12PolicyCheckRequest\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12\r\n\x05topic\x18\x02 \x01(\t\x12\x0e\n\x06tenant\x18\x03 \x01(\t\x12.\n\x08priority\x18\x04 \x01(\x0e\x32\x1c.cordum.agent.v1.JobPriority\x12\x16\n\x0e\x65stimated_cost\x18\x05 \x01(\x01\x12\'\n\x06\x62udget\x18\x06 \x01(\x0b\x32\x17.cordum.agent.v1.Budget\x12\x14\n\x0cprincipal_id\x18\x07 \x01(\t\x12?\n\x06labels\x18\x08 \x03(\x0b\x32/.cordum.agent.v1.PolicyCheckRequest.LabelsEntry\x12\x11\n\tmemory_id\x18\t \x01(\t\x12\x18\n\x10\x65\x66\x66\x65\x63tive_config\x18\n \x01(\x0c\x12*\n\x04meta\x18\x0b \x01(\x0b\x32\x1c.cordum.agent.v1.JobMetadata\x12\x32\n\x08identity\x18\x0c \x01(\x0b\x32 .cordum.agent.v1.IdentityBinding\x12/\n\tinput_ref\x18\r \x01(\x0b\x32\x1c.cordum.agent.v1.ResourceRef\x12\x15\n\rinput_content\x18\x14 \x01(\x0c\x12\x1a\n\x12input_content_type\x18\x15 \x01(\t\x12\x18\n\x10input_size_bytes\x18\x16 \x01(\x03\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"y\n\x11\x42udgetConstraints\x12\x16\n\x0emax_runtime_ms\x18\x01 \x01(\x03\x12\x13\n\x0bmax_retries\x18\x02 \x01(\x05\x12\x1a\n\x12max_artifact_bytes\x18\x03 \x01(\x03\x12\x1b\n\x13max_concurrent_jobs\x18\x04 \x01(\x05\"j\n\x0eSandboxProfile\x12\x10\n\x08isolated\x18\x01 \x01(\x08\x12\x19\n\x11network_allowlist\x18\x02 \x03(\t\x12\x14\n\x0c\x66s_read_only\x18\x03 \x03(\t\x12\x15\n\rfs_read_write\x18\x04 \x03(\t\"G\n\x14ToolchainConstraints\x12\x15\n\rallowed_tools\x18\x01 \x03(\t\x12\x18\n\x10\x61llowed_commands\x18\x02 \x03(\t\"P\n\x0f\x44iffConstraints\x12\x11\n\tmax_files\x18\x01 \x01(\x05\x12\x11\n\tmax_lines\x18\x02 \x01(\x05\x12\x17\n\x0f\x64\x65ny_path_globs\x18\x03 \x03(\t\"\xfd\x01\n\x11PolicyConstraints\x12\x33\n\x07\x62udgets\x18\x01 \x01(\x0b\x32\".cordum.agent.v1.BudgetConstraints\x12\x30\n\x07sandbox\x18\x02 \x01(\x0b\x32\x1f.cordum.agent.v1.SandboxProfile\x12\x38\n\ttoolchain\x18\x03 \x01(\x0b\x32%.cordum.agent.v1.ToolchainConstraints\x12.\n\x04\x64iff\x18\x04 \x01(\x0b\x32 .cordum.agent.v1.DiffConstraints\x12\x17\n\x0fredaction_level\x18\x05 \x01(\t\"\x8a\x02\n\x11PolicyRemediation\x12\n\n\x02id\x18\x01 \x01(\t\x12\r\n\x05title\x18\x02 \x01(\t\x12\x0f\n\x07summary\x18\x03 \x01(\t\x12\x19\n\x11replacement_topic\x18\x04 \x01(\t\x12\x1e\n\x16replacement_capability\x18\x05 \x01(\t\x12\x45\n\nadd_labels\x18\x06 \x03(\x0b\x32\x31.cordum.agent.v1.PolicyRemediation.AddLabelsEntry\x12\x15\n\rremove_labels\x18\x07 \x03(\t\x1a\x30\n\x0e\x41\x64\x64LabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xb2\x03\n\x13PolicyCheckResponse\x12/\n\x08\x64\x65\x63ision\x18\x01 \x01(\x0e\x32\x1d.cordum.agent.v1.DecisionType\x12\x0e\n\x06reason\x18\x02 \x01(\t\x12\x1c\n\x14redacted_context_ptr\x18\x03 \x01(\t\x12\x17\n\x0fpolicy_snapshot\x18\x04 \x01(\t\x12\x0f\n\x07rule_id\x18\x05 \x01(\t\x12\x37\n\x0b\x63onstraints\x18\x06 \x01(\x0b\x32\".cordum.agent.v1.PolicyConstraints\x12\x19\n\x11\x61pproval_required\x18\x07 \x01(\x08\x12\x14\n\x0c\x61pproval_ref\x18\x08 \x01(\t\x12\x38\n\x0cremediations\x18\t \x03(\x0b\x32\".cordum.agent.v1.PolicyRemediation\x12:\n\x14redacted_context_ref\x18\n \x01(\x0b\x32\x1c.cordum.agent.v1.ResourceRef\x12\x32\n\x08identity\x18\x0b \x01(\x0b\x32 .cordum.agent.v1.IdentityBinding\"\x16\n\x14ListSnapshotsRequest\"*\n\x15ListSnapshotsResponse\x12\x11\n\tsnapshots\x18\x01 \x03(\t*\xfd\x01\n\x0c\x44\x65\x63isionType\x12\x1d\n\x19\x44\x45\x43ISION_TYPE_UNSPECIFIED\x10\x00\x12\x17\n\x13\x44\x45\x43ISION_TYPE_ALLOW\x10\x01\x12\x16\n\x12\x44\x45\x43ISION_TYPE_DENY\x10\x02\x12\x1f\n\x1b\x44\x45\x43ISION_TYPE_REQUIRE_HUMAN\x10\x03\x12\x1a\n\x16\x44\x45\x43ISION_TYPE_THROTTLE\x10\x04\x12(\n$DECISION_TYPE_ALLOW_WITH_CONSTRAINTS\x10\x05\x12\x1c\n\x18\x44\x45\x43ISION_TYPE_QUARANTINE\x10\x06\x12\x18\n\x14\x44\x45\x43ISION_TYPE_REDACT\x10\x07\x32\xc6\x03\n\x0cSafetyKernel\x12R\n\x05\x43heck\x12#.cordum.agent.v1.PolicyCheckRequest\x1a$.cordum.agent.v1.PolicyCheckResponse\x12U\n\x08\x45valuate\x12#.cordum.agent.v1.PolicyCheckRequest\x1a$.cordum.agent.v1.PolicyCheckResponse\x12T\n\x07\x45xplain\x12#.cordum.agent.v1.PolicyCheckRequest\x1a$.cordum.agent.v1.PolicyCheckResponse\x12U\n\x08Simulate\x12#.cordum.agent.v1.PolicyCheckRequest\x1a$.cordum.agent.v1.PolicyCheckResponse\x12^\n\rListSnapshots\x12%.cordum.agent.v1.ListSnapshotsRequest\x1a&.cordum.agent.v1.ListSnapshotsResponseB\x7f\n\x16io.cordum.cap.agent.v1P\x01Z+github.com/cordum-io/cap/v2/cordum/agent/v1\xaa\x02\x0f\x43ordum.Agent.V1\xca\x02\x0f\x63ordum\\Agent\\V1\xea\x02\x11\x43ordum::Agent::V1b\x06proto3')
29
29
 
30
30
  _globals = globals()
31
31
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -37,32 +37,32 @@ if not _descriptor._USE_C_DESCRIPTORS:
37
37
  _globals['_POLICYCHECKREQUEST_LABELSENTRY']._serialized_options = b'8\001'
38
38
  _globals['_POLICYREMEDIATION_ADDLABELSENTRY']._loaded_options = None
39
39
  _globals['_POLICYREMEDIATION_ADDLABELSENTRY']._serialized_options = b'8\001'
40
- _globals['_DECISIONTYPE']._serialized_start=1864
41
- _globals['_DECISIONTYPE']._serialized_end=2117
40
+ _globals['_DECISIONTYPE']._serialized_start=2077
41
+ _globals['_DECISIONTYPE']._serialized_end=2330
42
42
  _globals['_POLICYCHECKREQUEST']._serialized_start=77
43
- _globals['_POLICYCHECKREQUEST']._serialized_end=557
44
- _globals['_POLICYCHECKREQUEST_LABELSENTRY']._serialized_start=512
45
- _globals['_POLICYCHECKREQUEST_LABELSENTRY']._serialized_end=557
46
- _globals['_BUDGETCONSTRAINTS']._serialized_start=559
47
- _globals['_BUDGETCONSTRAINTS']._serialized_end=680
48
- _globals['_SANDBOXPROFILE']._serialized_start=682
49
- _globals['_SANDBOXPROFILE']._serialized_end=788
50
- _globals['_TOOLCHAINCONSTRAINTS']._serialized_start=790
51
- _globals['_TOOLCHAINCONSTRAINTS']._serialized_end=861
52
- _globals['_DIFFCONSTRAINTS']._serialized_start=863
53
- _globals['_DIFFCONSTRAINTS']._serialized_end=943
54
- _globals['_POLICYCONSTRAINTS']._serialized_start=946
55
- _globals['_POLICYCONSTRAINTS']._serialized_end=1199
56
- _globals['_POLICYREMEDIATION']._serialized_start=1202
57
- _globals['_POLICYREMEDIATION']._serialized_end=1468
58
- _globals['_POLICYREMEDIATION_ADDLABELSENTRY']._serialized_start=1420
59
- _globals['_POLICYREMEDIATION_ADDLABELSENTRY']._serialized_end=1468
60
- _globals['_POLICYCHECKRESPONSE']._serialized_start=1471
61
- _globals['_POLICYCHECKRESPONSE']._serialized_end=1793
62
- _globals['_LISTSNAPSHOTSREQUEST']._serialized_start=1795
63
- _globals['_LISTSNAPSHOTSREQUEST']._serialized_end=1817
64
- _globals['_LISTSNAPSHOTSRESPONSE']._serialized_start=1819
65
- _globals['_LISTSNAPSHOTSRESPONSE']._serialized_end=1861
66
- _globals['_SAFETYKERNEL']._serialized_start=2120
67
- _globals['_SAFETYKERNEL']._serialized_end=2574
43
+ _globals['_POLICYCHECKREQUEST']._serialized_end=658
44
+ _globals['_POLICYCHECKREQUEST_LABELSENTRY']._serialized_start=613
45
+ _globals['_POLICYCHECKREQUEST_LABELSENTRY']._serialized_end=658
46
+ _globals['_BUDGETCONSTRAINTS']._serialized_start=660
47
+ _globals['_BUDGETCONSTRAINTS']._serialized_end=781
48
+ _globals['_SANDBOXPROFILE']._serialized_start=783
49
+ _globals['_SANDBOXPROFILE']._serialized_end=889
50
+ _globals['_TOOLCHAINCONSTRAINTS']._serialized_start=891
51
+ _globals['_TOOLCHAINCONSTRAINTS']._serialized_end=962
52
+ _globals['_DIFFCONSTRAINTS']._serialized_start=964
53
+ _globals['_DIFFCONSTRAINTS']._serialized_end=1044
54
+ _globals['_POLICYCONSTRAINTS']._serialized_start=1047
55
+ _globals['_POLICYCONSTRAINTS']._serialized_end=1300
56
+ _globals['_POLICYREMEDIATION']._serialized_start=1303
57
+ _globals['_POLICYREMEDIATION']._serialized_end=1569
58
+ _globals['_POLICYREMEDIATION_ADDLABELSENTRY']._serialized_start=1521
59
+ _globals['_POLICYREMEDIATION_ADDLABELSENTRY']._serialized_end=1569
60
+ _globals['_POLICYCHECKRESPONSE']._serialized_start=1572
61
+ _globals['_POLICYCHECKRESPONSE']._serialized_end=2006
62
+ _globals['_LISTSNAPSHOTSREQUEST']._serialized_start=2008
63
+ _globals['_LISTSNAPSHOTSREQUEST']._serialized_end=2030
64
+ _globals['_LISTSNAPSHOTSRESPONSE']._serialized_start=2032
65
+ _globals['_LISTSNAPSHOTSRESPONSE']._serialized_end=2074
66
+ _globals['_SAFETYKERNEL']._serialized_start=2333
67
+ _globals['_SAFETYKERNEL']._serialized_end=2787
68
68
  # @@protoc_insertion_point(module_scope)
@@ -5,7 +5,7 @@ import warnings
5
5
 
6
6
  from cordum.agent.v1 import safety_pb2 as cordum_dot_agent_dot_v1_dot_safety__pb2
7
7
 
8
- GRPC_GENERATED_VERSION = '1.80.0'
8
+ GRPC_GENERATED_VERSION = '1.76.0'
9
9
  GRPC_VERSION = grpc.__version__
10
10
  _version_not_supported = False
11
11
 
@@ -0,0 +1,222 @@
1
+ """CAP-PRODUCTION managed-worker event echo, sealing, and admission.
2
+
3
+ Python parity for sdk/go/worker/managed_events.go + managed_production.go.
4
+
5
+ The contract, in one line: the authority a worker echoes on outgoing events is
6
+ frozen from the ADMITTED request before handler code runs, and a handler that
7
+ contradicts it is rejected rather than silently overridden. Silent override is
8
+ tempting and wrong -- it turns a handler bug (or a compromised handler) into a
9
+ correctly-signed event carrying someone else's identity.
10
+
11
+ Ordering matters and is not incidental:
12
+ verify signature/audience/expiry -> validate identity binding -> replay-admit
13
+ -> only then invoke the handler.
14
+ Replay admission sits AFTER verification so an unauthenticated packet can never
15
+ consume a replay slot, and BEFORE the handler so a redelivery cannot re-run a
16
+ side effect.
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ import hashlib
22
+ import os
23
+ from dataclasses import dataclass
24
+ from datetime import datetime, timedelta, timezone
25
+ from typing import Callable, Optional, Protocol
26
+
27
+ from cryptography.hazmat.primitives.asymmetric import ec
28
+
29
+ from .constants import DEFAULT_PROTOCOL_VERSION
30
+ from .pb.cordum.agent.v1.buspacket_pb2 import BusPacket
31
+ from .pb.cordum.agent.v1.job_pb2 import DispatchIdentity, IdentityBinding, JobRequest
32
+ from .production_replay import ReplayOutcome
33
+ from .production_signing import (
34
+ ALGORITHM,
35
+ DEFAULT_MAX_LIFETIME,
36
+ PROFILE_VERSION,
37
+ ProductionSignatureError,
38
+ ProductionTrust,
39
+ extract_signature,
40
+ sign_production_packet,
41
+ verify_production_packet,
42
+ )
43
+ from .production_validation import validate_identity_binding
44
+
45
+ MESSAGE_ID_BYTES = 16
46
+
47
+ __all__ = [
48
+ "ProductionEventAuthority",
49
+ "ProductionEventConflictError",
50
+ "admit_production_event",
51
+ "bind_production_event",
52
+ "freeze_production_authority",
53
+ "seal_production_event",
54
+ ]
55
+
56
+
57
+ class ProductionEventConflictError(ValueError):
58
+ """A handler supplied identity, dispatch, or job_id contradicting the admitted request."""
59
+
60
+
61
+ class _ReplayStore(Protocol):
62
+ def admit(
63
+ self,
64
+ tenant: str,
65
+ audience: str,
66
+ sender: str,
67
+ message_id: bytes,
68
+ digest: bytes,
69
+ expires_at: datetime,
70
+ ) -> ReplayOutcome: ...
71
+
72
+
73
+ @dataclass(frozen=True)
74
+ class ProductionEventAuthority:
75
+ """Immutable snapshot of the admitted request's authority.
76
+
77
+ Holds deep copies, so neither handler code nor a previously emitted event can
78
+ reach back and mutate what later events will echo.
79
+ """
80
+
81
+ job_id: str
82
+ identity: IdentityBinding
83
+ dispatch: DispatchIdentity
84
+
85
+
86
+ def freeze_production_authority(request: JobRequest) -> ProductionEventAuthority:
87
+ """Snapshot the admitted request's authority before any handler runs."""
88
+ if request is None:
89
+ raise ProductionEventConflictError("cannot freeze authority from a missing request")
90
+ if not request.job_id:
91
+ raise ProductionEventConflictError("admitted request carries no job id")
92
+ identity = IdentityBinding()
93
+ identity.CopyFrom(request.identity)
94
+ dispatch = DispatchIdentity()
95
+ dispatch.CopyFrom(request.dispatch)
96
+ return ProductionEventAuthority(job_id=request.job_id, identity=identity, dispatch=dispatch)
97
+
98
+
99
+ def bind_production_event(event, authority: ProductionEventAuthority) -> None:
100
+ """Echo the frozen authority onto an outgoing Result/Progress/Cancel.
101
+
102
+ An unset field is filled. A field the handler set to something DIFFERENT is a
103
+ conflict and raises -- we do not quietly correct it, because a handler that
104
+ believes it is emitting for another job/attempt has a bug worth surfacing.
105
+ """
106
+ if event is None:
107
+ raise ProductionEventConflictError("cannot bind a missing event")
108
+ if authority is None:
109
+ raise ProductionEventConflictError("cannot bind without an admitted authority")
110
+
111
+ if event.job_id and event.job_id != authority.job_id:
112
+ raise ProductionEventConflictError(
113
+ f"event job id {event.job_id!r} conflicts with admitted {authority.job_id!r}"
114
+ )
115
+ event.job_id = authority.job_id
116
+
117
+ if event.HasField("identity") and event.identity != authority.identity:
118
+ raise ProductionEventConflictError("event identity conflicts with admitted authority")
119
+ event.identity.CopyFrom(authority.identity)
120
+
121
+ if event.HasField("dispatch") and event.dispatch != authority.dispatch:
122
+ raise ProductionEventConflictError("event dispatch conflicts with admitted authority")
123
+ event.dispatch.CopyFrom(authority.dispatch)
124
+
125
+
126
+ def seal_production_event(
127
+ packet: BusPacket,
128
+ *,
129
+ key: ec.EllipticCurvePrivateKey,
130
+ key_id: str,
131
+ audience: str,
132
+ lifetime: timedelta = DEFAULT_MAX_LIFETIME,
133
+ now: Optional[Callable[[], datetime]] = None,
134
+ ) -> bytes:
135
+ """Stamp fresh signature metadata and produce signed production wire bytes.
136
+
137
+ `audience` MUST be the subject the caller is about to publish on. Binding to
138
+ anything else (a configured default, the inbound subject) would let a packet
139
+ captured on one subject be replayed onto another.
140
+ """
141
+ if not key_id or not key_id.strip():
142
+ raise ValueError("production sealing requires a key id")
143
+ if not audience or not audience.strip():
144
+ raise ValueError("production sealing requires the outbound subject as audience")
145
+ if lifetime <= timedelta(0) or lifetime > DEFAULT_MAX_LIFETIME:
146
+ raise ValueError("production sealing requires a bounded positive lifetime")
147
+
148
+ outgoing = BusPacket()
149
+ outgoing.CopyFrom(packet)
150
+ outgoing.ClearField("signature")
151
+ # extract_signature rejects wire without field 4, so an unset protocol
152
+ # version yields bytes that cannot be verified by anyone. Defaulting here
153
+ # keeps that failure impossible rather than merely documented; a caller that
154
+ # set it explicitly is left alone.
155
+ if not outgoing.protocol_version:
156
+ outgoing.protocol_version = DEFAULT_PROTOCOL_VERSION
157
+
158
+ metadata = outgoing.signature_metadata
159
+ metadata.profile_version = PROFILE_VERSION
160
+ metadata.algorithm = ALGORITHM
161
+ # Fresh per message. A reused id silently breaks replay de-duplication for
162
+ # every consumer, so this is generated here rather than taken from a caller.
163
+ metadata.message_id = os.urandom(MESSAGE_ID_BYTES)
164
+ metadata.audience = audience
165
+ metadata.key_id = key_id
166
+ issued = now() if now is not None else datetime.now(timezone.utc)
167
+ metadata.expires_at.FromDatetime(issued + lifetime)
168
+
169
+ return sign_production_packet(outgoing, key)
170
+
171
+
172
+ def admit_production_event(
173
+ raw: bytes,
174
+ *,
175
+ trust: ProductionTrust,
176
+ replay: _ReplayStore,
177
+ handler: Callable[[JobRequest], None],
178
+ ) -> Optional[BusPacket]:
179
+ """Verify, identity-check, and replay-admit raw wire bytes, then dispatch.
180
+
181
+ Returns the verified packet when the handler ran, or None when the message
182
+ was a duplicate redelivery. Replay conflict and replay-store-unavailable both
183
+ propagate: the caller must fail closed (NAK/retry), never ack-and-drop.
184
+ """
185
+ packet = verify_production_packet(raw, trust)
186
+
187
+ if not packet.HasField("job_request"):
188
+ raise ProductionEventConflictError("production admission requires a job request")
189
+ request = packet.job_request
190
+ if packet.HasField("identity"):
191
+ # Envelope identity is authoritative; a payload mirror that disagrees is
192
+ # refused rather than reconciled.
193
+ validate_identity_binding(request, packet.identity)
194
+
195
+ unsigned, _ = extract_signature(raw)
196
+ # The signed-BODY digest: sha256 of the unsigned wire with no domain prefix.
197
+ # Deliberately not the domain-separated SIGNATURE preimage -- that is a
198
+ # different value over the same bytes, and a store shared with cap/runtime.py,
199
+ # Go's ProductionSignedBodyDigest or Node's runtime.ts would then see two
200
+ # digests for one message and reject a valid redelivery as a conflict.
201
+ # Pinned cross-language by test/fixtures/production-signing-v1.json's
202
+ # body_digest_hex vs preimage_digest_hex.
203
+ digest = hashlib.sha256(unsigned).digest()
204
+ metadata = packet.signature_metadata
205
+ expires_at = metadata.expires_at.ToDatetime(tzinfo=timezone.utc)
206
+
207
+ outcome = replay.admit(
208
+ trust.tenant,
209
+ metadata.audience,
210
+ packet.sender_id,
211
+ metadata.message_id,
212
+ digest,
213
+ # spec/19 keeps entries until expiry PLUS clock skew. Verification
214
+ # tolerates the same skew, so evicting at bare expiry would leave a
215
+ # window where the packet still verifies but no replay record survives.
216
+ expires_at + trust.clock_skew,
217
+ )
218
+ if outcome is not ReplayOutcome.FIRST:
219
+ return None
220
+
221
+ handler(request)
222
+ return packet