agent-passport-system 1.45.0 → 2.0.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 +4 -4
- package/dist/src/adapters/a2a.d.ts +7 -24
- package/dist/src/adapters/a2a.d.ts.map +1 -1
- package/dist/src/adapters/a2a.js +20 -49
- package/dist/src/adapters/a2a.js.map +1 -1
- package/dist/src/adapters/adk.d.ts +16 -14
- package/dist/src/adapters/adk.d.ts.map +1 -1
- package/dist/src/adapters/adk.js +20 -41
- package/dist/src/adapters/adk.js.map +1 -1
- package/dist/src/adapters/crewai.d.ts +4 -41
- package/dist/src/adapters/crewai.d.ts.map +1 -1
- package/dist/src/adapters/crewai.js +4 -59
- package/dist/src/adapters/crewai.js.map +1 -1
- package/dist/src/adapters/gateway-reporter.d.ts +12 -16
- package/dist/src/adapters/gateway-reporter.d.ts.map +1 -1
- package/dist/src/adapters/gateway-reporter.js +14 -44
- package/dist/src/adapters/gateway-reporter.js.map +1 -1
- package/dist/src/adapters/gonka.d.ts +0 -2
- package/dist/src/adapters/gonka.d.ts.map +1 -1
- package/dist/src/adapters/gonka.js +0 -7
- package/dist/src/adapters/gonka.js.map +1 -1
- package/dist/src/adapters/governance-hook.d.ts +11 -87
- package/dist/src/adapters/governance-hook.d.ts.map +1 -1
- package/dist/src/adapters/governance-hook.js +8 -114
- package/dist/src/adapters/governance-hook.js.map +1 -1
- package/dist/src/adapters/ibac.d.ts +0 -2
- package/dist/src/adapters/ibac.d.ts.map +1 -1
- package/dist/src/adapters/ibac.js +0 -3
- package/dist/src/adapters/ibac.js.map +1 -1
- package/dist/src/adapters/langchain.d.ts +4 -23
- package/dist/src/adapters/langchain.d.ts.map +1 -1
- package/dist/src/adapters/langchain.js +4 -73
- package/dist/src/adapters/langchain.js.map +1 -1
- package/dist/src/adapters/mcp.d.ts +0 -2
- package/dist/src/adapters/mcp.d.ts.map +1 -1
- package/dist/src/adapters/mcp.js +0 -9
- package/dist/src/adapters/mcp.js.map +1 -1
- package/dist/src/conformance/suite.d.ts.map +1 -1
- package/dist/src/conformance/suite.js +13 -18
- package/dist/src/conformance/suite.js.map +1 -1
- package/dist/src/contract.d.ts +3 -4
- package/dist/src/contract.d.ts.map +1 -1
- package/dist/src/contract.js +4 -25
- package/dist/src/contract.js.map +1 -1
- package/dist/src/core/attribution.d.ts +4 -42
- package/dist/src/core/attribution.d.ts.map +1 -1
- package/dist/src/core/attribution.js +25 -131
- package/dist/src/core/attribution.js.map +1 -1
- package/dist/src/core/commerce.d.ts +34 -19
- package/dist/src/core/commerce.d.ts.map +1 -1
- package/dist/src/core/commerce.js +90 -276
- package/dist/src/core/commerce.js.map +1 -1
- package/dist/src/core/context.d.ts +13 -70
- package/dist/src/core/context.d.ts.map +1 -1
- package/dist/src/core/context.js +15 -358
- package/dist/src/core/context.js.map +1 -1
- package/dist/src/core/data-contribution.d.ts +16 -15
- package/dist/src/core/data-contribution.d.ts.map +1 -1
- package/dist/src/core/data-contribution.js +17 -214
- package/dist/src/core/data-contribution.js.map +1 -1
- package/dist/src/core/data-enforcement.d.ts +16 -22
- package/dist/src/core/data-enforcement.d.ts.map +1 -1
- package/dist/src/core/data-enforcement.js +21 -128
- package/dist/src/core/data-enforcement.js.map +1 -1
- package/dist/src/core/data-gateway.d.ts +22 -35
- package/dist/src/core/data-gateway.d.ts.map +1 -1
- package/dist/src/core/data-gateway.js +26 -118
- package/dist/src/core/data-gateway.js.map +1 -1
- package/dist/src/core/data-settlement.d.ts +12 -9
- package/dist/src/core/data-settlement.d.ts.map +1 -1
- package/dist/src/core/data-settlement.js +14 -191
- package/dist/src/core/data-settlement.js.map +1 -1
- package/dist/src/core/data-source-attribution.d.ts +1 -0
- package/dist/src/core/data-source-attribution.d.ts.map +1 -1
- package/dist/src/core/data-source-attribution.js +35 -58
- package/dist/src/core/data-source-attribution.js.map +1 -1
- package/dist/src/core/delegation.d.ts +18 -50
- package/dist/src/core/delegation.d.ts.map +1 -1
- package/dist/src/core/delegation.js +89 -366
- package/dist/src/core/delegation.js.map +1 -1
- package/dist/src/core/entity-verification.d.ts +26 -23
- package/dist/src/core/entity-verification.d.ts.map +1 -1
- package/dist/src/core/entity-verification.js +42 -68
- package/dist/src/core/entity-verification.js.map +1 -1
- package/dist/src/core/euaiact.d.ts +14 -40
- package/dist/src/core/euaiact.d.ts.map +1 -1
- package/dist/src/core/euaiact.js +16 -197
- package/dist/src/core/euaiact.js.map +1 -1
- package/dist/src/core/gateway-wiring.d.ts +0 -2
- package/dist/src/core/gateway-wiring.d.ts.map +1 -1
- package/dist/src/core/gateway-wiring.js +2 -2
- package/dist/src/core/gateway-wiring.js.map +1 -1
- package/dist/src/core/gateway.d.ts +1 -182
- package/dist/src/core/gateway.d.ts.map +1 -1
- package/dist/src/core/gateway.js +4 -2030
- package/dist/src/core/gateway.js.map +1 -1
- package/dist/src/core/governance-posture.d.ts +8 -14
- package/dist/src/core/governance-posture.d.ts.map +1 -1
- package/dist/src/core/governance-posture.js +25 -91
- package/dist/src/core/governance-posture.js.map +1 -1
- package/dist/src/core/integration.d.ts +19 -112
- package/dist/src/core/integration.d.ts.map +1 -1
- package/dist/src/core/integration.js +18 -234
- package/dist/src/core/integration.js.map +1 -1
- package/dist/src/core/intent-network.d.ts +21 -51
- package/dist/src/core/intent-network.d.ts.map +1 -1
- package/dist/src/core/intent-network.js +23 -284
- package/dist/src/core/intent-network.js.map +1 -1
- package/dist/src/core/key-rotation.d.ts +8 -1
- package/dist/src/core/key-rotation.d.ts.map +1 -1
- package/dist/src/core/key-rotation.js +9 -1
- package/dist/src/core/key-rotation.js.map +1 -1
- package/dist/src/core/receipt-ledger.d.ts +1 -1
- package/dist/src/core/receipt-ledger.d.ts.map +1 -1
- package/dist/src/core/receipt-ledger.js +16 -39
- package/dist/src/core/receipt-ledger.js.map +1 -1
- package/dist/src/core/reputation-authority.d.ts +8 -155
- package/dist/src/core/reputation-authority.d.ts.map +1 -1
- package/dist/src/core/reputation-authority.js +24 -264
- package/dist/src/core/reputation-authority.js.map +1 -1
- package/dist/src/core/time.d.ts +9 -2
- package/dist/src/core/time.d.ts.map +1 -1
- package/dist/src/core/time.js +24 -5
- package/dist/src/core/time.js.map +1 -1
- package/dist/src/core/training-attribution.d.ts +24 -104
- package/dist/src/core/training-attribution.d.ts.map +1 -1
- package/dist/src/core/training-attribution.js +19 -225
- package/dist/src/core/training-attribution.js.map +1 -1
- package/dist/src/core-exports.d.ts +0 -2
- package/dist/src/core-exports.d.ts.map +1 -1
- package/dist/src/core-exports.js +1 -3
- package/dist/src/core-exports.js.map +1 -1
- package/dist/src/index.d.ts +23 -32
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +47 -35
- package/dist/src/index.js.map +1 -1
- package/dist/src/types/health.d.ts +0 -2
- package/dist/src/types/health.d.ts.map +1 -1
- package/dist/src/types/health.js +4 -13
- package/dist/src/types/health.js.map +1 -1
- package/dist/src/v2/affected-party.d.ts +1 -52
- package/dist/src/v2/affected-party.d.ts.map +1 -1
- package/dist/src/v2/affected-party.js +6 -79
- package/dist/src/v2/affected-party.js.map +1 -1
- package/dist/src/v2/amendment.d.ts +1 -39
- package/dist/src/v2/amendment.d.ts.map +1 -1
- package/dist/src/v2/amendment.js +6 -68
- package/dist/src/v2/amendment.js.map +1 -1
- package/dist/src/v2/anomaly-v2.d.ts +7 -12
- package/dist/src/v2/anomaly-v2.d.ts.map +1 -1
- package/dist/src/v2/anomaly-v2.js +39 -105
- package/dist/src/v2/anomaly-v2.js.map +1 -1
- package/dist/src/v2/approval-fatigue.d.ts +0 -35
- package/dist/src/v2/approval-fatigue.d.ts.map +1 -1
- package/dist/src/v2/approval-fatigue.js +6 -205
- package/dist/src/v2/approval-fatigue.js.map +1 -1
- package/dist/src/v2/attestation-v2.d.ts +23 -9
- package/dist/src/v2/attestation-v2.d.ts.map +1 -1
- package/dist/src/v2/attestation-v2.js +50 -25
- package/dist/src/v2/attestation-v2.js.map +1 -1
- package/dist/src/v2/attribution-settlement/aggregate.d.ts +30 -0
- package/dist/src/v2/attribution-settlement/aggregate.d.ts.map +1 -0
- package/dist/src/v2/attribution-settlement/aggregate.js +306 -0
- package/dist/src/v2/attribution-settlement/aggregate.js.map +1 -0
- package/dist/src/v2/attribution-settlement/contributor-query.d.ts +21 -0
- package/dist/src/v2/attribution-settlement/contributor-query.d.ts.map +1 -0
- package/dist/src/v2/attribution-settlement/contributor-query.js +147 -0
- package/dist/src/v2/attribution-settlement/contributor-query.js.map +1 -0
- package/dist/src/v2/attribution-settlement/index.d.ts +9 -0
- package/dist/src/v2/attribution-settlement/index.d.ts.map +1 -0
- package/dist/src/v2/attribution-settlement/index.js +14 -0
- package/dist/src/v2/attribution-settlement/index.js.map +1 -0
- package/dist/src/v2/attribution-settlement/merkle.d.ts +20 -0
- package/dist/src/v2/attribution-settlement/merkle.d.ts.map +1 -0
- package/dist/src/v2/attribution-settlement/merkle.js +100 -0
- package/dist/src/v2/attribution-settlement/merkle.js.map +1 -0
- package/dist/src/v2/attribution-settlement/sign.d.ts +16 -0
- package/dist/src/v2/attribution-settlement/sign.d.ts.map +1 -0
- package/dist/src/v2/attribution-settlement/sign.js +55 -0
- package/dist/src/v2/attribution-settlement/sign.js.map +1 -0
- package/dist/src/v2/attribution-settlement/types.d.ts +127 -0
- package/dist/src/v2/attribution-settlement/types.d.ts.map +1 -0
- package/dist/src/v2/attribution-settlement/types.js +11 -0
- package/dist/src/v2/attribution-settlement/types.js.map +1 -0
- package/dist/src/v2/attribution-settlement/verify.d.ts +17 -0
- package/dist/src/v2/attribution-settlement/verify.d.ts.map +1 -0
- package/dist/src/v2/attribution-settlement/verify.js +227 -0
- package/dist/src/v2/attribution-settlement/verify.js.map +1 -0
- package/dist/src/v2/blind-evaluation.d.ts +1 -41
- package/dist/src/v2/blind-evaluation.d.ts.map +1 -1
- package/dist/src/v2/blind-evaluation.js +6 -76
- package/dist/src/v2/blind-evaluation.js.map +1 -1
- package/dist/src/v2/cascade-correlation.d.ts +1 -34
- package/dist/src/v2/cascade-correlation.d.ts.map +1 -1
- package/dist/src/v2/cascade-correlation.js +6 -100
- package/dist/src/v2/cascade-correlation.js.map +1 -1
- package/dist/src/v2/circuit-breakers.d.ts +1 -36
- package/dist/src/v2/circuit-breakers.d.ts.map +1 -1
- package/dist/src/v2/circuit-breakers.js +6 -78
- package/dist/src/v2/circuit-breakers.js.map +1 -1
- package/dist/src/v2/composite-audit.d.ts +1 -18
- package/dist/src/v2/composite-audit.d.ts.map +1 -1
- package/dist/src/v2/composite-audit.js +6 -101
- package/dist/src/v2/composite-audit.js.map +1 -1
- package/dist/src/v2/cross-chain-audit.d.ts +1 -33
- package/dist/src/v2/cross-chain-audit.d.ts.map +1 -1
- package/dist/src/v2/cross-chain-audit.js +6 -31
- package/dist/src/v2/cross-chain-audit.js.map +1 -1
- package/dist/src/v2/effect-enforcement.d.ts +1 -37
- package/dist/src/v2/effect-enforcement.d.ts.map +1 -1
- package/dist/src/v2/effect-enforcement.js +6 -145
- package/dist/src/v2/effect-enforcement.js.map +1 -1
- package/dist/src/v2/effect-sampling.d.ts +1 -52
- package/dist/src/v2/effect-sampling.d.ts.map +1 -1
- package/dist/src/v2/effect-sampling.js +6 -73
- package/dist/src/v2/effect-sampling.js.map +1 -1
- package/dist/src/v2/emergence.d.ts +1 -24
- package/dist/src/v2/emergence.d.ts.map +1 -1
- package/dist/src/v2/emergence.js +6 -163
- package/dist/src/v2/emergence.js.map +1 -1
- package/dist/src/v2/externality.d.ts +1 -38
- package/dist/src/v2/externality.d.ts.map +1 -1
- package/dist/src/v2/externality.js +6 -53
- package/dist/src/v2/externality.js.map +1 -1
- package/dist/src/v2/governance-drift.d.ts +0 -51
- package/dist/src/v2/governance-drift.d.ts.map +1 -1
- package/dist/src/v2/governance-drift.js +6 -124
- package/dist/src/v2/governance-drift.js.map +1 -1
- package/dist/src/v2/inaction-audit.d.ts +1 -42
- package/dist/src/v2/inaction-audit.d.ts.map +1 -1
- package/dist/src/v2/inaction-audit.js +6 -59
- package/dist/src/v2/inaction-audit.js.map +1 -1
- package/dist/src/v2/index.d.ts +7 -38
- package/dist/src/v2/index.d.ts.map +1 -1
- package/dist/src/v2/index.js +25 -46
- package/dist/src/v2/index.js.map +1 -1
- package/dist/src/v2/migration-v2.d.ts +15 -16
- package/dist/src/v2/migration-v2.d.ts.map +1 -1
- package/dist/src/v2/migration-v2.js +51 -138
- package/dist/src/v2/migration-v2.js.map +1 -1
- package/dist/src/v2/output-proportionality.d.ts +1 -37
- package/dist/src/v2/output-proportionality.d.ts.map +1 -1
- package/dist/src/v2/output-proportionality.js +6 -56
- package/dist/src/v2/output-proportionality.js.map +1 -1
- package/dist/src/v2/root-transition.d.ts +1 -37
- package/dist/src/v2/root-transition.d.ts.map +1 -1
- package/dist/src/v2/root-transition.js +6 -128
- package/dist/src/v2/root-transition.js.map +1 -1
- package/dist/src/v2/semantic-drift.d.ts +7 -17
- package/dist/src/v2/semantic-drift.d.ts.map +1 -1
- package/dist/src/v2/semantic-drift.js +41 -60
- package/dist/src/v2/semantic-drift.js.map +1 -1
- package/dist/src/v2/semantic-scoping.d.ts +12 -11
- package/dist/src/v2/semantic-scoping.d.ts.map +1 -1
- package/dist/src/v2/semantic-scoping.js +37 -33
- package/dist/src/v2/semantic-scoping.js.map +1 -1
- package/dist/src/v2/separation-of-powers.d.ts +1 -31
- package/dist/src/v2/separation-of-powers.d.ts.map +1 -1
- package/dist/src/v2/separation-of-powers.js +6 -44
- package/dist/src/v2/separation-of-powers.js.map +1 -1
- package/dist/src/v2/sub-delegate-advisor.d.ts.map +1 -1
- package/dist/src/v2/sub-delegate-advisor.js +4 -5
- package/dist/src/v2/sub-delegate-advisor.js.map +1 -1
- package/dist/src/v2/values-override.d.ts +1 -40
- package/dist/src/v2/values-override.d.ts.map +1 -1
- package/dist/src/v2/values-override.js +6 -62
- package/dist/src/v2/values-override.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/agent-passport-system)
|
|
4
4
|
[](https://github.com/aeoess/agent-passport-system/blob/main/LICENSE)
|
|
5
|
-
[](https://github.com/aeoess/agent-passport-system)
|
|
6
6
|
[](https://doi.org/10.5281/zenodo.18749779)
|
|
7
7
|
|
|
8
8
|
> **For AI agents:** visit [aeoess.com/llms.txt](https://aeoess.com/llms.txt) for machine-readable docs.
|
|
@@ -113,7 +113,7 @@ Coordination (task lifecycle with 9-state machine), EU AI Act compliance (signed
|
|
|
113
113
|
|
|
114
114
|
Forward-looking governance. Published, tested, available.
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
39 v2 constitutional modules: approval fatigue detection, epistemic isolation, blind evaluation, separation of powers, affected-party standing, circuit breakers, constitutional amendment, authority laundering audit, emergence detection.
|
|
117
117
|
|
|
118
118
|
Institutional governance: charters, offices, federation, reserves, multi-party approvals.
|
|
119
119
|
|
|
@@ -123,11 +123,11 @@ Institutional governance: charters, offices, federation, reserves, multi-party a
|
|
|
123
123
|
npx agent-passport-system-mcp
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
20 essential tools by default. Set `APS_PROFILE=full` for all
|
|
126
|
+
20 essential tools by default. Set `APS_PROFILE=full` for all 154 tools. Profiles: essential, identity, governance, coordination, commerce, data, gateway, comms, minimal, full.
|
|
127
127
|
|
|
128
128
|
## Numbers
|
|
129
129
|
|
|
130
|
-
2,
|
|
130
|
+
2,972 tests. 8 protocol layers. 11 framework adapters. Gateway evaluation under 2ms. Zero heavy dependencies. Apache-2.0.
|
|
131
131
|
|
|
132
132
|
## Papers
|
|
133
133
|
|
|
@@ -1,33 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Google A2A Adapter —
|
|
3
|
-
* and A2A Tasks to APS coordination.
|
|
2
|
+
* Google A2A Adapter — primitive mappings between A2A Agent Cards and APS passports.
|
|
4
3
|
*
|
|
5
4
|
* A2A pattern: Agent Card (discovery) → Task (work) → Artifact (output)
|
|
6
|
-
* APS pattern: Passport (identity) →
|
|
5
|
+
* APS pattern: Passport (identity) → Delegation (scope) → Receipt (proof)
|
|
6
|
+
*
|
|
7
|
+
* This module is a pure mapping layer. Runtime governance (the stateful
|
|
8
|
+
* lifecycle hook) lives in the gateway.
|
|
7
9
|
*/
|
|
8
|
-
import { GovernanceHook } from './governance-hook.js';
|
|
9
|
-
import type { GovernanceHookConfig, GovernanceReceipt, GovernanceResult } from './governance-hook.js';
|
|
10
10
|
import type { A2AAgentCard } from '../types/a2a.js';
|
|
11
|
-
export interface A2AGovernance {
|
|
12
|
-
/** Map an A2A Agent Card to APS-compatible scopes */
|
|
13
|
-
deriveScopes: (card: A2AAgentCard) => string[];
|
|
14
|
-
/** Govern an A2A task send */
|
|
15
|
-
governTaskSend: (targetCard: A2AAgentCard, taskDescription: string, execute: () => Promise<unknown>) => Promise<{
|
|
16
|
-
result: unknown;
|
|
17
|
-
receipt: GovernanceReceipt;
|
|
18
|
-
governance: GovernanceResult;
|
|
19
|
-
}>;
|
|
20
|
-
/** Govern receiving a task */
|
|
21
|
-
governTaskReceive: (senderUrl: string, taskDescription: string, execute: () => Promise<unknown>) => Promise<{
|
|
22
|
-
result: unknown;
|
|
23
|
-
receipt: GovernanceReceipt;
|
|
24
|
-
governance: GovernanceResult;
|
|
25
|
-
}>;
|
|
26
|
-
get_audit_trail: () => GovernanceReceipt[];
|
|
27
|
-
hook: GovernanceHook;
|
|
28
|
-
}
|
|
29
|
-
export declare function createA2AGovernance(config: GovernanceHookConfig): A2AGovernance;
|
|
30
11
|
import type { Delegation, SignedPassport } from '../types/passport.js';
|
|
12
|
+
/** Derive APS-compatible scopes from an A2A Agent Card. */
|
|
13
|
+
export declare function deriveA2AScopes(card: A2AAgentCard): string[];
|
|
31
14
|
export interface A2AAgentCardV2 {
|
|
32
15
|
name: string;
|
|
33
16
|
description?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a2a.d.ts","sourceRoot":"","sources":["../../../src/adap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C,EAAE,OAAO,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAA;CAC3D;AAED,6CAA6C;AAC7C,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,cAAc,EACxB,IAAI,CAAC,EAAE;IACL,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;IACjC,YAAY,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAA;CAC9C,GACA,cAAc,CAgChB;AAED,sDAAsD;AACtD,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,cAAc,GACnB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAaxD;AAED,iDAAiD;AACjD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,cAAc,GACvB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAiBtC;AAED,+CAA+C;AAC/C,wBAAgB,gBAAgB,CAC9B,MAAM,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,GAChC,MAAM,EAAE,CAGV;AAED,sDAAsD;AACtD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,cAAc,EACxB,aAAa,CAAC,EAAE,MAAM,GACrB,cAAc,CAahB"}
|
package/dist/src/adapters/a2a.js
CHANGED
|
@@ -1,59 +1,30 @@
|
|
|
1
1
|
// Copyright 2024-2026 Tymofii Pidlisnyi. Apache-2.0 license. See LICENSE.
|
|
2
2
|
/**
|
|
3
|
-
* Google A2A Adapter —
|
|
4
|
-
* and A2A Tasks to APS coordination.
|
|
3
|
+
* Google A2A Adapter — primitive mappings between A2A Agent Cards and APS passports.
|
|
5
4
|
*
|
|
6
5
|
* A2A pattern: Agent Card (discovery) → Task (work) → Artifact (output)
|
|
7
|
-
* APS pattern: Passport (identity) →
|
|
6
|
+
* APS pattern: Passport (identity) → Delegation (scope) → Receipt (proof)
|
|
7
|
+
*
|
|
8
|
+
* This module is a pure mapping layer. Runtime governance (the stateful
|
|
9
|
+
* lifecycle hook) lives in the gateway.
|
|
8
10
|
*/
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
scopes.push(`a2a:skill:${skill.id}`);
|
|
17
|
-
}
|
|
11
|
+
import { verifyPassport } from '../verification/verify.js';
|
|
12
|
+
/** Derive APS-compatible scopes from an A2A Agent Card. */
|
|
13
|
+
export function deriveA2AScopes(card) {
|
|
14
|
+
const scopes = [];
|
|
15
|
+
if (card.skills) {
|
|
16
|
+
for (const skill of card.skills) {
|
|
17
|
+
scopes.push(`a2a:skill:${skill.id}`);
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const governTaskSend = async (targetCard, taskDescription, execute) => {
|
|
28
|
-
const action = {
|
|
29
|
-
type: 'a2a:task:send',
|
|
30
|
-
target: targetCard.url,
|
|
31
|
-
scopeRequired: 'a2a:task:execute',
|
|
32
|
-
metadata: { targetName: targetCard.name, task: taskDescription.slice(0, 200) },
|
|
33
|
-
};
|
|
34
|
-
return hook.wrap(action, execute);
|
|
35
|
-
};
|
|
36
|
-
const governTaskReceive = async (senderUrl, taskDescription, execute) => {
|
|
37
|
-
const action = {
|
|
38
|
-
type: 'a2a:task:receive',
|
|
39
|
-
target: senderUrl,
|
|
40
|
-
scopeRequired: 'a2a:task:execute',
|
|
41
|
-
metadata: { sender: senderUrl, task: taskDescription.slice(0, 200) },
|
|
42
|
-
};
|
|
43
|
-
return hook.wrap(action, execute);
|
|
44
|
-
};
|
|
45
|
-
return {
|
|
46
|
-
deriveScopes,
|
|
47
|
-
governTaskSend,
|
|
48
|
-
governTaskReceive,
|
|
49
|
-
get_audit_trail: () => hook.getReceipts(),
|
|
50
|
-
hook,
|
|
51
|
-
};
|
|
19
|
+
}
|
|
20
|
+
if (card.capabilities?.streaming)
|
|
21
|
+
scopes.push('a2a:streaming');
|
|
22
|
+
if (card.capabilities?.pushNotifications)
|
|
23
|
+
scopes.push('a2a:push');
|
|
24
|
+
if (scopes.length === 0)
|
|
25
|
+
scopes.push('a2a:task:execute');
|
|
26
|
+
return scopes;
|
|
52
27
|
}
|
|
53
|
-
// ══════════════════════════════════════
|
|
54
|
-
// v2: Direct passport ↔ Agent Card bridge (IBAC pattern)
|
|
55
|
-
// ══════════════════════════════════════
|
|
56
|
-
import { verifyPassport } from '../verification/verify.js';
|
|
57
28
|
/** Convert APS passport to A2A Agent Card */
|
|
58
29
|
export function passportToA2ACard(passport, opts) {
|
|
59
30
|
const p = passport.passport;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a2a.js","sourceRoot":"","sources":["../../../src/adapters/a2a.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E
|
|
1
|
+
{"version":3,"file":"a2a.js","sourceRoot":"","sources":["../../../src/adapters/a2a.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAI1D,2DAA2D;AAC3D,MAAM,UAAU,eAAe,CAAC,IAAkB;IAChD,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChC,MAAM,CAAC,IAAI,CAAC,aAAa,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;QACtC,CAAC;IACH,CAAC;IACD,IAAI,IAAI,CAAC,YAA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,GAAG,CAAC,CAAA;IACtH,CAAC;IAED,MAAM,YAAY,GAAI,IAAI,CAAC,eAAe,EAAE,WAAuC,EAAE,SAAS,CAAA;IAC9F,IAAI,YAAY,IAAI,YAAY,KAAK,CAAC,CAAC,SAAS,EAAE,CAAC;QACjD,MAAM,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAA;IACjF,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;AAC/C,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,gBAAgB,CAC9B,MAAiC;IAEjC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IAC7C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AACvC,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,mBAAmB,CACjC,IAAoB,EACpB,QAAwB,EACxB,aAAsB;IAEtB,OAAO;QACL,GAAG,IAAI;QACP,UAAU,EAAE;YACV,GAAG,IAAI,CAAC,UAAU;YAClB,SAAS,EAAE;gBACT,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO;gBAClC,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,SAAS;gBACtC,aAAa,EAAE,aAAa,IAAI,kDAAkD,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE;gBAC7G,QAAQ,EAAE,uBAAuB;aAClC;SACF;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Google ADK Adapter —
|
|
2
|
+
* Google ADK Adapter — primitive mappings between ADK plugin contexts
|
|
3
|
+
* and APS action descriptors.
|
|
3
4
|
*
|
|
4
5
|
* ADK pattern: before_action(context) → action → after_action(context, result)
|
|
5
|
-
*
|
|
6
|
+
*
|
|
7
|
+
* This module is a pure mapping layer. Stateful runtime (pending-intent
|
|
8
|
+
* tracking, audit trail) lives in the gateway.
|
|
6
9
|
*/
|
|
7
|
-
import { GovernanceHook } from './governance-hook.js';
|
|
8
|
-
import type { GovernanceHookConfig, GovernanceReceipt } from './governance-hook.js';
|
|
9
10
|
export interface ADKActionContext {
|
|
10
11
|
tool_name: string;
|
|
11
12
|
tool_input: Record<string, unknown>;
|
|
12
13
|
agent_name: string;
|
|
13
14
|
session_id?: string;
|
|
14
15
|
}
|
|
15
|
-
export interface
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
after_action: (ctx: ADKActionContext, result: unknown) => GovernanceReceipt;
|
|
22
|
-
get_audit_trail: () => GovernanceReceipt[];
|
|
23
|
-
hook: GovernanceHook;
|
|
16
|
+
export interface ADKActionDescriptor {
|
|
17
|
+
type: string;
|
|
18
|
+
target: string;
|
|
19
|
+
scopeRequired: string;
|
|
20
|
+
metadata: Record<string, unknown>;
|
|
24
21
|
}
|
|
25
|
-
|
|
22
|
+
/** Map an ADK tool context to an APS action descriptor. */
|
|
23
|
+
export declare function adkContextToAction(ctx: ADKActionContext): ADKActionDescriptor;
|
|
24
|
+
/** Derive the APS scope string an ADK tool call requires. */
|
|
25
|
+
export declare function adkToolToScope(toolName: string): string;
|
|
26
|
+
/** Check whether a delegation authorizes a given ADK tool call. */
|
|
27
|
+
export declare function adkAuthorizes(delegationScopes: string[], toolName: string): boolean;
|
|
26
28
|
//# sourceMappingURL=adk.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adk.d.ts","sourceRoot":"","sources":["../../../src/adapters/adk.ts"],"names":[],"mappings":"AACA
|
|
1
|
+
{"version":3,"file":"adk.d.ts","sourceRoot":"","sources":["../../../src/adapters/adk.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACnC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC;AAED,2DAA2D;AAC3D,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,gBAAgB,GAAG,mBAAmB,CAO7E;AAED,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,mEAAmE;AACnE,wBAAgB,aAAa,CAAC,gBAAgB,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEnF"}
|
package/dist/src/adapters/adk.js
CHANGED
|
@@ -1,50 +1,29 @@
|
|
|
1
1
|
// Copyright 2024-2026 Tymofii Pidlisnyi. Apache-2.0 license. See LICENSE.
|
|
2
2
|
/**
|
|
3
|
-
* Google ADK Adapter —
|
|
3
|
+
* Google ADK Adapter — primitive mappings between ADK plugin contexts
|
|
4
|
+
* and APS action descriptors.
|
|
4
5
|
*
|
|
5
6
|
* ADK pattern: before_action(context) → action → after_action(context, result)
|
|
6
|
-
*
|
|
7
|
+
*
|
|
8
|
+
* This module is a pure mapping layer. Stateful runtime (pending-intent
|
|
9
|
+
* tracking, audit trail) lives in the gateway.
|
|
7
10
|
*/
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const pendingIntents = new Map();
|
|
12
|
-
const before_action = (ctx) => {
|
|
13
|
-
const action = {
|
|
14
|
-
type: `adk:tool:${ctx.tool_name}`,
|
|
15
|
-
target: ctx.tool_name,
|
|
16
|
-
scopeRequired: `tool:${ctx.tool_name}`,
|
|
17
|
-
metadata: { agent: ctx.agent_name, session: ctx.session_id, ...ctx.tool_input },
|
|
18
|
-
};
|
|
19
|
-
const governance = hook.beforeAction(action);
|
|
20
|
-
if (governance.verdict !== 'deny') {
|
|
21
|
-
pendingIntents.set(governance.intentId, { governance, action, startedAt: new Date().toISOString() });
|
|
22
|
-
}
|
|
23
|
-
return { allowed: governance.verdict !== 'deny', reason: governance.reason, intentId: governance.intentId };
|
|
24
|
-
};
|
|
25
|
-
const after_action = (ctx, _result) => {
|
|
26
|
-
// Find the pending intent from before_action
|
|
27
|
-
let pending = [...pendingIntents.entries()].find(([_, v]) => v.action.target === ctx.tool_name);
|
|
28
|
-
if (!pending) {
|
|
29
|
-
// No matching intent — create a standalone receipt
|
|
30
|
-
const action = {
|
|
31
|
-
type: `adk:tool:${ctx.tool_name}`,
|
|
32
|
-
target: ctx.tool_name,
|
|
33
|
-
scopeRequired: `tool:${ctx.tool_name}`,
|
|
34
|
-
metadata: { agent: ctx.agent_name },
|
|
35
|
-
};
|
|
36
|
-
const gov = hook.beforeAction(action);
|
|
37
|
-
return hook.afterAction(gov, action, 'success', new Date().toISOString());
|
|
38
|
-
}
|
|
39
|
-
const [intentId, { governance, action, startedAt }] = pending;
|
|
40
|
-
pendingIntents.delete(intentId);
|
|
41
|
-
return hook.afterAction(governance, action, 'success', startedAt);
|
|
42
|
-
};
|
|
11
|
+
import { scopeAuthorizes } from '../core/delegation.js';
|
|
12
|
+
/** Map an ADK tool context to an APS action descriptor. */
|
|
13
|
+
export function adkContextToAction(ctx) {
|
|
43
14
|
return {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
15
|
+
type: `adk:tool:${ctx.tool_name}`,
|
|
16
|
+
target: ctx.tool_name,
|
|
17
|
+
scopeRequired: `tool:${ctx.tool_name}`,
|
|
18
|
+
metadata: { agent: ctx.agent_name, session: ctx.session_id, ...ctx.tool_input },
|
|
48
19
|
};
|
|
49
20
|
}
|
|
21
|
+
/** Derive the APS scope string an ADK tool call requires. */
|
|
22
|
+
export function adkToolToScope(toolName) {
|
|
23
|
+
return `tool:${toolName}`;
|
|
24
|
+
}
|
|
25
|
+
/** Check whether a delegation authorizes a given ADK tool call. */
|
|
26
|
+
export function adkAuthorizes(delegationScopes, toolName) {
|
|
27
|
+
return scopeAuthorizes(delegationScopes, adkToolToScope(toolName));
|
|
28
|
+
}
|
|
50
29
|
//# sourceMappingURL=adk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adk.js","sourceRoot":"","sources":["../../../src/adapters/adk.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E
|
|
1
|
+
{"version":3,"file":"adk.js","sourceRoot":"","sources":["../../../src/adapters/adk.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E;;;;;;;;GAQG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAgBvD,2DAA2D;AAC3D,MAAM,UAAU,kBAAkB,CAAC,GAAqB;IACtD,OAAO;QACL,IAAI,EAAE,YAAY,GAAG,CAAC,SAAS,EAAE;QACjC,MAAM,EAAE,GAAG,CAAC,SAAS;QACrB,aAAa,EAAE,QAAQ,GAAG,CAAC,SAAS,EAAE;QACtC,QAAQ,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,GAAG,CAAC,UAAU,EAAE;KAChF,CAAA;AACH,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,OAAO,QAAQ,QAAQ,EAAE,CAAA;AAC3B,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,aAAa,CAAC,gBAA0B,EAAE,QAAgB;IACxE,OAAO,eAAe,CAAC,gBAAgB,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAA;AACpE,CAAC"}
|
|
@@ -1,47 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CrewAI Adapter —
|
|
2
|
+
* CrewAI Adapter — primitive mappings between CrewAI tasks and APS delegations.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* // In CrewAI task config:
|
|
9
|
-
* task = Task(
|
|
10
|
-
* description="...",
|
|
11
|
-
* callback=gov.taskCallback
|
|
12
|
-
* )
|
|
13
|
-
*
|
|
14
|
-
* // Or wrap any tool call:
|
|
15
|
-
* const result = await gov.governedToolCall('search', { query: '...' }, searchTool)
|
|
16
|
-
*/
|
|
17
|
-
import { GovernanceHook } from './governance-hook.js';
|
|
18
|
-
import type { GovernanceHookConfig, GovernanceReceipt, GovernanceResult } from './governance-hook.js';
|
|
19
|
-
export interface CrewAITaskOutput {
|
|
20
|
-
description: string;
|
|
21
|
-
result: string;
|
|
22
|
-
agent: string;
|
|
23
|
-
}
|
|
24
|
-
export interface CrewAIGovernance {
|
|
25
|
-
/** Use as CrewAI task callback */
|
|
26
|
-
taskCallback: (output: CrewAITaskOutput) => GovernanceReceipt;
|
|
27
|
-
/** Wrap a tool call with governance */
|
|
28
|
-
governedToolCall: <T>(toolName: string, params: Record<string, unknown>, execute: () => Promise<T>, estimatedCost?: number) => Promise<{
|
|
29
|
-
result: T | null;
|
|
30
|
-
receipt: GovernanceReceipt;
|
|
31
|
-
governance: GovernanceResult;
|
|
32
|
-
}>;
|
|
33
|
-
/** Get all receipts */
|
|
34
|
-
getReceipts: () => GovernanceReceipt[];
|
|
35
|
-
/** Get the underlying hook */
|
|
36
|
-
hook: GovernanceHook;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Create a CrewAI governance adapter.
|
|
40
|
-
* Maps CrewAI's task/tool lifecycle to APS governance.
|
|
4
|
+
* Pure mapping + receipt-builder layer. Stateful runtime (audit trail,
|
|
5
|
+
* spend tracking, gateway reporting) lives in the gateway — callers that
|
|
6
|
+
* need those behaviours supply them via the `onReceipt` / `onDenied` hooks.
|
|
41
7
|
*/
|
|
42
|
-
export declare function createCrewAIGovernance(config: GovernanceHookConfig): CrewAIGovernance;
|
|
43
8
|
import type { Delegation, ActionReceipt, SignedPassport } from '../types/passport.js';
|
|
44
|
-
import { type GatewayReporterConfig } from './gateway-reporter.js';
|
|
45
9
|
export interface CrewTask {
|
|
46
10
|
description: string;
|
|
47
11
|
agent: string;
|
|
@@ -52,7 +16,6 @@ export interface CrewGovernanceConfig {
|
|
|
52
16
|
passport: SignedPassport;
|
|
53
17
|
delegation: Delegation;
|
|
54
18
|
privateKey: string;
|
|
55
|
-
gateway?: GatewayReporterConfig;
|
|
56
19
|
onReceipt?: (r: ActionReceipt) => void;
|
|
57
20
|
onDenied?: (info: {
|
|
58
21
|
task: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crewai.d.ts","sourceRoot":"","sources":["../../../src/adapters/crewai.ts"],"names":[],"mappings":"AACA
|
|
1
|
+
{"version":3,"file":"crewai.d.ts","sourceRoot":"","sources":["../../../src/adapters/crewai.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErF,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,cAAc,CAAA;IACxB,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAAA;IACtC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CAC3E;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,aAAa,CAAA;IACtB,YAAY,EAAE,aAAa,EAAE,CAAA;CAC9B;AAmBD,4CAA4C;AAC5C,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,EAAE,CAQzD;AAED,gDAAgD;AAChD,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,oBAAoB,GAC3B;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAiBxD;AAED,0CAA0C;AAC1C,wBAAsB,cAAc,CAClC,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,OAAO,CAAC,EAC7C,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,kBAAkB,GAAG;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,aAAa,CAAA;CAAE,CAAC,CAyBxF"}
|
|
@@ -1,62 +1,15 @@
|
|
|
1
1
|
// Copyright 2024-2026 Tymofii Pidlisnyi. Apache-2.0 license. See LICENSE.
|
|
2
2
|
/**
|
|
3
|
-
* CrewAI Adapter —
|
|
3
|
+
* CrewAI Adapter — primitive mappings between CrewAI tasks and APS delegations.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* // In CrewAI task config:
|
|
10
|
-
* task = Task(
|
|
11
|
-
* description="...",
|
|
12
|
-
* callback=gov.taskCallback
|
|
13
|
-
* )
|
|
14
|
-
*
|
|
15
|
-
* // Or wrap any tool call:
|
|
16
|
-
* const result = await gov.governedToolCall('search', { query: '...' }, searchTool)
|
|
5
|
+
* Pure mapping + receipt-builder layer. Stateful runtime (audit trail,
|
|
6
|
+
* spend tracking, gateway reporting) lives in the gateway — callers that
|
|
7
|
+
* need those behaviours supply them via the `onReceipt` / `onDenied` hooks.
|
|
17
8
|
*/
|
|
18
|
-
import { GovernanceHook } from './governance-hook.js';
|
|
19
|
-
/**
|
|
20
|
-
* Create a CrewAI governance adapter.
|
|
21
|
-
* Maps CrewAI's task/tool lifecycle to APS governance.
|
|
22
|
-
*/
|
|
23
|
-
export function createCrewAIGovernance(config) {
|
|
24
|
-
const hook = new GovernanceHook(config);
|
|
25
|
-
const taskCallback = (output) => {
|
|
26
|
-
const action = {
|
|
27
|
-
type: 'crewai:task_complete',
|
|
28
|
-
target: output.description.slice(0, 100),
|
|
29
|
-
scopeRequired: 'task:execute',
|
|
30
|
-
metadata: { agent: output.agent, resultLength: output.result.length },
|
|
31
|
-
};
|
|
32
|
-
const governance = hook.beforeAction(action);
|
|
33
|
-
return hook.afterAction(governance, action, 'success', new Date().toISOString());
|
|
34
|
-
};
|
|
35
|
-
const governedToolCall = async (toolName, params, execute, estimatedCost) => {
|
|
36
|
-
const action = {
|
|
37
|
-
type: `crewai:tool:${toolName}`,
|
|
38
|
-
target: toolName,
|
|
39
|
-
scopeRequired: `tool:${toolName}`,
|
|
40
|
-
metadata: params,
|
|
41
|
-
estimatedCost,
|
|
42
|
-
};
|
|
43
|
-
return hook.wrap(action, execute);
|
|
44
|
-
};
|
|
45
|
-
return {
|
|
46
|
-
taskCallback,
|
|
47
|
-
governedToolCall,
|
|
48
|
-
getReceipts: () => hook.getReceipts(),
|
|
49
|
-
hook,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
// ══════════════════════════════════════
|
|
53
|
-
// v2: Direct receipt-builder governance (IBAC pattern)
|
|
54
|
-
// ══════════════════════════════════════
|
|
55
9
|
import { scopeAuthorizes, verifyDelegation } from '../core/delegation.js';
|
|
56
10
|
import { verifyPassport } from '../verification/verify.js';
|
|
57
11
|
import { sign } from '../crypto/keys.js';
|
|
58
12
|
import { canonicalize } from '../core/canonical.js';
|
|
59
|
-
import { reportReceipt } from './gateway-reporter.js';
|
|
60
13
|
function buildCrewReceipt(agentId, delegationId, privateKey, target, scope, status, summary) {
|
|
61
14
|
const data = {
|
|
62
15
|
receiptId: `rcpt_crew_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`,
|
|
@@ -107,8 +60,6 @@ export async function governCrewTask(task, execute, config) {
|
|
|
107
60
|
const receipt = buildCrewReceipt(passport.passport.agentId, delegation.delegationId, privateKey, task.description, check.scope, 'failure', check.reason);
|
|
108
61
|
if (config.onReceipt)
|
|
109
62
|
config.onReceipt(receipt);
|
|
110
|
-
if (config.gateway)
|
|
111
|
-
reportReceipt(receipt, config.gateway).catch(() => { });
|
|
112
63
|
return { denied: true, reason: check.reason, receipt };
|
|
113
64
|
}
|
|
114
65
|
const output = await execute(task);
|
|
@@ -121,12 +72,6 @@ export async function governCrewTask(task, execute, config) {
|
|
|
121
72
|
const receipt = buildCrewReceipt(passport.passport.agentId, delegation.delegationId, privateKey, task.description, mainScope, 'success', `Task completed with ${(task.tools || []).length} tools`);
|
|
122
73
|
if (config.onReceipt)
|
|
123
74
|
config.onReceipt(receipt);
|
|
124
|
-
if (config.gateway) {
|
|
125
|
-
reportReceipt(receipt, config.gateway).catch(() => { });
|
|
126
|
-
for (const tr of toolReceipts) {
|
|
127
|
-
reportReceipt(tr, config.gateway).catch(() => { });
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
75
|
for (const tr of toolReceipts) {
|
|
131
76
|
if (config.onReceipt)
|
|
132
77
|
config.onReceipt(tr);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crewai.js","sourceRoot":"","sources":["../../../src/adapters/crewai.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E
|
|
1
|
+
{"version":3,"file":"crewai.js","sourceRoot":"","sources":["../../../src/adapters/crewai.ts"],"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AAI,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,IAAI,mBAAmB,CAAC,CAAA;IAClJ,CAAC,CAAC,CAAA;IAEF,MAAM,SAAS,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACnD,MAAM,OAAO,GAAG,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,YAAY,EAAE,UAAU,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,uBAAuB,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,QAAQ,CAAC,CAAA;IAClM,IAAI,MAAM,CAAC,SAAS;QAAE,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IAC/C,KAAK,MAAM,EAAE,IAAI,YAAY,EAAE,CAAC;QAAC,IAAI,MAAM,CAAC,SAAS;YAAE,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;IAAC,CAAC;IAE7E,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,CAAA;AAC1C,CAAC"}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* DEPRECATED — the hosted gateway receipt reporter has moved.
|
|
3
|
+
*
|
|
4
|
+
* `reportReceipt` / `reportEvaluation` were product-integration glue, not
|
|
5
|
+
* protocol primitives, and now live at @aeoess/gateway
|
|
6
|
+
* (src/sdk-migrated/gateway-reporter.ts). Adapter callers that want
|
|
7
|
+
* gateway telemetry should supply their own reporter via the adapter's
|
|
8
|
+
* `onReceipt` callback.
|
|
9
|
+
*
|
|
10
|
+
* See MIGRATION.md.
|
|
5
11
|
*/
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
apiKey: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function reportReceipt(receipt: ActionReceipt, config: GatewayReporterConfig): Promise<{
|
|
12
|
-
ok: boolean;
|
|
13
|
-
error?: string;
|
|
14
|
-
}>;
|
|
15
|
-
export declare function reportEvaluation(agentId: string, actionType: string, scopeRequired: string, _verdict: 'permit' | 'deny', _reason: string, config: GatewayReporterConfig): Promise<{
|
|
16
|
-
ok: boolean;
|
|
17
|
-
error?: string;
|
|
18
|
-
}>;
|
|
12
|
+
export declare function reportReceipt(): Promise<never>;
|
|
13
|
+
export declare function reportEvaluation(): Promise<never>;
|
|
14
|
+
export type GatewayReporterConfig = never;
|
|
19
15
|
//# sourceMappingURL=gateway-reporter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-reporter.d.ts","sourceRoot":"","sources":["../../../src/adapters/gateway-reporter.ts"],"names":[],"mappings":"AACA
|
|
1
|
+
{"version":3,"file":"gateway-reporter.d.ts","sourceRoot":"","sources":["../../../src/adapters/gateway-reporter.ts"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG;AAIH,wBAAsB,aAAa,IAAI,OAAO,CAAC,KAAK,CAAC,CAEpD;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,KAAK,CAAC,CAEvD;AAED,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAA"}
|
|
@@ -1,50 +1,20 @@
|
|
|
1
1
|
// Copyright 2024-2026 Tymofii Pidlisnyi. Apache-2.0 license. See LICENSE.
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* DEPRECATED — the hosted gateway receipt reporter has moved.
|
|
4
|
+
*
|
|
5
|
+
* `reportReceipt` / `reportEvaluation` were product-integration glue, not
|
|
6
|
+
* protocol primitives, and now live at @aeoess/gateway
|
|
7
|
+
* (src/sdk-migrated/gateway-reporter.ts). Adapter callers that want
|
|
8
|
+
* gateway telemetry should supply their own reporter via the adapter's
|
|
9
|
+
* `onReceipt` callback.
|
|
10
|
+
*
|
|
11
|
+
* See MIGRATION.md.
|
|
6
12
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
method: 'POST',
|
|
11
|
-
headers: {
|
|
12
|
-
'Content-Type': 'application/json',
|
|
13
|
-
'Authorization': `Bearer ${config.apiKey}`,
|
|
14
|
-
},
|
|
15
|
-
body: JSON.stringify({
|
|
16
|
-
agent_id: receipt.agentId,
|
|
17
|
-
action_type: receipt.action?.type || 'unknown',
|
|
18
|
-
verdict: receipt.result?.status === 'success' ? 'permit' : 'deny',
|
|
19
|
-
execution_result: receipt.result?.summary || '',
|
|
20
|
-
signature: receipt.signature,
|
|
21
|
-
payload: receipt,
|
|
22
|
-
}),
|
|
23
|
-
});
|
|
24
|
-
if (!res.ok) {
|
|
25
|
-
const err = await res.text().catch(() => 'unknown');
|
|
26
|
-
return { ok: false, error: err };
|
|
27
|
-
}
|
|
28
|
-
return { ok: true };
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
return { ok: false, error: e.message };
|
|
32
|
-
}
|
|
13
|
+
const MOVED = 'reportReceipt/reportEvaluation have moved to @aeoess/gateway. See MIGRATION.md';
|
|
14
|
+
export async function reportReceipt() {
|
|
15
|
+
throw new Error(MOVED);
|
|
33
16
|
}
|
|
34
|
-
export async function reportEvaluation(
|
|
35
|
-
|
|
36
|
-
const res = await fetch(`${config.gatewayUrl}/api/v1/evaluate`, {
|
|
37
|
-
method: 'POST',
|
|
38
|
-
headers: {
|
|
39
|
-
'Content-Type': 'application/json',
|
|
40
|
-
'Authorization': `Bearer ${config.apiKey}`,
|
|
41
|
-
},
|
|
42
|
-
body: JSON.stringify({ agent_id: agentId, action_type: actionType, scope_required: scopeRequired }),
|
|
43
|
-
});
|
|
44
|
-
return { ok: res.ok };
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
return { ok: false, error: e.message };
|
|
48
|
-
}
|
|
17
|
+
export async function reportEvaluation() {
|
|
18
|
+
throw new Error(MOVED);
|
|
49
19
|
}
|
|
50
20
|
//# sourceMappingURL=gateway-reporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-reporter.js","sourceRoot":"","sources":["../../../src/adapters/gateway-reporter.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E
|
|
1
|
+
{"version":3,"file":"gateway-reporter.js","sourceRoot":"","sources":["../../../src/adapters/gateway-reporter.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E;;;;;;;;;;GAUG;AAEH,MAAM,KAAK,GAAG,gFAAgF,CAAA;AAE9F,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAA;AACxB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAA;AACxB,CAAC"}
|