@vorionsys/atsf-core 0.1.0 → 0.2.1
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 +12 -12
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +463 -35
- package/dist/api/server.js.map +1 -1
- package/dist/arbitration/index.d.ts.map +1 -1
- package/dist/arbitration/index.js +8 -6
- package/dist/arbitration/index.js.map +1 -1
- package/dist/audit/key-manager.d.ts +118 -0
- package/dist/audit/key-manager.d.ts.map +1 -0
- package/dist/audit/key-manager.js +565 -0
- package/dist/audit/key-manager.js.map +1 -0
- package/dist/basis/evaluator.d.ts +31 -0
- package/dist/basis/evaluator.d.ts.map +1 -1
- package/dist/basis/evaluator.js +205 -10
- package/dist/basis/evaluator.js.map +1 -1
- package/dist/basis/parser.d.ts +210 -210
- package/dist/basis/parser.js.map +1 -1
- package/dist/carbon-aware/carbon-metrics.d.ts +151 -0
- package/dist/carbon-aware/carbon-metrics.d.ts.map +1 -0
- package/dist/carbon-aware/carbon-metrics.js +370 -0
- package/dist/carbon-aware/carbon-metrics.js.map +1 -0
- package/dist/carbon-aware/carbon-router.d.ts +101 -0
- package/dist/carbon-aware/carbon-router.d.ts.map +1 -0
- package/dist/carbon-aware/carbon-router.js +400 -0
- package/dist/carbon-aware/carbon-router.js.map +1 -0
- package/dist/chain/index.d.ts +147 -0
- package/dist/chain/index.d.ts.map +1 -0
- package/dist/chain/index.js +219 -0
- package/dist/chain/index.js.map +1 -0
- package/dist/cognigate/index.d.ts +33 -4
- package/dist/cognigate/index.d.ts.map +1 -1
- package/dist/cognigate/index.js +199 -24
- package/dist/cognigate/index.js.map +1 -1
- package/dist/common/adapters.d.ts +172 -0
- package/dist/common/adapters.d.ts.map +1 -0
- package/dist/common/adapters.js +329 -0
- package/dist/common/adapters.js.map +1 -0
- package/dist/common/config.d.ts +168 -163
- package/dist/common/config.d.ts.map +1 -1
- package/dist/common/config.js +2 -0
- package/dist/common/config.js.map +1 -1
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +1 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/types.d.ts +67 -16
- package/dist/common/types.d.ts.map +1 -1
- package/dist/common/types.js +4 -0
- package/dist/common/types.js.map +1 -1
- package/dist/enforce/index.d.ts +226 -16
- package/dist/enforce/index.d.ts.map +1 -1
- package/dist/enforce/index.js +196 -49
- package/dist/enforce/index.js.map +1 -1
- package/dist/governance/fluid-workflow.d.ts +217 -0
- package/dist/governance/fluid-workflow.d.ts.map +1 -0
- package/dist/governance/fluid-workflow.js +491 -0
- package/dist/governance/fluid-workflow.js.map +1 -0
- package/dist/governance/index.d.ts +1 -0
- package/dist/governance/index.d.ts.map +1 -1
- package/dist/governance/index.js +1 -0
- package/dist/governance/index.js.map +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/intent/index.d.ts +127 -10
- package/dist/intent/index.d.ts.map +1 -1
- package/dist/intent/index.js +121 -16
- package/dist/intent/index.js.map +1 -1
- package/dist/langchain/executor.d.ts +19 -5
- package/dist/langchain/executor.d.ts.map +1 -1
- package/dist/langchain/executor.js +287 -36
- package/dist/langchain/executor.js.map +1 -1
- package/dist/langchain/index.d.ts +2 -1
- package/dist/langchain/index.d.ts.map +1 -1
- package/dist/langchain/index.js +3 -1
- package/dist/langchain/index.js.map +1 -1
- package/dist/langchain/tools.d.ts.map +1 -1
- package/dist/langchain/tools.js +2 -1
- package/dist/langchain/tools.js.map +1 -1
- package/dist/langchain/types.d.ts +41 -0
- package/dist/langchain/types.d.ts.map +1 -1
- package/dist/layers/index.d.ts +1 -1
- package/dist/layers/index.d.ts.map +1 -1
- package/dist/persistence/file.d.ts +35 -3
- package/dist/persistence/file.d.ts.map +1 -1
- package/dist/persistence/file.js +138 -11
- package/dist/persistence/file.js.map +1 -1
- package/dist/persistence/index.d.ts +11 -1
- package/dist/persistence/index.d.ts.map +1 -1
- package/dist/persistence/index.js +25 -1
- package/dist/persistence/index.js.map +1 -1
- package/dist/persistence/sqlite.d.ts +135 -0
- package/dist/persistence/sqlite.d.ts.map +1 -0
- package/dist/persistence/sqlite.js +372 -0
- package/dist/persistence/sqlite.js.map +1 -0
- package/dist/persistence/supabase.d.ts +93 -0
- package/dist/persistence/supabase.d.ts.map +1 -0
- package/dist/persistence/supabase.js +219 -0
- package/dist/persistence/supabase.js.map +1 -0
- package/dist/persistence/types.d.ts +5 -1
- package/dist/persistence/types.d.ts.map +1 -1
- package/dist/phase6/ceiling.d.ts +177 -0
- package/dist/phase6/ceiling.d.ts.map +1 -0
- package/dist/phase6/ceiling.js +463 -0
- package/dist/phase6/ceiling.js.map +1 -0
- package/dist/phase6/context.d.ts +207 -0
- package/dist/phase6/context.d.ts.map +1 -0
- package/dist/phase6/context.js +603 -0
- package/dist/phase6/context.js.map +1 -0
- package/dist/phase6/index.d.ts +79 -0
- package/dist/phase6/index.d.ts.map +1 -0
- package/dist/phase6/index.js +152 -0
- package/dist/phase6/index.js.map +1 -0
- package/dist/phase6/presets.d.ts +148 -0
- package/dist/phase6/presets.d.ts.map +1 -0
- package/dist/phase6/presets.js +467 -0
- package/dist/phase6/presets.js.map +1 -0
- package/dist/phase6/provenance.d.ts +148 -0
- package/dist/phase6/provenance.d.ts.map +1 -0
- package/dist/phase6/provenance.js +545 -0
- package/dist/phase6/provenance.js.map +1 -0
- package/dist/phase6/role-gates/index.d.ts +7 -0
- package/dist/phase6/role-gates/index.d.ts.map +1 -0
- package/dist/phase6/role-gates/index.js +7 -0
- package/dist/phase6/role-gates/index.js.map +1 -0
- package/dist/phase6/role-gates/kernel.d.ts +84 -0
- package/dist/phase6/role-gates/kernel.d.ts.map +1 -0
- package/dist/phase6/role-gates/kernel.js +258 -0
- package/dist/phase6/role-gates/kernel.js.map +1 -0
- package/dist/phase6/role-gates/policy.d.ts +110 -0
- package/dist/phase6/role-gates/policy.d.ts.map +1 -0
- package/dist/phase6/role-gates/policy.js +157 -0
- package/dist/phase6/role-gates/policy.js.map +1 -0
- package/dist/phase6/role-gates.d.ts +164 -0
- package/dist/phase6/role-gates.d.ts.map +1 -0
- package/dist/phase6/role-gates.js +536 -0
- package/dist/phase6/role-gates.js.map +1 -0
- package/dist/phase6/types.d.ts +1827 -0
- package/dist/phase6/types.d.ts.map +1 -0
- package/dist/phase6/types.js +450 -0
- package/dist/phase6/types.js.map +1 -0
- package/dist/phase6/weight-presets/canonical.d.ts +93 -0
- package/dist/phase6/weight-presets/canonical.d.ts.map +1 -0
- package/dist/phase6/weight-presets/canonical.js +122 -0
- package/dist/phase6/weight-presets/canonical.js.map +1 -0
- package/dist/phase6/weight-presets/deltas.d.ts +144 -0
- package/dist/phase6/weight-presets/deltas.d.ts.map +1 -0
- package/dist/phase6/weight-presets/deltas.js +184 -0
- package/dist/phase6/weight-presets/deltas.js.map +1 -0
- package/dist/phase6/weight-presets/index.d.ts +8 -0
- package/dist/phase6/weight-presets/index.d.ts.map +1 -0
- package/dist/phase6/weight-presets/index.js +8 -0
- package/dist/phase6/weight-presets/index.js.map +1 -0
- package/dist/phase6/weight-presets/merger.d.ts +79 -0
- package/dist/phase6/weight-presets/merger.d.ts.map +1 -0
- package/dist/phase6/weight-presets/merger.js +161 -0
- package/dist/phase6/weight-presets/merger.js.map +1 -0
- package/dist/proof/index.d.ts +50 -1
- package/dist/proof/index.d.ts.map +1 -1
- package/dist/proof/index.js +122 -3
- package/dist/proof/index.js.map +1 -1
- package/dist/proof/merkle.d.ts +195 -0
- package/dist/proof/merkle.d.ts.map +1 -0
- package/dist/proof/merkle.js +412 -0
- package/dist/proof/merkle.js.map +1 -0
- package/dist/proof/zk-proofs.d.ts +218 -0
- package/dist/proof/zk-proofs.d.ts.map +1 -0
- package/dist/proof/zk-proofs.js +531 -0
- package/dist/proof/zk-proofs.js.map +1 -0
- package/dist/trust-engine/ceiling-enforcement/audit.d.ts +98 -0
- package/dist/trust-engine/ceiling-enforcement/audit.d.ts.map +1 -0
- package/dist/trust-engine/ceiling-enforcement/audit.js +160 -0
- package/dist/trust-engine/ceiling-enforcement/audit.js.map +1 -0
- package/dist/trust-engine/ceiling-enforcement/index.d.ts +6 -0
- package/dist/trust-engine/ceiling-enforcement/index.d.ts.map +1 -0
- package/dist/trust-engine/ceiling-enforcement/index.js +6 -0
- package/dist/trust-engine/ceiling-enforcement/index.js.map +1 -0
- package/dist/trust-engine/ceiling-enforcement/kernel.d.ts +112 -0
- package/dist/trust-engine/ceiling-enforcement/kernel.d.ts.map +1 -0
- package/dist/trust-engine/ceiling-enforcement/kernel.js +158 -0
- package/dist/trust-engine/ceiling-enforcement/kernel.js.map +1 -0
- package/dist/trust-engine/context-policy/enforcement.d.ts +62 -0
- package/dist/trust-engine/context-policy/enforcement.d.ts.map +1 -0
- package/dist/trust-engine/context-policy/enforcement.js +104 -0
- package/dist/trust-engine/context-policy/enforcement.js.map +1 -0
- package/dist/trust-engine/context-policy/factory.d.ts +75 -0
- package/dist/trust-engine/context-policy/factory.d.ts.map +1 -0
- package/dist/trust-engine/context-policy/factory.js +130 -0
- package/dist/trust-engine/context-policy/factory.js.map +1 -0
- package/dist/trust-engine/context-policy/index.d.ts +6 -0
- package/dist/trust-engine/context-policy/index.d.ts.map +1 -0
- package/dist/trust-engine/context-policy/index.js +6 -0
- package/dist/trust-engine/context-policy/index.js.map +1 -0
- package/dist/trust-engine/creation-modifiers/index.d.ts +5 -0
- package/dist/trust-engine/creation-modifiers/index.d.ts.map +1 -0
- package/dist/trust-engine/creation-modifiers/index.js +5 -0
- package/dist/trust-engine/creation-modifiers/index.js.map +1 -0
- package/dist/trust-engine/creation-modifiers/types.d.ts +112 -0
- package/dist/trust-engine/creation-modifiers/types.d.ts.map +1 -0
- package/dist/trust-engine/creation-modifiers/types.js +166 -0
- package/dist/trust-engine/creation-modifiers/types.js.map +1 -0
- package/dist/trust-engine/decay-profiles.d.ts +159 -0
- package/dist/trust-engine/decay-profiles.d.ts.map +1 -0
- package/dist/trust-engine/decay-profiles.js +210 -0
- package/dist/trust-engine/decay-profiles.js.map +1 -0
- package/dist/trust-engine/index.d.ts +144 -5
- package/dist/trust-engine/index.d.ts.map +1 -1
- package/dist/trust-engine/index.js +320 -15
- package/dist/trust-engine/index.js.map +1 -1
- package/dist/trust-engine/phase6-types.d.ts +123 -0
- package/dist/trust-engine/phase6-types.d.ts.map +1 -0
- package/dist/trust-engine/phase6-types.js +88 -0
- package/dist/trust-engine/phase6-types.js.map +1 -0
- package/package.json +26 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
2
|
+
* @vorionsys/atsf-core - Agentic Trust Scoring Framework
|
|
3
3
|
*
|
|
4
4
|
* Core runtime for AI agent governance, trust scoring, and policy enforcement.
|
|
5
5
|
*
|
|
@@ -8,20 +8,26 @@
|
|
|
8
8
|
export * from './common/types.js';
|
|
9
9
|
export { RuleEvaluator, createEvaluator, } from './basis/evaluator.js';
|
|
10
10
|
export { parseNamespace, validateRule, validateNamespace, } from './basis/parser.js';
|
|
11
|
-
export type { Rule, RuleNamespace, RuleCondition, RuleResult, EvaluationContext, EvaluationResult as BasisEvaluationResult, } from './basis/types.js';
|
|
11
|
+
export type { Rule, RuleNamespace, RuleCondition as BasisRuleCondition, RuleResult, EvaluationContext, EvaluationResult as BasisEvaluationResult, } from './basis/types.js';
|
|
12
12
|
export * from './intent/index.js';
|
|
13
13
|
export * from './enforce/index.js';
|
|
14
14
|
export * from './cognigate/index.js';
|
|
15
15
|
export * from './proof/index.js';
|
|
16
|
+
export { POLYGON_NETWORKS, type NetworkName, type ChainAnchorConfig, type ProofToAnchor, type AnchorResult, sha256, keccak256Concat, computeMerkleRoot, computeMerkleProof, MockChainAnchorService, createChainAnchor, } from './chain/index.js';
|
|
16
17
|
export * from './provenance/index.js';
|
|
17
18
|
export * from './trust-engine/index.js';
|
|
18
19
|
export * from './layers/index.js';
|
|
19
20
|
export * from './arbitration/index.js';
|
|
20
21
|
export * from './containment/index.js';
|
|
21
22
|
export * from './contracts/index.js';
|
|
22
|
-
export
|
|
23
|
+
export { GovernanceEngine, createGovernanceEngine, createGovernanceRule, createFieldCondition, createCompositeCondition, createRuleEffect, } from './governance/index.js';
|
|
24
|
+
export type { GovernanceRule, RuleCategory, RuleCondition, RuleEffect, ConditionOperator, Authority, GovernanceRequest, GovernanceResult, EvaluatedRule, EffectModification, EffectConstraint, GovernanceConfig, RuleQuery, ClarificationRequirement, } from './governance/types.js';
|
|
25
|
+
export { FluidWorkflowEngine, createFluidWorkflowEngine, } from './governance/fluid-workflow.js';
|
|
26
|
+
export type { StateTransition, FluidWorkflowConfig, } from './governance/fluid-workflow.js';
|
|
23
27
|
export * from './persistence/index.js';
|
|
24
28
|
export * from './langchain/index.js';
|
|
29
|
+
export * as phase6 from './phase6/index.js';
|
|
30
|
+
export { createPhase6TrustEngine, type Phase6TrustEngine, type Phase6Config, PHASE6_VERSION, } from './phase6/index.js';
|
|
25
31
|
export declare const VERSION = "0.1.0";
|
|
26
32
|
export { createServer, startServer } from './api/server.js';
|
|
27
33
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,cAAc,mBAAmB,CAAC;AAGlC,OAAO,EACL,aAAa,EACb,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,cAAc,EACd,YAAY,EACZ,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,IAAI,EACJ,aAAa,EACb,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,cAAc,mBAAmB,CAAC;AAGlC,OA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xC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,sBAAsB,CAAC;AAGrC,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,cAAc,GACf,MAAM,mBAAmB,CAAC;AAG3B,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
2
|
+
* @vorionsys/atsf-core - Agentic Trust Scoring Framework
|
|
3
3
|
*
|
|
4
4
|
* Core runtime for AI agent governance, trust scoring, and policy enforcement.
|
|
5
5
|
*
|
|
@@ -18,6 +18,12 @@ export * from './enforce/index.js';
|
|
|
18
18
|
export * from './cognigate/index.js';
|
|
19
19
|
// Proof/audit chain
|
|
20
20
|
export * from './proof/index.js';
|
|
21
|
+
// CHAIN - Blockchain anchoring (exclude VerificationResult, verifyMerkleProof to avoid conflict with proof module)
|
|
22
|
+
export { POLYGON_NETWORKS,
|
|
23
|
+
// VerificationResult excluded - already exported from proof
|
|
24
|
+
sha256, keccak256Concat, computeMerkleRoot, computeMerkleProof,
|
|
25
|
+
// verifyMerkleProof excluded - already exported from proof
|
|
26
|
+
MockChainAnchorService, createChainAnchor, } from './chain/index.js';
|
|
21
27
|
// Decision Provenance (DPO)
|
|
22
28
|
export * from './provenance/index.js';
|
|
23
29
|
// Trust Engine
|
|
@@ -30,12 +36,17 @@ export * from './arbitration/index.js';
|
|
|
30
36
|
export * from './containment/index.js';
|
|
31
37
|
// Output Contracts (VorionResponse)
|
|
32
38
|
export * from './contracts/index.js';
|
|
33
|
-
// Governance & Authority Engine
|
|
34
|
-
|
|
39
|
+
// Governance & Authority Engine (exclude types already exported from enforce module:
|
|
40
|
+
// DecisionTier, FluidDecision, RefinementAction, RefinementOption, RefinementRequest, WorkflowInstance, WorkflowState)
|
|
41
|
+
export { GovernanceEngine, createGovernanceEngine, createGovernanceRule, createFieldCondition, createCompositeCondition, createRuleEffect, } from './governance/index.js';
|
|
42
|
+
export { FluidWorkflowEngine, createFluidWorkflowEngine, } from './governance/fluid-workflow.js';
|
|
35
43
|
// Persistence layer
|
|
36
44
|
export * from './persistence/index.js';
|
|
37
45
|
// LangChain integration
|
|
38
46
|
export * from './langchain/index.js';
|
|
47
|
+
// Phase 6: Trust Engine Hardening
|
|
48
|
+
export * as phase6 from './phase6/index.js';
|
|
49
|
+
export { createPhase6TrustEngine, PHASE6_VERSION, } from './phase6/index.js';
|
|
39
50
|
// Version
|
|
40
51
|
export const VERSION = '0.1.0';
|
|
41
52
|
// Main entry point for server
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,iCAAiC;AACjC,cAAc,mBAAmB,CAAC;AAElC,8EAA8E;AAC9E,OAAO,EACL,aAAa,EACb,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,cAAc,EACd,YAAY,EACZ,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAU3B,iBAAiB;AACjB,cAAc,mBAAmB,CAAC;AAElC,sBAAsB;AACtB,cAAc,oBAAoB,CAAC;AAEnC,8BAA8B;AAC9B,cAAc,sBAAsB,CAAC;AAErC,oBAAoB;AACpB,cAAc,kBAAkB,CAAC;AAEjC,4BAA4B;AAC5B,cAAc,uBAAuB,CAAC;AAEtC,eAAe;AACf,cAAc,yBAAyB,CAAC;AAExC,wBAAwB;AACxB,cAAc,mBAAmB,CAAC;AAElC,gCAAgC;AAChC,cAAc,wBAAwB,CAAC;AAEvC,0BAA0B;AAC1B,cAAc,wBAAwB,CAAC;AAEvC,oCAAoC;AACpC,cAAc,sBAAsB,CAAC;AAErC,
|
|
1
|
+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C5C,OAAO,EACL,uBAAuB,EAGvB,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,UAAU;AACV,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,8BAA8B;AAC9B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/intent/index.d.ts
CHANGED
|
@@ -1,44 +1,161 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* INTENT - Goal Processing
|
|
2
|
+
* INTENT - Goal Processing (SDK Package)
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* This module provides intent handling for the @vorionsys/atsf-core SDK.
|
|
5
|
+
*
|
|
6
|
+
* For production use with persistence, use the full implementation from the
|
|
7
|
+
* vorion core package. This SDK package provides:
|
|
8
|
+
* - Type definitions aligned with @vorion/contracts
|
|
9
|
+
* - In-memory mock for testing
|
|
10
|
+
* - Interface definitions for custom implementations
|
|
5
11
|
*
|
|
6
12
|
* @packageDocumentation
|
|
7
13
|
*/
|
|
8
14
|
import type { Intent, ID, IntentStatus } from '../common/types.js';
|
|
9
15
|
/**
|
|
10
|
-
*
|
|
16
|
+
* Action types for categorizing intents
|
|
17
|
+
*/
|
|
18
|
+
export declare const ActionType: {
|
|
19
|
+
readonly READ: "read";
|
|
20
|
+
readonly WRITE: "write";
|
|
21
|
+
readonly DELETE: "delete";
|
|
22
|
+
readonly EXECUTE: "execute";
|
|
23
|
+
readonly COMMUNICATE: "communicate";
|
|
24
|
+
readonly TRANSFER: "transfer";
|
|
25
|
+
};
|
|
26
|
+
export type ActionType = (typeof ActionType)[keyof typeof ActionType];
|
|
27
|
+
/**
|
|
28
|
+
* Data sensitivity levels
|
|
29
|
+
*/
|
|
30
|
+
export declare const DataSensitivity: {
|
|
31
|
+
readonly PUBLIC: "PUBLIC";
|
|
32
|
+
readonly INTERNAL: "INTERNAL";
|
|
33
|
+
readonly CONFIDENTIAL: "CONFIDENTIAL";
|
|
34
|
+
readonly RESTRICTED: "RESTRICTED";
|
|
35
|
+
};
|
|
36
|
+
export type DataSensitivity = (typeof DataSensitivity)[keyof typeof DataSensitivity];
|
|
37
|
+
/**
|
|
38
|
+
* Action reversibility classification
|
|
39
|
+
*/
|
|
40
|
+
export declare const Reversibility: {
|
|
41
|
+
readonly REVERSIBLE: "REVERSIBLE";
|
|
42
|
+
readonly PARTIALLY_REVERSIBLE: "PARTIALLY_REVERSIBLE";
|
|
43
|
+
readonly IRREVERSIBLE: "IRREVERSIBLE";
|
|
44
|
+
};
|
|
45
|
+
export type Reversibility = (typeof Reversibility)[keyof typeof Reversibility];
|
|
46
|
+
/**
|
|
47
|
+
* Intent submission request with canonical fields
|
|
11
48
|
*/
|
|
12
49
|
export interface IntentSubmission {
|
|
50
|
+
/** Agent/entity making the request */
|
|
13
51
|
entityId: ID;
|
|
52
|
+
/** Human-readable goal/action description */
|
|
14
53
|
goal: string;
|
|
54
|
+
/** Additional context for evaluation */
|
|
15
55
|
context: Record<string, unknown>;
|
|
56
|
+
/** Optional metadata */
|
|
16
57
|
metadata?: Record<string, unknown>;
|
|
58
|
+
/** Correlation ID for distributed tracing */
|
|
59
|
+
correlationId?: string;
|
|
60
|
+
/** Action type category */
|
|
61
|
+
actionType?: ActionType;
|
|
62
|
+
/** Resources this intent accesses/modifies */
|
|
63
|
+
resourceScope?: string[];
|
|
64
|
+
/** Data sensitivity level */
|
|
65
|
+
dataSensitivity?: DataSensitivity;
|
|
66
|
+
/** Whether action can be undone */
|
|
67
|
+
reversibility?: Reversibility;
|
|
68
|
+
/** Intent expiration in milliseconds from now */
|
|
69
|
+
expiresIn?: number;
|
|
70
|
+
/** Source system identifier */
|
|
71
|
+
source?: string;
|
|
17
72
|
}
|
|
18
73
|
/**
|
|
19
|
-
*
|
|
74
|
+
* Options for submitting an intent
|
|
20
75
|
*/
|
|
21
|
-
export
|
|
76
|
+
export interface SubmitOptions {
|
|
77
|
+
/** Tenant identifier */
|
|
78
|
+
tenantId: ID;
|
|
79
|
+
/** Trust snapshot at submission time */
|
|
80
|
+
trustSnapshot?: Record<string, unknown> | null;
|
|
81
|
+
/** Current trust level of the entity */
|
|
82
|
+
trustLevel?: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Interface for intent service implementations
|
|
86
|
+
*
|
|
87
|
+
* Implement this interface to create custom intent handling:
|
|
88
|
+
* - API client for remote Vorion service
|
|
89
|
+
* - Custom persistence layer
|
|
90
|
+
* - Testing mocks with specific behaviors
|
|
91
|
+
*/
|
|
92
|
+
export interface IIntentService {
|
|
93
|
+
submit(submission: IntentSubmission, options: SubmitOptions): Promise<Intent>;
|
|
94
|
+
get(id: ID, tenantId: ID): Promise<Intent | undefined>;
|
|
95
|
+
updateStatus(id: ID, tenantId: ID, status: IntentStatus): Promise<Intent | undefined>;
|
|
96
|
+
listByEntity(entityId: ID, tenantId: ID): Promise<Intent[]>;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* In-memory intent service for testing and development
|
|
100
|
+
*
|
|
101
|
+
* WARNING: This is NOT suitable for production use.
|
|
102
|
+
* For production, connect to the Vorion API or use the full
|
|
103
|
+
* implementation from the vorion core package.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* // For testing
|
|
108
|
+
* const mockService = new MockIntentService();
|
|
109
|
+
* const intent = await mockService.submit({
|
|
110
|
+
* entityId: 'agent-123',
|
|
111
|
+
* goal: 'Send notification',
|
|
112
|
+
* context: { channel: 'email' },
|
|
113
|
+
* actionType: ActionType.COMMUNICATE,
|
|
114
|
+
* dataSensitivity: DataSensitivity.INTERNAL,
|
|
115
|
+
* reversibility: Reversibility.REVERSIBLE,
|
|
116
|
+
* }, { tenantId: 'tenant-1' });
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export declare class MockIntentService implements IIntentService {
|
|
22
120
|
private intents;
|
|
23
121
|
/**
|
|
24
|
-
* Submit a new intent
|
|
122
|
+
* Submit a new intent (in-memory)
|
|
25
123
|
*/
|
|
26
|
-
submit(submission: IntentSubmission): Promise<Intent>;
|
|
124
|
+
submit(submission: IntentSubmission, options: SubmitOptions): Promise<Intent>;
|
|
27
125
|
/**
|
|
28
126
|
* Get an intent by ID
|
|
29
127
|
*/
|
|
30
|
-
get(id: ID): Promise<Intent | undefined>;
|
|
128
|
+
get(id: ID, tenantId: ID): Promise<Intent | undefined>;
|
|
31
129
|
/**
|
|
32
130
|
* Update intent status
|
|
33
131
|
*/
|
|
34
|
-
updateStatus(id: ID, status: IntentStatus): Promise<Intent | undefined>;
|
|
132
|
+
updateStatus(id: ID, tenantId: ID, status: IntentStatus): Promise<Intent | undefined>;
|
|
35
133
|
/**
|
|
36
134
|
* List intents for an entity
|
|
37
135
|
*/
|
|
38
|
-
listByEntity(entityId: ID): Promise<Intent[]>;
|
|
136
|
+
listByEntity(entityId: ID, tenantId: ID): Promise<Intent[]>;
|
|
137
|
+
/**
|
|
138
|
+
* Clear all intents (useful for test cleanup)
|
|
139
|
+
*/
|
|
140
|
+
clear(): void;
|
|
141
|
+
/**
|
|
142
|
+
* Get total count of intents (useful for testing)
|
|
143
|
+
*/
|
|
144
|
+
count(): number;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Intent service class
|
|
148
|
+
*
|
|
149
|
+
* @deprecated Use MockIntentService explicitly for testing, or implement
|
|
150
|
+
* IIntentService for production use with the Vorion API.
|
|
151
|
+
*/
|
|
152
|
+
export declare class IntentService extends MockIntentService {
|
|
39
153
|
}
|
|
40
154
|
/**
|
|
41
155
|
* Create a new intent service instance
|
|
156
|
+
*
|
|
157
|
+
* @deprecated Use new MockIntentService() for testing, or implement
|
|
158
|
+
* IIntentService for production use.
|
|
42
159
|
*/
|
|
43
160
|
export declare function createIntentService(): IntentService;
|
|
44
161
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/intent/index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AAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAW3F;;OAEG;IACG,YAAY,CAAC,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAMjE;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,KAAK,IAAI,MAAM;CAGhB;AAMD;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,iBAAiB;CAAG;AAEvD;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAMnD"}
|
package/dist/intent/index.js
CHANGED
|
@@ -1,64 +1,169 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* INTENT - Goal Processing
|
|
2
|
+
* INTENT - Goal Processing (SDK Package)
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* This module provides intent handling for the @vorionsys/atsf-core SDK.
|
|
5
|
+
*
|
|
6
|
+
* For production use with persistence, use the full implementation from the
|
|
7
|
+
* vorion core package. This SDK package provides:
|
|
8
|
+
* - Type definitions aligned with @vorion/contracts
|
|
9
|
+
* - In-memory mock for testing
|
|
10
|
+
* - Interface definitions for custom implementations
|
|
5
11
|
*
|
|
6
12
|
* @packageDocumentation
|
|
7
13
|
*/
|
|
8
14
|
import { createLogger } from '../common/logger.js';
|
|
9
15
|
const logger = createLogger({ component: 'intent' });
|
|
16
|
+
// =============================================================================
|
|
17
|
+
// CANONICAL FIELD ENUMS (aligned with @vorion/contracts)
|
|
18
|
+
// =============================================================================
|
|
19
|
+
/**
|
|
20
|
+
* Action types for categorizing intents
|
|
21
|
+
*/
|
|
22
|
+
export const ActionType = {
|
|
23
|
+
READ: 'read',
|
|
24
|
+
WRITE: 'write',
|
|
25
|
+
DELETE: 'delete',
|
|
26
|
+
EXECUTE: 'execute',
|
|
27
|
+
COMMUNICATE: 'communicate',
|
|
28
|
+
TRANSFER: 'transfer',
|
|
29
|
+
};
|
|
10
30
|
/**
|
|
11
|
-
*
|
|
31
|
+
* Data sensitivity levels
|
|
12
32
|
*/
|
|
13
|
-
export
|
|
33
|
+
export const DataSensitivity = {
|
|
34
|
+
PUBLIC: 'PUBLIC',
|
|
35
|
+
INTERNAL: 'INTERNAL',
|
|
36
|
+
CONFIDENTIAL: 'CONFIDENTIAL',
|
|
37
|
+
RESTRICTED: 'RESTRICTED',
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Action reversibility classification
|
|
41
|
+
*/
|
|
42
|
+
export const Reversibility = {
|
|
43
|
+
REVERSIBLE: 'REVERSIBLE',
|
|
44
|
+
PARTIALLY_REVERSIBLE: 'PARTIALLY_REVERSIBLE',
|
|
45
|
+
IRREVERSIBLE: 'IRREVERSIBLE',
|
|
46
|
+
};
|
|
47
|
+
// =============================================================================
|
|
48
|
+
// IN-MEMORY MOCK IMPLEMENTATION
|
|
49
|
+
// =============================================================================
|
|
50
|
+
/**
|
|
51
|
+
* In-memory intent service for testing and development
|
|
52
|
+
*
|
|
53
|
+
* WARNING: This is NOT suitable for production use.
|
|
54
|
+
* For production, connect to the Vorion API or use the full
|
|
55
|
+
* implementation from the vorion core package.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* // For testing
|
|
60
|
+
* const mockService = new MockIntentService();
|
|
61
|
+
* const intent = await mockService.submit({
|
|
62
|
+
* entityId: 'agent-123',
|
|
63
|
+
* goal: 'Send notification',
|
|
64
|
+
* context: { channel: 'email' },
|
|
65
|
+
* actionType: ActionType.COMMUNICATE,
|
|
66
|
+
* dataSensitivity: DataSensitivity.INTERNAL,
|
|
67
|
+
* reversibility: Reversibility.REVERSIBLE,
|
|
68
|
+
* }, { tenantId: 'tenant-1' });
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export class MockIntentService {
|
|
14
72
|
intents = new Map();
|
|
15
73
|
/**
|
|
16
|
-
* Submit a new intent
|
|
74
|
+
* Submit a new intent (in-memory)
|
|
17
75
|
*/
|
|
18
|
-
async submit(submission) {
|
|
76
|
+
async submit(submission, options) {
|
|
77
|
+
const now = new Date().toISOString();
|
|
78
|
+
const correlationId = submission.correlationId ?? crypto.randomUUID();
|
|
19
79
|
const intent = {
|
|
20
80
|
id: crypto.randomUUID(),
|
|
81
|
+
tenantId: options.tenantId,
|
|
21
82
|
entityId: submission.entityId,
|
|
22
83
|
goal: submission.goal,
|
|
23
84
|
context: submission.context,
|
|
24
85
|
metadata: submission.metadata ?? {},
|
|
25
86
|
status: 'pending',
|
|
26
|
-
createdAt:
|
|
27
|
-
updatedAt:
|
|
87
|
+
createdAt: now,
|
|
88
|
+
updatedAt: now,
|
|
89
|
+
trustSnapshot: options.trustSnapshot ?? null,
|
|
90
|
+
trustLevel: options.trustLevel ?? null,
|
|
91
|
+
// Canonical fields
|
|
92
|
+
correlationId,
|
|
93
|
+
actionType: submission.actionType ?? null,
|
|
94
|
+
resourceScope: submission.resourceScope ?? null,
|
|
95
|
+
dataSensitivity: submission.dataSensitivity ?? null,
|
|
96
|
+
reversibility: submission.reversibility ?? null,
|
|
97
|
+
expiresAt: submission.expiresIn
|
|
98
|
+
? new Date(Date.now() + submission.expiresIn).toISOString()
|
|
99
|
+
: null,
|
|
100
|
+
source: submission.source ?? null,
|
|
28
101
|
};
|
|
29
102
|
this.intents.set(intent.id, intent);
|
|
30
|
-
logger.info({ intentId: intent.id, goal: intent.goal }, 'Intent submitted');
|
|
103
|
+
logger.info({ intentId: intent.id, goal: intent.goal, correlationId }, 'Intent submitted (mock)');
|
|
31
104
|
return intent;
|
|
32
105
|
}
|
|
33
106
|
/**
|
|
34
107
|
* Get an intent by ID
|
|
35
108
|
*/
|
|
36
|
-
async get(id) {
|
|
37
|
-
|
|
109
|
+
async get(id, tenantId) {
|
|
110
|
+
const intent = this.intents.get(id);
|
|
111
|
+
if (intent && intent.tenantId === tenantId) {
|
|
112
|
+
return intent;
|
|
113
|
+
}
|
|
114
|
+
return undefined;
|
|
38
115
|
}
|
|
39
116
|
/**
|
|
40
117
|
* Update intent status
|
|
41
118
|
*/
|
|
42
|
-
async updateStatus(id, status) {
|
|
119
|
+
async updateStatus(id, tenantId, status) {
|
|
43
120
|
const intent = this.intents.get(id);
|
|
44
|
-
if (!intent)
|
|
121
|
+
if (!intent || intent.tenantId !== tenantId)
|
|
45
122
|
return undefined;
|
|
46
123
|
intent.status = status;
|
|
47
124
|
intent.updatedAt = new Date().toISOString();
|
|
48
|
-
logger.info({ intentId: id, status }, 'Intent status updated');
|
|
125
|
+
logger.info({ intentId: id, status }, 'Intent status updated (mock)');
|
|
49
126
|
return intent;
|
|
50
127
|
}
|
|
51
128
|
/**
|
|
52
129
|
* List intents for an entity
|
|
53
130
|
*/
|
|
54
|
-
async listByEntity(entityId) {
|
|
55
|
-
return Array.from(this.intents.values()).filter((i) => i.entityId === entityId);
|
|
131
|
+
async listByEntity(entityId, tenantId) {
|
|
132
|
+
return Array.from(this.intents.values()).filter((i) => i.entityId === entityId && i.tenantId === tenantId);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Clear all intents (useful for test cleanup)
|
|
136
|
+
*/
|
|
137
|
+
clear() {
|
|
138
|
+
this.intents.clear();
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Get total count of intents (useful for testing)
|
|
142
|
+
*/
|
|
143
|
+
count() {
|
|
144
|
+
return this.intents.size;
|
|
56
145
|
}
|
|
57
146
|
}
|
|
147
|
+
// =============================================================================
|
|
148
|
+
// BACKWARDS COMPATIBLE EXPORTS
|
|
149
|
+
// =============================================================================
|
|
150
|
+
/**
|
|
151
|
+
* Intent service class
|
|
152
|
+
*
|
|
153
|
+
* @deprecated Use MockIntentService explicitly for testing, or implement
|
|
154
|
+
* IIntentService for production use with the Vorion API.
|
|
155
|
+
*/
|
|
156
|
+
export class IntentService extends MockIntentService {
|
|
157
|
+
}
|
|
58
158
|
/**
|
|
59
159
|
* Create a new intent service instance
|
|
160
|
+
*
|
|
161
|
+
* @deprecated Use new MockIntentService() for testing, or implement
|
|
162
|
+
* IIntentService for production use.
|
|
60
163
|
*/
|
|
61
164
|
export function createIntentService() {
|
|
165
|
+
logger.warn('createIntentService() creates an in-memory mock. ' +
|
|
166
|
+
'For production, connect to the Vorion API.');
|
|
62
167
|
return new IntentService();
|
|
63
168
|
}
|
|
64
169
|
//# sourceMappingURL=index.js.map
|
package/dist/intent/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/intent/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/intent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;AAErD,gFAAgF;AAChF,yDAAyD;AACzD,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,WAAW,EAAE,aAAa;IAC1B,QAAQ,EAAE,UAAU;CACZ,CAAC;AAIX;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;IAC5B,UAAU,EAAE,YAAY;CAChB,CAAC;AAIX;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,UAAU,EAAE,YAAY;IACxB,oBAAoB,EAAE,sBAAsB;IAC5C,YAAY,EAAE,cAAc;CACpB,CAAC;AAqEX,gFAAgF;AAChF,gCAAgC;AAChC,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,iBAAiB;IACp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IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK;QACH,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;CACF;AAED,gFAAgF;AAChF,+BAA+B;AAC/B,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,OAAO,aAAc,SAAQ,iBAAiB;CAAG;AAEvD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,CAAC,IAAI,CACT,mDAAmD;QACnD,4CAA4C,CAC7C,CAAC;IACF,OAAO,IAAI,aAAa,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Trust-Aware LangChain Executor
|
|
3
3
|
*
|
|
4
|
-
* Wraps LangChain agents with trust-based access control.
|
|
4
|
+
* Wraps LangChain agents with trust-based access control and robust error handling.
|
|
5
5
|
*
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
8
|
import type { TrustLevel } from '../common/types.js';
|
|
9
9
|
import type { TrustEngine, TrustRecord } from '../trust-engine/index.js';
|
|
10
10
|
import { TrustCallbackHandler } from './callback.js';
|
|
11
|
-
import type { TrustAwareAgentConfig, TrustCheckResult, TrustedExecutionResult } from './types.js';
|
|
11
|
+
import type { TrustAwareAgentConfig, TrustCheckResult, TrustedExecutionResult, ClassifiedLLMError, TrustAwareAgentConfigWithRetry } from './types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Classify an error into a known LLM error type
|
|
14
|
+
*/
|
|
15
|
+
export declare function classifyLLMError(error: Error): ClassifiedLLMError;
|
|
12
16
|
/**
|
|
13
17
|
* Trust-aware agent executor
|
|
14
18
|
*
|
|
15
|
-
* Provides trust-gated execution for LangChain agents.
|
|
19
|
+
* Provides trust-gated execution for LangChain agents with robust error handling.
|
|
16
20
|
*/
|
|
17
21
|
export declare class TrustAwareExecutor {
|
|
18
22
|
private trustEngine;
|
|
19
23
|
private callback;
|
|
20
24
|
private config;
|
|
21
|
-
|
|
25
|
+
private retryConfig;
|
|
26
|
+
private errorClassifier;
|
|
27
|
+
constructor(trustEngine: TrustEngine, config: TrustAwareAgentConfigWithRetry);
|
|
22
28
|
/**
|
|
23
29
|
* Get the callback handler for use with LangChain
|
|
24
30
|
*/
|
|
@@ -36,13 +42,21 @@ export declare class TrustAwareExecutor {
|
|
|
36
42
|
*/
|
|
37
43
|
checkTrust(requiredLevel?: TrustLevel): Promise<TrustCheckResult>;
|
|
38
44
|
/**
|
|
39
|
-
* Execute a function with trust gating
|
|
45
|
+
* Execute a function with trust gating and automatic retry
|
|
40
46
|
*
|
|
41
47
|
* @param fn - The function to execute (typically agent.invoke)
|
|
42
48
|
* @param requiredLevel - Override minimum trust level for this execution
|
|
43
49
|
* @throws TrustInsufficientError if trust is too low
|
|
44
50
|
*/
|
|
45
51
|
execute<T>(fn: () => Promise<T>, requiredLevel?: TrustLevel): Promise<TrustedExecutionResult<T>>;
|
|
52
|
+
/**
|
|
53
|
+
* Execute a function with automatic retry for transient errors
|
|
54
|
+
*/
|
|
55
|
+
private executeWithRetry;
|
|
56
|
+
/**
|
|
57
|
+
* Record a classified failure signal
|
|
58
|
+
*/
|
|
59
|
+
private recordClassifiedFailure;
|
|
46
60
|
/**
|
|
47
61
|
* Get current trust record for the agent
|
|
48
62
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/langchain/executor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,oBAAoB,EAAuB,MAAM,eAAe,CAAC;AAC1E,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,sBA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