api-mapper-client 1.0.1__tar.gz → 1.2.0__tar.gz

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.
Files changed (20) hide show
  1. {api_mapper_client-1.0.1 → api_mapper_client-1.2.0}/.gitignore +37 -1
  2. api_mapper_client-1.2.0/PKG-INFO +126 -0
  3. api_mapper_client-1.2.0/README.md +90 -0
  4. {api_mapper_client-1.0.1 → api_mapper_client-1.2.0}/api_mapper_client/__init__.py +2 -1
  5. api_mapper_client-1.2.0/api_mapper_client/client.py +630 -0
  6. {api_mapper_client-1.0.1 → api_mapper_client-1.2.0}/pyproject.toml +22 -10
  7. api_mapper_client-1.0.1/PKG-INFO +0 -82
  8. api_mapper_client-1.0.1/README.md +0 -50
  9. api_mapper_client-1.0.1/api_mapper_client/client.py +0 -220
  10. {api_mapper_client-1.0.1 → api_mapper_client-1.2.0}/LICENSE +0 -0
  11. {api_mapper_client-1.0.1 → api_mapper_client-1.2.0}/api_mapper_client/auth/__init__.py +0 -0
  12. {api_mapper_client-1.0.1 → api_mapper_client-1.2.0}/api_mapper_client/auth/api_key.py +0 -0
  13. {api_mapper_client-1.0.1 → api_mapper_client-1.2.0}/api_mapper_client/auth/base.py +0 -0
  14. {api_mapper_client-1.0.1 → api_mapper_client-1.2.0}/api_mapper_client/auth/delegated_bearer.py +0 -0
  15. {api_mapper_client-1.0.1 → api_mapper_client-1.2.0}/api_mapper_client/auth/oauth2_client_credentials.py +0 -0
  16. {api_mapper_client-1.0.1 → api_mapper_client-1.2.0}/api_mapper_client/contracts.py +0 -0
  17. {api_mapper_client-1.0.1 → api_mapper_client-1.2.0}/api_mapper_langchain/__init__.py +0 -0
  18. {api_mapper_client-1.0.1 → api_mapper_client-1.2.0}/api_mapper_langchain/toolkit.py +0 -0
  19. {api_mapper_client-1.0.1 → api_mapper_client-1.2.0}/api_mapper_langgraph/__init__.py +0 -0
  20. {api_mapper_client-1.0.1 → api_mapper_client-1.2.0}/api_mapper_langgraph/nodes.py +0 -0
@@ -146,6 +146,17 @@ coverage*.json
146
146
  coverage*.xml
147
147
  coverage*.info
148
148
 
149
+ # Vitest/v8 writes a coverage *directory*, which the file patterns above do not cover.
150
+ # tools/quality-scan.sh generates it on every run and feeds lcov.info to SonarQube.
151
+ coverage/
152
+
153
+ # SonarScanner working directories, both written into the repository root by tools/quality-scan.sh.
154
+ # .sonarqube holds the generated rulesets and the per-project analysis config between the scanner's
155
+ # begin and end steps; .scannerwork holds the report the end step uploads. Both are rebuilt on every
156
+ # run and neither describes the source.
157
+ .sonarqube/
158
+ .scannerwork/
159
+
149
160
  # Visual Studio code coverage results
150
161
  *.coverage
151
162
  *.coveragexml
@@ -220,6 +231,10 @@ src/PublicSite/CodedProjects.AI.ApiMapper.Public.Web/wwwroot/
220
231
  **/[Pp]ackages/*
221
232
  # except build/, which is used as an MSBuild target.
222
233
  !**/[Pp]ackages/build/
234
+ # The TypeScript SDK is an npm workspace whose sources live in packages/. It is not a NuGet
235
+ # restore directory, so the rule above must not swallow it.
236
+ !sdk/typescript/packages/
237
+ !sdk/typescript/packages/**
223
238
  # Uncomment if necessary however generally it will be regenerated when needed
224
239
  #!**/[Pp]ackages/repositories.config
225
240
  # NuGet v3's project.json files produces more ignorable files
@@ -397,6 +412,27 @@ dist/
397
412
  # k6 performance test output
398
413
  tests/PerformanceTests/reports/*.json
399
414
 
415
+ # Playwright local run artifacts
416
+ src/Portal/CodedProjects.AI.ApiMapper.Portal.Web/test-results/
417
+ src/Portal/CodedProjects.AI.ApiMapper.Portal.Web/playwright-report/
418
+
400
419
  #java maven publish
401
420
  sdk/java/*/target/
402
- sdk/java/target/
421
+ sdk/java/target/
422
+
423
+ # Local AI-assistant model configuration (opencode). Machine-specific, and these files hold provider API
424
+ # keys inline: opencode.json.nvidia_glm51 carried a live NVIDIA key on this branch. Ignored so a key
425
+ # cannot be committed from here again.
426
+ #
427
+ # NOTE: ignoring does not undo the disclosure. The key already in history still needs rotating at the
428
+ # provider, and .gitleaks.toml deliberately does not allowlist it, so the secret scan keeps reporting it
429
+ # until that is done.
430
+ opencode.json
431
+ opencode.json.*
432
+
433
+ # Published release documentation. The build-output rule above ([Rr]eleases/) would otherwise swallow the
434
+ # repository's own /releases directory, so re-include it and the docs it holds while leaving everything
435
+ # else under it ignored.
436
+ !/releases/
437
+ /releases/*
438
+ !/releases/docs/
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.5
2
+ Name: api-mapper-client
3
+ Version: 1.2.0
4
+ Summary: Client SDK for the CodedProjects AI ApiMapper Runtime
5
+ Project-URL: Homepage, https://apimapper.ai
6
+ Author: Coded Projects
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Keywords: ai,apimapper,client,llm,mcp,python,sdk,tools
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Requires-Python: >=3.12
19
+ Requires-Dist: httpx>=2.12.0
20
+ Provides-Extra: all
21
+ Requires-Dist: langchain-core>=1.3.3; extra == 'all'
22
+ Requires-Dist: langgraph>=1.0.10; extra == 'all'
23
+ Requires-Dist: pydantic>=2.4.0; extra == 'all'
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
26
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
27
+ Requires-Dist: respx>=0.21.0; extra == 'dev'
28
+ Provides-Extra: langchain
29
+ Requires-Dist: langchain-core>=1.3.3; extra == 'langchain'
30
+ Requires-Dist: pydantic>=2.4.0; extra == 'langchain'
31
+ Provides-Extra: langgraph
32
+ Requires-Dist: langchain-core>=1.3.3; extra == 'langgraph'
33
+ Requires-Dist: langgraph>=1.0.10; extra == 'langgraph'
34
+ Requires-Dist: pydantic>=2.4.0; extra == 'langgraph'
35
+ Description-Content-Type: text/markdown
36
+
37
+ # api-mapper-client
38
+
39
+ Python SDK for discovering and invoking AI ApiMapper Runtime tools from Python applications and agents.
40
+
41
+ ## Install
42
+
43
+ ```bash
44
+ pip install api-mapper-client
45
+ ```
46
+
47
+ Optional integrations:
48
+
49
+ ```bash
50
+ pip install "api-mapper-client[langchain]"
51
+ pip install "api-mapper-client[langgraph]"
52
+ pip install "api-mapper-client[all]"
53
+ ```
54
+
55
+ ## What it provides
56
+
57
+ - runtime tool discovery,
58
+ - runtime system prompt loading,
59
+ - tool invocation over MCP-compatible HTTP endpoints,
60
+ - API key, delegated bearer token, and OAuth2 client credentials authentication helpers,
61
+ - optional LangChain and LangGraph integration helpers.
62
+
63
+ ## Quick start
64
+
65
+ ```python
66
+ import uuid
67
+
68
+ from api_mapper_client import ApiMapperClient, ApiMapperClientOptions
69
+ from api_mapper_client.auth.api_key import ApiKeyCredentialProvider
70
+
71
+ client = ApiMapperClient(
72
+ ApiMapperClientOptions(
73
+ base_url="https://runtime.example.com",
74
+ tenant_id=uuid.UUID("11111111-1111-1111-1111-111111111111"),
75
+ client_id="my-ai-client",
76
+ credentials=ApiKeyCredentialProvider("replace-with-your-api-key"),
77
+ )
78
+ )
79
+
80
+ tools = await client.get_tools()
81
+ print([tool.name for tool in tools])
82
+ ```
83
+
84
+ ## Streaming (Streamable HTTP / SSE)
85
+
86
+ The Runtime's `/mcp` endpoint may answer a request either with a plain JSON body or, when it
87
+ prefers SSE responses, with an SSE-framed body (`Content-Type: text/event-stream`). The client
88
+ handles both transparently — no configuration is needed, and neither mode is a "fallback" of the
89
+ other. If an SSE response ever ends without producing a message frame, the client makes one
90
+ resumption attempt (`GET /mcp` with `Last-Event-ID`) before raising.
91
+
92
+ Two additional APIs come with this support:
93
+
94
+ **`close_session()`** — explicitly tears down the MCP session on the Runtime (`DELETE /mcp`).
95
+ Best-effort: a 404 (session already gone) is not treated as an error. It's called automatically by
96
+ `close()` / `__aexit__`, so you typically don't need to call it directly:
97
+
98
+ ```python
99
+ async with client:
100
+ tools = await client.get_tools()
101
+ # session is closed automatically on exit
102
+
103
+ # or explicitly, without closing the underlying HTTP client:
104
+ await client.close_session()
105
+ ```
106
+
107
+ **`listen()`** — opens the Runtime's standalone server-push stream (`GET /mcp`) and yields each
108
+ message as a dict. It reconnects automatically on transient faults (using `Last-Event-ID` so the
109
+ Runtime can resume/replay), and stops immediately if the session is unknown/expired or a stream is
110
+ already open:
111
+
112
+ ```python
113
+ async for message in client.listen():
114
+ print(message)
115
+ ```
116
+
117
+ ## Correlation IDs
118
+
119
+ Send your application's own trace ID with each call and the Runtime records it against the execution
120
+ ID it generates, so you can retrieve the full platform audit trail for work you triggered. Configure
121
+ an ambient provider on the client options, or pass one per call. See the
122
+ [SDK correlation guide](https://github.com/CodedProjects/ApiMapper/blob/main/docs/SDK.md#correlation-ids).
123
+
124
+ ## License
125
+
126
+ MIT
@@ -0,0 +1,90 @@
1
+ # api-mapper-client
2
+
3
+ Python SDK for discovering and invoking AI ApiMapper Runtime tools from Python applications and agents.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install api-mapper-client
9
+ ```
10
+
11
+ Optional integrations:
12
+
13
+ ```bash
14
+ pip install "api-mapper-client[langchain]"
15
+ pip install "api-mapper-client[langgraph]"
16
+ pip install "api-mapper-client[all]"
17
+ ```
18
+
19
+ ## What it provides
20
+
21
+ - runtime tool discovery,
22
+ - runtime system prompt loading,
23
+ - tool invocation over MCP-compatible HTTP endpoints,
24
+ - API key, delegated bearer token, and OAuth2 client credentials authentication helpers,
25
+ - optional LangChain and LangGraph integration helpers.
26
+
27
+ ## Quick start
28
+
29
+ ```python
30
+ import uuid
31
+
32
+ from api_mapper_client import ApiMapperClient, ApiMapperClientOptions
33
+ from api_mapper_client.auth.api_key import ApiKeyCredentialProvider
34
+
35
+ client = ApiMapperClient(
36
+ ApiMapperClientOptions(
37
+ base_url="https://runtime.example.com",
38
+ tenant_id=uuid.UUID("11111111-1111-1111-1111-111111111111"),
39
+ client_id="my-ai-client",
40
+ credentials=ApiKeyCredentialProvider("replace-with-your-api-key"),
41
+ )
42
+ )
43
+
44
+ tools = await client.get_tools()
45
+ print([tool.name for tool in tools])
46
+ ```
47
+
48
+ ## Streaming (Streamable HTTP / SSE)
49
+
50
+ The Runtime's `/mcp` endpoint may answer a request either with a plain JSON body or, when it
51
+ prefers SSE responses, with an SSE-framed body (`Content-Type: text/event-stream`). The client
52
+ handles both transparently — no configuration is needed, and neither mode is a "fallback" of the
53
+ other. If an SSE response ever ends without producing a message frame, the client makes one
54
+ resumption attempt (`GET /mcp` with `Last-Event-ID`) before raising.
55
+
56
+ Two additional APIs come with this support:
57
+
58
+ **`close_session()`** — explicitly tears down the MCP session on the Runtime (`DELETE /mcp`).
59
+ Best-effort: a 404 (session already gone) is not treated as an error. It's called automatically by
60
+ `close()` / `__aexit__`, so you typically don't need to call it directly:
61
+
62
+ ```python
63
+ async with client:
64
+ tools = await client.get_tools()
65
+ # session is closed automatically on exit
66
+
67
+ # or explicitly, without closing the underlying HTTP client:
68
+ await client.close_session()
69
+ ```
70
+
71
+ **`listen()`** — opens the Runtime's standalone server-push stream (`GET /mcp`) and yields each
72
+ message as a dict. It reconnects automatically on transient faults (using `Last-Event-ID` so the
73
+ Runtime can resume/replay), and stops immediately if the session is unknown/expired or a stream is
74
+ already open:
75
+
76
+ ```python
77
+ async for message in client.listen():
78
+ print(message)
79
+ ```
80
+
81
+ ## Correlation IDs
82
+
83
+ Send your application's own trace ID with each call and the Runtime records it against the execution
84
+ ID it generates, so you can retrieve the full platform audit trail for work you triggered. Configure
85
+ an ambient provider on the client options, or pass one per call. See the
86
+ [SDK correlation guide](https://github.com/CodedProjects/ApiMapper/blob/main/docs/SDK.md#correlation-ids).
87
+
88
+ ## License
89
+
90
+ MIT
@@ -1,4 +1,4 @@
1
- from .client import ApiMapperClient, ApiMapperClientOptions
1
+ from .client import ApiMapperClient, ApiMapperClientOptions, ApiMapperRequestError
2
2
  from .auth.api_key import ApiKeyCredentialProvider
3
3
  from .auth.delegated_bearer import DelegatedBearerCredentialProvider
4
4
  from .auth.oauth2_client_credentials import OAuth2ClientCredentialsProvider, OAuth2ClientCredentialsOptions
@@ -7,6 +7,7 @@ from .contracts import McpTool, McpToolCallResult, McpToolContent
7
7
  __all__ = [
8
8
  "ApiMapperClient",
9
9
  "ApiMapperClientOptions",
10
+ "ApiMapperRequestError",
10
11
  "ApiKeyCredentialProvider",
11
12
  "DelegatedBearerCredentialProvider",
12
13
  "OAuth2ClientCredentialsProvider",