legionio 1.4.112 → 1.4.113
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/CODEOWNERS +38 -0
- data/lib/legion/digital_worker/lifecycle.rb +18 -6
- data/lib/legion/digital_worker/registry.rb +1 -1
- data/lib/legion/digital_worker/risk_tier.rb +1 -1
- data/lib/legion/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6bc29dbdc043d80b9a773952e27947a051447a879614c525559cc713589563d7
|
|
4
|
+
data.tar.gz: 52849bf4f620389d528cec4a5100078d2ba84f61df813adaf92ee8b496ebc4cd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 32739ecd25c674deba1e604f4bbcb747c598cfcb471df7cfa79471747b109410449bcb20427bf68b7af812c926c93985fe7086367c3ab08ed851c53ac06f2b39
|
|
7
|
+
data.tar.gz: 4dc74a77ffc8652c40273ede520207b71ccdde127275fffebb8f386e8a27a11f0fbe1985cda6bf3e619e0a1d0a2827a894c8f8505e8c0833aa72bce66805877e
|
data/.rubocop.yml
CHANGED
|
@@ -18,6 +18,7 @@ Metrics/MethodLength:
|
|
|
18
18
|
Exclude:
|
|
19
19
|
- 'lib/legion/cli/chat_command.rb'
|
|
20
20
|
- 'lib/legion/api/openapi.rb'
|
|
21
|
+
- 'lib/legion/digital_worker/lifecycle.rb'
|
|
21
22
|
|
|
22
23
|
Metrics/ClassLength:
|
|
23
24
|
Max: 1500
|
|
@@ -58,11 +59,13 @@ Metrics/CyclomaticComplexity:
|
|
|
58
59
|
Exclude:
|
|
59
60
|
- 'lib/legion/cli/chat_command.rb'
|
|
60
61
|
- 'lib/legion/api/auth_human.rb'
|
|
62
|
+
- 'lib/legion/digital_worker/lifecycle.rb'
|
|
61
63
|
|
|
62
64
|
Metrics/PerceivedComplexity:
|
|
63
65
|
Max: 17
|
|
64
66
|
Exclude:
|
|
65
67
|
- 'lib/legion/api/auth_human.rb'
|
|
68
|
+
- 'lib/legion/digital_worker/lifecycle.rb'
|
|
66
69
|
|
|
67
70
|
Style/Documentation:
|
|
68
71
|
Enabled: false
|
data/CODEOWNERS
CHANGED
|
@@ -1 +1,39 @@
|
|
|
1
|
+
# Default owner — all files
|
|
1
2
|
* @Esity
|
|
3
|
+
|
|
4
|
+
# Core library code
|
|
5
|
+
# lib/ @Esity @future-core-team
|
|
6
|
+
|
|
7
|
+
# CLI commands
|
|
8
|
+
# lib/legion/cli/ @Esity
|
|
9
|
+
|
|
10
|
+
# REST API
|
|
11
|
+
# lib/legion/api/ @Esity
|
|
12
|
+
|
|
13
|
+
# Extensions loader
|
|
14
|
+
# lib/legion/extensions/ @Esity
|
|
15
|
+
|
|
16
|
+
# Service orchestrator and boot sequence
|
|
17
|
+
# lib/legion/service.rb @Esity @future-core-team
|
|
18
|
+
|
|
19
|
+
# Digital Worker platform
|
|
20
|
+
# lib/legion/digital_worker/ @Esity @future-platform-team
|
|
21
|
+
|
|
22
|
+
# Chat and AI REPL
|
|
23
|
+
# lib/legion/cli/chat/ @Esity @future-ai-team
|
|
24
|
+
|
|
25
|
+
# Audit and compliance
|
|
26
|
+
# lib/legion/audit/ @Esity @future-security-team
|
|
27
|
+
# lib/legion/api/audit.rb @Esity @future-security-team
|
|
28
|
+
|
|
29
|
+
# API middleware
|
|
30
|
+
# lib/legion/api/middleware/ @Esity @future-platform-team
|
|
31
|
+
|
|
32
|
+
# Specs
|
|
33
|
+
# spec/ @Esity @future-contributors
|
|
34
|
+
|
|
35
|
+
# Documentation
|
|
36
|
+
# *.md @Esity @future-docs-team
|
|
37
|
+
|
|
38
|
+
# CI/CD
|
|
39
|
+
# .github/ @Esity
|
|
@@ -48,6 +48,7 @@ module Legion
|
|
|
48
48
|
class InvalidTransition < StandardError; end
|
|
49
49
|
class GovernanceRequired < StandardError; end
|
|
50
50
|
class AuthorityRequired < StandardError; end
|
|
51
|
+
class GovernanceBlocked < StandardError; end
|
|
51
52
|
|
|
52
53
|
def self.transition!(worker, to_state:, by:, reason: nil, **opts)
|
|
53
54
|
from_state = worker.lifecycle_state
|
|
@@ -55,13 +56,24 @@ module Legion
|
|
|
55
56
|
|
|
56
57
|
raise InvalidTransition, "cannot transition from #{from_state} to #{to_state}" unless allowed.include?(to_state)
|
|
57
58
|
|
|
58
|
-
if
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
if defined?(Legion::Extensions::Governance::Runners::Governance)
|
|
60
|
+
review = Legion::Extensions::Governance::Runners::Governance.review_transition(
|
|
61
|
+
worker_id: worker.is_a?(Hash) ? worker[:id] : worker.worker_id,
|
|
62
|
+
from_state: from_state,
|
|
63
|
+
to_state: to_state,
|
|
64
|
+
principal_id: by,
|
|
65
|
+
worker_owner: worker.respond_to?(:owner_msid) ? worker.owner_msid : nil
|
|
66
|
+
)
|
|
67
|
+
raise GovernanceBlocked, "#{from_state} -> #{to_state} blocked: #{review[:reasons]&.join(', ')}" unless review[:allowed]
|
|
68
|
+
else
|
|
69
|
+
if governance_required?(from_state, to_state)
|
|
70
|
+
required = GOVERNANCE_REQUIRED[[from_state, to_state]]
|
|
71
|
+
raise GovernanceRequired, "#{from_state} -> #{to_state} requires #{required}" unless opts[:governance_override] == true
|
|
72
|
+
end
|
|
62
73
|
|
|
63
|
-
|
|
64
|
-
|
|
74
|
+
authority = authority_type(from_state, to_state)
|
|
75
|
+
raise AuthorityRequired, "#{from_state} -> #{to_state} requires #{authority} (by: #{by})" if authority && opts[:authority_verified] != true
|
|
76
|
+
end
|
|
65
77
|
|
|
66
78
|
worker.update(
|
|
67
79
|
lifecycle_state: to_state,
|
|
@@ -7,7 +7,7 @@ module Legion
|
|
|
7
7
|
class WorkerNotActive < StandardError; end
|
|
8
8
|
class InsufficientConsent < StandardError; end
|
|
9
9
|
|
|
10
|
-
CONSENT_HIERARCHY = %w[supervised consult
|
|
10
|
+
CONSENT_HIERARCHY = %w[supervised consult inform autonomous].freeze
|
|
11
11
|
|
|
12
12
|
@local_workers = Set.new
|
|
13
13
|
@local_workers_mutex = Mutex.new
|
|
@@ -8,7 +8,7 @@ module Legion
|
|
|
8
8
|
# Maps AIRB risk tiers to governance and consent constraints.
|
|
9
9
|
# These constraints are enforced when a worker attempts to execute a task.
|
|
10
10
|
CONSTRAINTS = {
|
|
11
|
-
'low' => { min_consent: '
|
|
11
|
+
'low' => { min_consent: 'inform', governance_gate: false, council_required: false },
|
|
12
12
|
'medium' => { min_consent: 'consult', governance_gate: false, council_required: false },
|
|
13
13
|
'high' => { min_consent: 'consult', governance_gate: true, council_required: true },
|
|
14
14
|
'critical' => { min_consent: 'supervised', governance_gate: true, council_required: true }
|
data/lib/legion/version.rb
CHANGED