gridzen-developer-kit 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gridzen_developer/__init__.py +2 -0
- gridzen_developer/cli.py +19 -0
- gridzen_developer/client.py +19 -0
- gridzen_developer/core.py +58 -0
- gridzen_developer/data/catalog.json +1 -0
- gridzen_developer/mcp.py +54 -0
- gridzen_developer/remote.py +43 -0
- gridzen_developer/server.py +60 -0
- gridzen_developer/skills.py +9 -0
- gridzen_developer/usage.py +47 -0
- gridzen_developer/web/developer.css +2 -0
- gridzen_developer/web/developer.js +33 -0
- gridzen_developer/web/icon.png +0 -0
- gridzen_developer/web/icon.svg +9 -0
- gridzen_developer/web/index.html +3 -0
- gridzen_developer/web/language.js +1 -0
- gridzen_developer/web/locales.js +369 -0
- gridzen_developer/web/privacy.html +1 -0
- gridzen_developer/web/quickstart.html +14 -0
- gridzen_developer/web/support.html +1 -0
- gridzen_developer/web/terms.html +1 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/gridzen-explain-verification/SKILL.md +15 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/gridzen-integrate-sandbox/SKILL.md +12 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/gridzen-integrate-sandbox/references/api.md +23 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/gridzen-select-verification/SKILL.md +12 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/mexico-pilot-scoper/LICENSE +9 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/mexico-pilot-scoper/README.md +22 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/mexico-pilot-scoper/SKILL.md +15 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/mexico-pilot-scoper/agent-evals.json +39 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/mexico-pilot-scoper/evaluate.py +62 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/mexico-pilot-scoper/example-input.json +9 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/mexico-pilot-scoper/examples/missing-evidence.json +24 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/mexico-pilot-scoper/examples/normal.json +21 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/mexico-pilot-scoper/examples/out-of-scope.json +21 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/mexico-pilot-scoper/spec.json +13 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/mexico-pilot-scoper/test_evaluate.py +35 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/payout-policy-designer/LICENSE +9 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/payout-policy-designer/README.md +22 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/payout-policy-designer/SKILL.md +15 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/payout-policy-designer/agent-evals.json +39 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/payout-policy-designer/evaluate.py +62 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/payout-policy-designer/example-input.json +9 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/payout-policy-designer/examples/missing-evidence.json +30 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/payout-policy-designer/examples/normal.json +34 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/payout-policy-designer/examples/out-of-scope.json +21 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/payout-policy-designer/spec.json +11 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/payout-policy-designer/test_evaluate.py +35 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/provider-rights-readiness/LICENSE +9 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/provider-rights-readiness/README.md +22 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/provider-rights-readiness/SKILL.md +15 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/provider-rights-readiness/agent-evals.json +39 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/provider-rights-readiness/evaluate.py +62 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/provider-rights-readiness/example-input.json +11 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/provider-rights-readiness/examples/missing-evidence.json +23 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/provider-rights-readiness/examples/normal.json +23 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/provider-rights-readiness/examples/out-of-scope.json +23 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/provider-rights-readiness/spec.json +15 -0
- gridzen_developer_kit-0.3.0.data/data/share/gridzen-developer-kit/skills/provider-rights-readiness/test_evaluate.py +35 -0
- gridzen_developer_kit-0.3.0.dist-info/METADATA +155 -0
- gridzen_developer_kit-0.3.0.dist-info/RECORD +65 -0
- gridzen_developer_kit-0.3.0.dist-info/WHEEL +5 -0
- gridzen_developer_kit-0.3.0.dist-info/entry_points.txt +3 -0
- gridzen_developer_kit-0.3.0.dist-info/licenses/LICENSE +21 -0
- gridzen_developer_kit-0.3.0.dist-info/licenses/NOTICE.md +16 -0
- gridzen_developer_kit-0.3.0.dist-info/top_level.txt +1 -0
gridzen_developer/cli.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import argparse,json
|
|
2
|
+
from . import core
|
|
3
|
+
|
|
4
|
+
def main():
|
|
5
|
+
p=argparse.ArgumentParser(description='Gridzen research + synthetic sandbox (no real provider calls)');s=p.add_subparsers(dest='command',required=True)
|
|
6
|
+
x=s.add_parser('coverage');x.add_argument('--country');x.add_argument('--capability')
|
|
7
|
+
x=s.add_parser('plan');x.add_argument('--country',required=True);x.add_argument('--event',choices=list(core.EVENTS),default='payout')
|
|
8
|
+
x=s.add_parser('simulate');x.add_argument('--country',required=True);x.add_argument('--capability',required=True);x.add_argument('--scenario',choices=core.SCENARIOS,default='match')
|
|
9
|
+
x=s.add_parser('explain');x.add_argument('reason_code')
|
|
10
|
+
s.add_parser('skills',help='List bundled Skill directories; copy a complete directory into your assistant to activate it')
|
|
11
|
+
a=p.parse_args()
|
|
12
|
+
if a.command=='skills':
|
|
13
|
+
from .skills import list_skills
|
|
14
|
+
print(json.dumps(list_skills(),ensure_ascii=False,indent=2));return
|
|
15
|
+
try:
|
|
16
|
+
result={'coverage':lambda:core.coverage(a.country,a.capability),'plan':lambda:core.plan(a.country,a.event),'simulate':lambda:core.simulate(a.country,a.capability,a.scenario),'explain':lambda:core.explain(a.reason_code)}[a.command]()
|
|
17
|
+
except ValueError as e:p.error(str(e))
|
|
18
|
+
print(json.dumps(result,ensure_ascii=False,indent=2))
|
|
19
|
+
if __name__=='__main__':main()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Small synchronous HTTP SDK for the research/sandbox API only."""
|
|
2
|
+
import json
|
|
3
|
+
from urllib.request import Request,urlopen
|
|
4
|
+
from urllib.parse import urlencode,urlsplit,quote
|
|
5
|
+
|
|
6
|
+
class Gridzen:
|
|
7
|
+
def __init__(self,base_url='https://gridzen.ai/developers/api',timeout=10):
|
|
8
|
+
u=urlsplit(base_url)
|
|
9
|
+
if u.scheme!='https' and not (u.scheme=='http' and u.hostname in ('127.0.0.1','localhost')):raise ValueError('HTTPS required outside localhost')
|
|
10
|
+
if u.username or u.password or u.query or u.fragment:raise ValueError('Invalid base URL')
|
|
11
|
+
self.base_url=base_url.rstrip('/');self.timeout=timeout
|
|
12
|
+
def _call(self,path,payload=None):
|
|
13
|
+
r=Request(self.base_url+path,data=json.dumps(payload).encode() if payload is not None else None,headers={'Content-Type':'application/json','User-Agent':'GridzenDeveloperKit/0.1'})
|
|
14
|
+
with urlopen(r,timeout=self.timeout) as response:return json.load(response)
|
|
15
|
+
def coverage(self,country=None,capability=None):return self._call('/coverage?'+urlencode({k:v for k,v in {'country':country,'capability':capability}.items() if v}))
|
|
16
|
+
def plan(self,country,event='payout'):return self._call('/plan',{'country':country,'event':event})
|
|
17
|
+
def simulate(self,country,capability,scenario='match'):return self._call('/sandbox/verifications',{'country':country,'capability':capability,'scenario':scenario})
|
|
18
|
+
def get_simulation(self,identifier):return self._call('/sandbox/verifications/'+quote(identifier,safe=''))
|
|
19
|
+
def explain(self,reason_code):return self._call('/explain/'+quote(reason_code,safe=''))
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
from functools import lru_cache
|
|
2
|
+
from importlib.resources import files
|
|
3
|
+
import json
|
|
4
|
+
|
|
5
|
+
SCENARIOS = ('match', 'mismatch', 'not_found', 'timeout', 'unsupported')
|
|
6
|
+
EVENTS = {'onboarding': 'commercial_identity', 'payout': 'bank_account_match', 'account_change': 'phone_identity'}
|
|
7
|
+
REASONS = {
|
|
8
|
+
'SIMULATED_MATCH': ('The synthetic fixture matches.', 'Continue testing; this does not authorize a real action.'),
|
|
9
|
+
'SIMULATED_MISMATCH': ('The synthetic fixture does not match.', 'Request correction or review; mismatch alone does not establish fraud.'),
|
|
10
|
+
'SIMULATED_NOT_FOUND': ('The fixture has no matching record.', 'Treat as inconclusive; check inputs or use an authorized alternative.'),
|
|
11
|
+
'SIMULATED_PROVIDER_TIMEOUT': ('The fixture simulates a provider timeout.', 'Treat as inconclusive; retry with a limit, never turn timeout into mismatch.'),
|
|
12
|
+
'SIMULATED_UNSUPPORTED': ('The fixture simulates an unsupported route.', 'Choose a supported, authorized route or manual review.'),
|
|
13
|
+
}
|
|
14
|
+
@lru_cache(maxsize=1)
|
|
15
|
+
def catalog():
|
|
16
|
+
return json.loads(files('gridzen_developer').joinpath('data/catalog.json').read_text())
|
|
17
|
+
|
|
18
|
+
def country(code):
|
|
19
|
+
code=code.upper()
|
|
20
|
+
result=next((x for x in catalog()['countries'] if x['code']==code),None)
|
|
21
|
+
if result is None:raise ValueError('UNKNOWN_COUNTRY: use a code returned by coverage()')
|
|
22
|
+
return result
|
|
23
|
+
|
|
24
|
+
def capability(value):
|
|
25
|
+
if value not in catalog()['capabilities']:raise ValueError('UNKNOWN_CAPABILITY')
|
|
26
|
+
return value
|
|
27
|
+
|
|
28
|
+
def coverage(country_code=None, capability_id=None):
|
|
29
|
+
if capability_id:capability(capability_id)
|
|
30
|
+
rows=[country(country_code)] if country_code else catalog()['countries']
|
|
31
|
+
result=[]
|
|
32
|
+
for row in rows:
|
|
33
|
+
services=[s for s in row['services'] if not capability_id or s['capability']==capability_id]
|
|
34
|
+
result.append({**row,'services':services,'capability_evidence':{k:v for k,v in row['capability_evidence'].items() if not capability_id or k==capability_id},'evidence_status':'RESEARCH_EVIDENCE' if services else 'UNCONFIRMED'})
|
|
35
|
+
if not country_code:result=[{k:r[k] for k in ('code','name','region','research_class','live_available','evidence_status')}|{'service_count':len(r['services'])} for r in result]
|
|
36
|
+
return {'mode':'research','research_date':catalog()['research_date'],'live_routes':0,'capabilities':catalog()['capabilities'],'countries':result,'notice':'Research evidence is not Gridzen commercial access, provider authorization, or a current availability guarantee.'}
|
|
37
|
+
|
|
38
|
+
def plan(country_code, event='payout'):
|
|
39
|
+
c=country(country_code)
|
|
40
|
+
if event not in EVENTS:raise ValueError('UNKNOWN_EVENT')
|
|
41
|
+
cap=EVENTS[event];research=coverage(c['code'],cap)
|
|
42
|
+
return {'mode':'planning','country':c['code'],'event':event,'capability':cap,'evidence_status':research['countries'][0]['evidence_status'],'research_date':catalog()['research_date'],'services':research['countries'][0]['services'],'execution':{'sandbox_available':True,'live_available':False,'reason':'NO_LIVE_ROUTE_ENABLED'},'next_steps':['Run synthetic match, mismatch, not_found, timeout and unsupported fixtures.','Preserve inconclusive outcomes; never infer identity or fraud from missing data.','For a real pilot, confirm provider access and required inputs before enabling a route.'],'sandbox_request':{'country':c['code'],'capability':cap,'scenario':'match'}}
|
|
43
|
+
|
|
44
|
+
def explain(reason_code):
|
|
45
|
+
if reason_code not in REASONS:raise ValueError('UNKNOWN_REASON_CODE')
|
|
46
|
+
meaning,next_step=REASONS[reason_code]
|
|
47
|
+
return {'reason_code':reason_code,'meaning':meaning,'next_step':next_step,'simulated':True,'verified':False}
|
|
48
|
+
|
|
49
|
+
def simulate(country_code, capability_id, scenario='match'):
|
|
50
|
+
c=country(country_code);capability(capability_id)
|
|
51
|
+
if scenario not in SCENARIOS:raise ValueError('UNKNOWN_SCENARIO')
|
|
52
|
+
code={'match':'SIMULATED_MATCH','mismatch':'SIMULATED_MISMATCH','not_found':'SIMULATED_NOT_FOUND','timeout':'SIMULATED_PROVIDER_TIMEOUT','unsupported':'SIMULATED_UNSUPPORTED'}[scenario]
|
|
53
|
+
return {'id':f"sim_v1:{c['code']}:{capability_id}:{scenario}",'mode':'sandbox','simulated':True,'verified':False,'live_available':False,'provider_calls':0,'country':c['code'],'capability':capability_id,'fixture_outcome':scenario,'status':'inconclusive' if scenario in ('not_found','timeout','unsupported') else 'completed','evidence':[],'reason_code':code,'explanation':explain(code),'notice':'Deterministic synthetic fixture, not a unique transaction or an identity verification. Do not use to approve real people or payments.'}
|
|
54
|
+
|
|
55
|
+
def get_simulation(identifier):
|
|
56
|
+
parts=identifier.split(':')
|
|
57
|
+
if len(parts)!=4 or parts[0]!='sim_v1':raise ValueError('UNKNOWN_SANDBOX_ID')
|
|
58
|
+
return simulate(*parts[1:])
|