acting_for 0.1.0 → 0.1.2
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c2cf10e43b5a53e032b3ed767d98a807a9781e8f02e451782d803b39336da444
|
|
4
|
+
data.tar.gz: 784c28baa1b257fdbc3628ddfa6d2c9609caba77c0785d93c8f4d6ba088bdb44
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fa525cb88236196b3751dfa14b362bed7487a799849288191530af319d47bdf95ad95c2602204332f0b02566a7538b9cc3d9ac2fc3e9b508c6077f1ab534dffa
|
|
7
|
+
data.tar.gz: d9ce75cd4ec4a74e2150aaebb53a6c2da9bdf645c806b3c137136b5bcca7ce69ce83910fcc9640c61d63f0081c92e0a456df7e20505ed75a4388cde0bfe175c1
|
data/README.md
CHANGED
|
@@ -14,7 +14,15 @@ AI AgentがPrincipalの代理として何をしてよいかを、委任された
|
|
|
14
14
|
|
|
15
15
|
## Status
|
|
16
16
|
|
|
17
|
-
> **
|
|
17
|
+
> **Released: v0.1.1.** ActingFor 0.1.1 is published on [RubyGems](https://rubygems.org/gems/acting_for) and as [GitHub Release v0.1.1](https://github.com/cuichangquan/acting_for/releases/tag/v0.1.1). It adds `Decision#reason_code` while keeping the existing Decision statuses, Delegation semantics, AuditEvent reason values, and database schema unchanged. CI covers Ruby 3.4 / 4.0, Rails 8.0 / 8.1, and PostgreSQL 16.
|
|
18
|
+
|
|
19
|
+
Next candidate: [0.1.2](docs/release_notes_v0_1_2.md) aligns constraint evaluation with the documented exact Symbol-key Context contract and adds an authorization-to-host-log correlation example. The candidate is not yet published; the released installation instructions below remain on 0.1.1.
|
|
20
|
+
|
|
21
|
+
## ActingFor at a glance
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
The diagram summarizes the v0.1 responsibility boundary: the Host authenticates/resolves the Agent and Principal and establishes trusted business data; ActingFor evaluates the Delegation and returns `allow`, `deny`, or `require_approval`. Approval workflow and business execution remain Host responsibilities.
|
|
18
26
|
|
|
19
27
|
## Why ActingFor?
|
|
20
28
|
|
|
@@ -168,19 +176,22 @@ decision = ActingFor.authorize(
|
|
|
168
176
|
context: { amount: product.price }
|
|
169
177
|
)
|
|
170
178
|
|
|
179
|
+
decision.status # => :allow
|
|
171
180
|
decision.allowed? # => true when product.price is 8_900
|
|
181
|
+
|
|
182
|
+
decision.reason_code # => :delegation_allowed
|
|
172
183
|
```
|
|
173
184
|
|
|
174
|
-
|
|
185
|
+
The released 0.1.0 contract remains documented in the [v0.1 Public API](docs/public_api_v0_1.md). The [0.1.1 `Decision#reason_code` API note](docs/decision_reason_code.md) documents the final-reason accessor added in 0.1.1. Context values that affect authorization must be established by the host, not trusted directly from an Agent request.
|
|
175
186
|
|
|
176
187
|
## Quick Start
|
|
177
188
|
|
|
178
|
-
|
|
189
|
+
Install the released `0.1.1` gem from RubyGems.
|
|
179
190
|
|
|
180
191
|
1. Add the Gem and install dependencies:
|
|
181
192
|
|
|
182
193
|
```ruby
|
|
183
|
-
gem "acting_for",
|
|
194
|
+
gem "acting_for", "~> 0.1.1"
|
|
184
195
|
# Rails 8.0 uses JSON options removed in JSON 3.
|
|
185
196
|
gem "json", "< 3"
|
|
186
197
|
```
|
|
@@ -240,7 +251,7 @@ ActingFor is not yet published to RubyGems. This pre-release setup installs the
|
|
|
240
251
|
# => [:allow, true, false, false]
|
|
241
252
|
```
|
|
242
253
|
|
|
243
|
-
For the complete runnable setup—including a new Rails application,
|
|
254
|
+
For the complete runnable setup—including a new Rails application, RubyGems installation, host models, all three `¥8,900 / ¥20,000 / ¥50,000` outcomes, Audit behavior, and production security guidance—see [Getting Started](docs/getting_started.md).
|
|
244
255
|
|
|
245
256
|
## How does an external AI Agent reach ActingFor?
|
|
246
257
|
|
|
@@ -446,11 +457,15 @@ ActingFor is not an authentication provider, OAuth/OIDC server, Agent framework,
|
|
|
446
457
|
Project documents are maintained primarily in Japanese:
|
|
447
458
|
|
|
448
459
|
- [Getting Started](docs/getting_started.md)
|
|
460
|
+
- [Release Runbook](docs/release_runbook.md)
|
|
461
|
+
- [v0.1.0 Release Process and Verification Record](docs/release_process_v0_1_0.md)
|
|
462
|
+
- [v0.1.0 Release Notes](docs/release_notes_v0_1_0.md)
|
|
449
463
|
- [Current State](docs/CURRENT_STATE.md)
|
|
450
464
|
- [Progress](docs/PROGRESS.md)
|
|
451
465
|
- [Project scope, roadmap, and terminology](docs/PROJECT.md)
|
|
452
466
|
- [Decisions and rationale](docs/DECISIONS.md)
|
|
453
467
|
- [v0.1 Public API](docs/public_api_v0_1.md)
|
|
468
|
+
- [Decision reason_code API](docs/decision_reason_code.md)
|
|
454
469
|
- [v0.1 Security Model](docs/security_model_v0_1.md)
|
|
455
470
|
- [v0.1 Domain Model](docs/domain_model_v0_1.md)
|
|
456
471
|
- [v0.1 Gem Structure](docs/gem_structure_v0_1.md)
|
|
@@ -158,7 +158,7 @@ module ActingFor
|
|
|
158
158
|
resource_type: resource_type,
|
|
159
159
|
resource_id: resource_id,
|
|
160
160
|
decision: decision_value,
|
|
161
|
-
reason_code:
|
|
161
|
+
reason_code: decision.reason_code.to_s,
|
|
162
162
|
matched_delegation_ids: matches.map(&:id).sort,
|
|
163
163
|
sanitized_context: sanitized_context
|
|
164
164
|
}
|
|
@@ -18,7 +18,7 @@ module ActingFor
|
|
|
18
18
|
|
|
19
19
|
field = constraint["field"]
|
|
20
20
|
key = field.to_sym
|
|
21
|
-
return false unless
|
|
21
|
+
return false unless exact_symbol_key?(context, key)
|
|
22
22
|
|
|
23
23
|
actual = context[key]
|
|
24
24
|
return false if actual.nil?
|
|
@@ -45,6 +45,10 @@ module ActingFor
|
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
def exact_symbol_key?(context, key)
|
|
49
|
+
context.each_key.any? { |existing_key| existing_key.is_a?(Symbol) && existing_key == key }
|
|
50
|
+
end
|
|
51
|
+
|
|
48
52
|
def canonical_constraint?(constraint)
|
|
49
53
|
return false unless constraint.is_a?(Hash)
|
|
50
54
|
return false unless constraint.keys.all?(String)
|
data/lib/acting_for/decision.rb
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
module ActingFor
|
|
2
2
|
class Decision
|
|
3
3
|
STATUSES = %i[allow deny require_approval].freeze
|
|
4
|
-
|
|
4
|
+
REASON_CODES = {
|
|
5
|
+
allow: :delegation_allowed,
|
|
6
|
+
deny: :no_matching_delegation,
|
|
7
|
+
require_approval: :delegation_requires_approval
|
|
8
|
+
}.freeze
|
|
9
|
+
private_constant :STATUSES, :REASON_CODES
|
|
5
10
|
|
|
6
|
-
attr_reader :status
|
|
11
|
+
attr_reader :status, :reason_code
|
|
7
12
|
|
|
8
13
|
def initialize(status)
|
|
9
14
|
raise ArgumentError, "invalid decision status" unless STATUSES.include?(status)
|
|
10
15
|
|
|
11
16
|
@status = status
|
|
17
|
+
@reason_code = REASON_CODES.fetch(status)
|
|
12
18
|
freeze
|
|
13
19
|
end
|
|
14
20
|
|
data/lib/acting_for/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: acting_for
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ChangQuan Cui
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-11-14 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rubocop
|