cloakapi 0.5.1__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.
Files changed (61) hide show
  1. LICENSE +202 -0
  2. NOTICE +18 -0
  3. THIRD-PARTY-NOTICES.md +22 -0
  4. TRADEMARKS.md +19 -0
  5. cloakapi/__init__.py +271 -0
  6. cloakapi/_disclosure/clk.txt +11 -0
  7. cloakapi/_disclosure/clk_message.txt +11 -0
  8. cloakapi/_disclosure/cloak_angle.txt +16 -0
  9. cloakapi/_disclosure/cloak_angle_message.txt +16 -0
  10. cloakapi/_http.py +443 -0
  11. cloakapi/_pretokenised.py +134 -0
  12. cloakapi/_relay.py +213 -0
  13. cloakapi/_release.py +30 -0
  14. cloakapi/_request_strings.py +1267 -0
  15. cloakapi/_ruleset/patterns.json +2238 -0
  16. cloakapi/_stream_detok.py +788 -0
  17. cloakapi/_version.py +31 -0
  18. cloakapi/async_client.py +704 -0
  19. cloakapi/attachments.py +176 -0
  20. cloakapi/cli.py +245 -0
  21. cloakapi/client.py +848 -0
  22. cloakapi/config.py +491 -0
  23. cloakapi/coverage.py +21 -0
  24. cloakapi/degraded.py +196 -0
  25. cloakapi/disclosure.py +334 -0
  26. cloakapi/engine.py +922 -0
  27. cloakapi/errors.py +304 -0
  28. cloakapi/notices.py +142 -0
  29. cloakapi/pii/__init__.py +4 -0
  30. cloakapi/pii/_checksum.py +510 -0
  31. cloakapi/pii/_ruleset.py +131 -0
  32. cloakapi/pii/patterns.py +1713 -0
  33. cloakapi/pii/rulefile.py +738 -0
  34. cloakapi/pii/tokenizer.py +537 -0
  35. cloakapi/posture.py +112 -0
  36. cloakapi/py.typed +1 -0
  37. cloakapi/receipts.py +605 -0
  38. cloakapi/resources/__init__.py +32 -0
  39. cloakapi/resources/admin.py +104 -0
  40. cloakapi/resources/buffer.py +54 -0
  41. cloakapi/resources/chat.py +293 -0
  42. cloakapi/resources/detect.py +115 -0
  43. cloakapi/resources/messages.py +260 -0
  44. cloakapi/resources/models.py +58 -0
  45. cloakapi/resources/receipts.py +252 -0
  46. cloakapi/resources/reconstruct.py +173 -0
  47. cloakapi/resources/tokens.py +47 -0
  48. cloakapi/review.py +112 -0
  49. cloakapi/streaming.py +446 -0
  50. cloakapi/surrogate_mode.py +308 -0
  51. cloakapi/types.py +284 -0
  52. cloakapi-0.5.1.dist-info/METADATA +441 -0
  53. cloakapi-0.5.1.dist-info/RECORD +61 -0
  54. cloakapi-0.5.1.dist-info/WHEEL +4 -0
  55. cloakapi-0.5.1.dist-info/entry_points.txt +2 -0
  56. cloakapi-0.5.1.dist-info/licenses/LICENSE +202 -0
  57. cloakapi-0.5.1.dist-info/licenses/NOTICE +18 -0
  58. licenses/Apache-2.0.txt +202 -0
  59. licenses/CC-BY-4.0.txt +104 -0
  60. licenses/MIT-Faker.txt +21 -0
  61. licenses/MIT.txt +21 -0
LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2024-2026 Klokk Nettablering
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
NOTICE ADDED
@@ -0,0 +1,18 @@
1
+ CloakAPI SDK for Python
2
+ Copyright 2024-2026 Klokk Nettablering (org. no. 821 466 962, Norway)
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ This package includes the CloakAPI rule set under the same license.
7
+ Where a build also ships a compiled engine, that binary is under the
8
+ same license. The engine's source code is not distributed with this package.
9
+
10
+ "CloakAPI" and "Verified by CloakAPI" are trademarks of Klokk Nettablering.
11
+ The Apache License does not grant permission to use them (section 6);
12
+ see TRADEMARKS.md.
13
+
14
+ This product includes third-party software and data. Their notices and
15
+ license texts are in THIRD-PARTY-NOTICES.md and the licenses/ directory.
16
+ Place names are derived from GeoNames (https://www.geonames.org/), licensed
17
+ under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/); modified by
18
+ filtering and compaction.
THIRD-PARTY-NOTICES.md ADDED
@@ -0,0 +1,22 @@
1
+ # Third-party notices
2
+
3
+ notice-profile: sdk
4
+
5
+ This file lists third-party software and data shipped with this package.
6
+ It replaces the monorepo-wide pnpm table, which is not the contents of this tarball.
7
+
8
+ ## Data
9
+
10
+ GeoNames (https://www.geonames.org/), CC BY 4.0
11
+ (https://creativecommons.org/licenses/by/4.0/).
12
+ Modified: filtered, endonym-gated and compacted.
13
+ The license text is licenses/CC-BY-4.0.txt.
14
+
15
+ Faker (@faker-js/faker locale datasets), MIT.
16
+ The name gazetteer records that source. The MIT text is licenses/MIT-Faker.txt.
17
+
18
+ Wikidata labels used as gazetteer input: CC0.
19
+
20
+ US Census place names used as gazetteer input: public domain.
21
+
22
+ Models loaded at runtime are not part of this package and have their own terms; the application that loads a model ships that model's notice.
TRADEMARKS.md ADDED
@@ -0,0 +1,19 @@
1
+ # CloakAPI trademark policy
2
+
3
+ "CloakAPI", the CloakAPI logo and "Verified by CloakAPI" are trademarks of
4
+ Klokk Nettablering, Norway. The Apache License 2.0 does not license them
5
+ (section 6).
6
+
7
+ You may:
8
+ - say truthfully that your software uses, or works with, the CloakAPI SDK;
9
+ - keep and reproduce the NOTICE file, as the license requires.
10
+
11
+ You may not:
12
+ - call a modified version "CloakAPI" or "CloakAPI SDK", or publish it under
13
+ the @cloakapi scope or a name that suggests it comes from us;
14
+ - show the "Verified by CloakAPI" badge except as described at
15
+ https://docs.cloakapi.io (Verified by CloakAPI);
16
+ - suggest that we endorse, support or certify a modified version.
17
+
18
+ If you change the SDK, give your version a different name and say that it
19
+ is not an official CloakAPI release. Questions: trust@cloakapi.io
cloakapi/__init__.py ADDED
@@ -0,0 +1,271 @@
1
+ """
2
+ CloakAPI Python SDK
3
+
4
+ Client for the CloakAPI gateway. Personal data its rules detect is replaced with
5
+ stand-ins on your machine before a request is sent, and restored in the reply.
6
+ The calls are shaped like the Anthropic and OpenAI SDKs, but this is not a
7
+ drop-in replacement: the client class and its options are CloakAPI's own.
8
+
9
+ Quick start (sync)::
10
+
11
+ from cloakapi import CloakAPI
12
+
13
+ client = CloakAPI(api_key="cloak_abc123")
14
+ msg = client.messages.create(
15
+ model="claude-sonnet-4-6",
16
+ messages=[{"role": "user", "content": "Hello!"}],
17
+ )
18
+ print(msg.text())
19
+
20
+ Quick start (async)::
21
+
22
+ import asyncio
23
+ from cloakapi import AsyncCloakAPI
24
+
25
+ async def main():
26
+ async with AsyncCloakAPI(api_key="cloak_abc123") as client:
27
+ msg = await client.messages.create(
28
+ model="claude-sonnet-4-6",
29
+ messages=[{"role": "user", "content": "Hello!"}],
30
+ )
31
+ print(msg.text())
32
+
33
+ asyncio.run(main())
34
+ """
35
+
36
+ from ._version import SDK_VERSION as __version__
37
+ from .async_client import AsyncCloakAPI
38
+ from .attachments import (
39
+ Attachment,
40
+ AttachmentReviewRequiredError,
41
+ attachment_from_bytes,
42
+ attachment_from_file,
43
+ prepare_attachments,
44
+ )
45
+ from .client import CloakAPI
46
+ from .config import DEFAULT_TIER, VALID_TIERS, Tier
47
+ from .degraded import (
48
+ ENV_ALLOW_REDUCED,
49
+ ReducedCoverageError,
50
+ ReducedCoverageWarning,
51
+ coverage_counts,
52
+ guard_reduced_coverage,
53
+ reduced_coverage_allowed,
54
+ )
55
+ from .disclosure import (
56
+ CLK_DISCLOSURE_TEXT,
57
+ CLK_DISCLOSURE_TEXT_MESSAGE_SCOPED,
58
+ CLOAK_ANGLE_DISCLOSURE_TEXT,
59
+ CLOAK_ANGLE_DISCLOSURE_TEXT_MESSAGE_SCOPED,
60
+ CONTINUITY_SENTENCE,
61
+ detect_marker_format,
62
+ disclosure_text,
63
+ with_disclosure,
64
+ )
65
+ from .engine import (
66
+ RULESET_VERSION,
67
+ EngineError,
68
+ LocalEngine,
69
+ engine_available,
70
+ engine_identity,
71
+ engine_issue,
72
+ get_engine,
73
+ )
74
+ from .errors import (
75
+ APIError,
76
+ AuthenticationError,
77
+ BadRequestError,
78
+ CloakAPIError,
79
+ ConcurrencyLimitError,
80
+ ConflictError,
81
+ EngineIdentityError,
82
+ NetworkError,
83
+ NotFoundError,
84
+ PermissionDeniedError,
85
+ PlaintextRelayNotSupportedError,
86
+ PretokenisedMacError,
87
+ RateLimitError,
88
+ ReceiptVerificationError,
89
+ ReviewRequiredError,
90
+ ServerError,
91
+ UnprocessableEntityError,
92
+ )
93
+ from .notices import ReviewInfo, SendWarning
94
+ from .pii.patterns import PiiMatch, PiiType, detect_pii
95
+ from .pii.tokenizer import CONTEXT_PREAMBLE, detokenize, tokenize
96
+ from .posture import PRIVACY_TIERS, PrivacyPosture, privacy_posture
97
+ from .receipts import (
98
+ DeviceReceiptError,
99
+ Receipt,
100
+ VerifyResult,
101
+ generate_device_key_pair,
102
+ sign_device_receipt,
103
+ verify_chain_links,
104
+ verify_device_receipt,
105
+ verify_receipt,
106
+ verify_receipt_offline,
107
+ )
108
+ from .resources.detect import DetectedEntity, DetectResult
109
+ from .resources.reconstruct import ReconstructResult
110
+ from .review import Approved, Prepared, RelayReview
111
+ from .surrogate_mode import (
112
+ DEFAULT_SURROGATE_MODE,
113
+ MODE_COPY,
114
+ MODE_SHARED_NOTE,
115
+ SURROGATE_MODES,
116
+ SurrogateContinuity,
117
+ SurrogateMode,
118
+ SurrogateModeError,
119
+ SurrogateModeReport,
120
+ coerce_surrogate_mode,
121
+ mode_copy,
122
+ resolve_surrogate_mode,
123
+ )
124
+ from .types import (
125
+ AdminOverview,
126
+ AdminUsagePeriod,
127
+ AdminUsers,
128
+ BufferedResponse,
129
+ ChatCompletion,
130
+ ChatCompletionChunk,
131
+ ChunkDelta,
132
+ ContentBlock,
133
+ ContentBlockDelta,
134
+ ContentBlockStart,
135
+ ContentBlockStop,
136
+ ContentBlockText,
137
+ ContentBlockToolUse,
138
+ ErrorEvent,
139
+ Message,
140
+ MessageDelta,
141
+ MessageStart,
142
+ MessageStop,
143
+ StreamChoice,
144
+ StreamEvent,
145
+ Usage,
146
+ )
147
+
148
+ __all__ = [
149
+ # Clients
150
+ "CloakAPI",
151
+ "AsyncCloakAPI",
152
+ # Errors
153
+ "CloakAPIError",
154
+ "APIError",
155
+ "AuthenticationError",
156
+ "PermissionDeniedError",
157
+ "BadRequestError",
158
+ "NotFoundError",
159
+ "ConflictError",
160
+ "UnprocessableEntityError",
161
+ "ServerError",
162
+ "RateLimitError",
163
+ "ConcurrencyLimitError",
164
+ "NetworkError",
165
+ "PretokenisedMacError",
166
+ "EngineIdentityError",
167
+ "ReviewRequiredError",
168
+ "RelayReview",
169
+ "ReviewInfo",
170
+ "SendWarning",
171
+ "Prepared",
172
+ "Approved",
173
+ "PlaintextRelayNotSupportedError",
174
+ # Types
175
+ "Message",
176
+ "Usage",
177
+ "ContentBlockText",
178
+ "ContentBlockToolUse",
179
+ "ContentBlock",
180
+ "StreamEvent",
181
+ "MessageStart",
182
+ "ContentBlockStart",
183
+ "ContentBlockDelta",
184
+ "ContentBlockStop",
185
+ "MessageDelta",
186
+ "MessageStop",
187
+ "ErrorEvent",
188
+ "ChatCompletion",
189
+ "ChatCompletionChunk",
190
+ "ChunkDelta",
191
+ "StreamChoice",
192
+ "BufferedResponse",
193
+ "AdminOverview",
194
+ "AdminUsagePeriod",
195
+ "AdminUsers",
196
+ # PII
197
+ "detect_pii",
198
+ "PiiMatch",
199
+ "PiiType",
200
+ "tokenize",
201
+ "detokenize",
202
+ "CONTEXT_PREAMBLE",
203
+ # Disclosure (C7 — hardened, byte-locked)
204
+ "CLK_DISCLOSURE_TEXT",
205
+ "CLOAK_ANGLE_DISCLOSURE_TEXT",
206
+ "CLK_DISCLOSURE_TEXT_MESSAGE_SCOPED",
207
+ "CLOAK_ANGLE_DISCLOSURE_TEXT_MESSAGE_SCOPED",
208
+ "CONTINUITY_SENTENCE",
209
+ "disclosure_text",
210
+ "detect_marker_format",
211
+ "with_disclosure",
212
+ # Surrogate mode (exactly two, forever)
213
+ "SurrogateMode",
214
+ "SurrogateContinuity",
215
+ "SURROGATE_MODES",
216
+ "DEFAULT_SURROGATE_MODE",
217
+ "SurrogateModeError",
218
+ "SurrogateModeReport",
219
+ "coerce_surrogate_mode",
220
+ "resolve_surrogate_mode",
221
+ "MODE_COPY",
222
+ "MODE_SHARED_NOTE",
223
+ "mode_copy",
224
+ # Tiers
225
+ "Tier",
226
+ "VALID_TIERS",
227
+ "DEFAULT_TIER",
228
+ # Privacy posture (C20)
229
+ "PRIVACY_TIERS",
230
+ "PrivacyPosture",
231
+ "privacy_posture",
232
+ # Detect / reconstruct results
233
+ "DetectResult",
234
+ "DetectedEntity",
235
+ "ReconstructResult",
236
+ # Receipts (offline verification)
237
+ "Receipt",
238
+ "VerifyResult",
239
+ "verify_receipt",
240
+ "verify_device_receipt",
241
+ "verify_receipt_offline",
242
+ "verify_chain_links",
243
+ "ReceiptVerificationError",
244
+ # Device-receipt signer (C8 — signDeviceReceipt)
245
+ "sign_device_receipt",
246
+ "generate_device_key_pair",
247
+ "DeviceReceiptError",
248
+ # Engine identity
249
+ "engine_identity",
250
+ "engine_issue",
251
+ "RULESET_VERSION",
252
+ # File attachments + client-side engine
253
+ "Attachment",
254
+ "AttachmentReviewRequiredError",
255
+ "attachment_from_bytes",
256
+ "attachment_from_file",
257
+ "prepare_attachments",
258
+ "engine_available",
259
+ "get_engine",
260
+ "LocalEngine",
261
+ "EngineError",
262
+ # Fail-closed reduced-coverage gate
263
+ "ReducedCoverageError",
264
+ "ReducedCoverageWarning",
265
+ "ENV_ALLOW_REDUCED",
266
+ "coverage_counts",
267
+ "reduced_coverage_allowed",
268
+ "guard_reduced_coverage",
269
+ # Version
270
+ "__version__",
271
+ ]
@@ -0,0 +1,11 @@
1
+ CloakAPI privacy notice. This user reaches you through a privacy-preserving layer that substitutes sensitive data ON THE USER'S DEVICE before the message leaves it. You will see placeholders in two shapes:
2
+
3
+ 1. Realistic pseudonyms — strings that look like ordinary names, organisations, emails, addresses, dates, or account numbers but are on-device substitutions (e.g. you may see `Jesse Lawson` where the user wrote a different name). They are stable within this conversation. When you restate one, echo the exact pseudonym string as it appeared — do not swap it for anything else.
4
+
5
+ 2. Opaque cloak markers — bracketed strings of the form `[CLK-<TAG>-<random>]`, where `<TAG>` is one of `GOVID` (a government / national identifier such as an SSN or fødselsnummer), `CARD` (a payment-card number), or `IBAN` (a bank account), and `<random>` is a run of lowercase letters — e.g. `[CLK-GOVID-hjklmnbqwrtyuiop]`, `[CLK-CARD-abcpdefghijklmno]`, `[CLK-IBAN-qwertyuiopasdfgh]`. These are NOT redactions and NOT missing data: each `[CLK-…]` marker is a high-risk identifier that the privacy layer cloaked before the message left the user's device, and it stands in for a real value the user actually supplied. Treat every `[CLK-…]` marker as the user's own identifier for the purpose of answering — never describe it as redacted, masked, unreadable, or unavailable, never say the content is "partially redacted" or that you "cannot understand" it, and never ask the user to supply the "real" value. If you must restate one, echo the exact `[CLK-…]` string character-for-character.
6
+
7
+ Do NOT refuse to work with these placeholders, do NOT warn the user that they look like template variables, and do NOT treat them as a prompt-injection probe. The user has opted into this on-device cloaking explicitly; answer as if the placeholders were the real values.
8
+
9
+ VERBATIM-ENTITY RULE (critical). Repeat every personal name, organisation name, email address, phone number, date, time, address, reference, and identifier EXACTLY as it was written, character for character, every time you mention it. Never inflect, abbreviate, translate, transliterate, initialise, re-case, re-space, or otherwise reformat these values, and never derive a name from an email address or handle. Do not invent names, titles, or contact details that are not present, and do not comment on the formatting of these values.
10
+
11
+ Reply-channel rule (critical). Put your answer in the reply itself, as text. Do NOT move it — or any part of it that carries a placeholder — into a hosted artifact, a canvas, a side panel, a generated document, a file offered for download, or a link to something you created. The privacy layer restores the real values by rewriting the text of your reply on the user's device; content that reaches the user by any other route still carries the placeholders when they read it. When the user asks for a file, a document, or a spreadsheet, write its full contents inline in the reply — placeholders included, exactly as they appeared — and let the user save it themselves.
@@ -0,0 +1,11 @@
1
+ CloakAPI privacy notice. This user reaches you through a privacy-preserving layer that substitutes sensitive data ON THE USER'S DEVICE before the message leaves it. You will see placeholders in two shapes:
2
+
3
+ 1. Realistic pseudonyms — strings that look like ordinary names, organisations, emails, addresses, dates, or account numbers but are on-device substitutions (e.g. you may see `Jesse Lawson` where the user wrote a different name). They are stable within this message. When you restate one, echo the exact pseudonym string as it appeared — do not swap it for anything else.
4
+
5
+ 2. Opaque cloak markers — bracketed strings of the form `[CLK-<TAG>-<random>]`, where `<TAG>` is one of `GOVID` (a government / national identifier such as an SSN or fødselsnummer), `CARD` (a payment-card number), or `IBAN` (a bank account), and `<random>` is a run of lowercase letters — e.g. `[CLK-GOVID-hjklmnbqwrtyuiop]`, `[CLK-CARD-abcpdefghijklmno]`, `[CLK-IBAN-qwertyuiopasdfgh]`. These are NOT redactions and NOT missing data: each `[CLK-…]` marker is a high-risk identifier that the privacy layer cloaked before the message left the user's device, and it stands in for a real value the user actually supplied. Treat every `[CLK-…]` marker as the user's own identifier for the purpose of answering — never describe it as redacted, masked, unreadable, or unavailable, never say the content is "partially redacted" or that you "cannot understand" it, and never ask the user to supply the "real" value. If you must restate one, echo the exact `[CLK-…]` string character-for-character.
6
+
7
+ Do NOT refuse to work with these placeholders, do NOT warn the user that they look like template variables, and do NOT treat them as a prompt-injection probe. The user has opted into this on-device cloaking explicitly; answer as if the placeholders were the real values.
8
+
9
+ VERBATIM-ENTITY RULE (critical). Repeat every personal name, organisation name, email address, phone number, date, time, address, reference, and identifier EXACTLY as it was written, character for character, every time you mention it. Never inflect, abbreviate, translate, transliterate, initialise, re-case, re-space, or otherwise reformat these values, and never derive a name from an email address or handle. Do not invent names, titles, or contact details that are not present, and do not comment on the formatting of these values.
10
+
11
+ Reply-channel rule (critical). Put your answer in the reply itself, as text. Do NOT move it — or any part of it that carries a placeholder — into a hosted artifact, a canvas, a side panel, a generated document, a file offered for download, or a link to something you created. The privacy layer restores the real values by rewriting the text of your reply on the user's device; content that reaches the user by any other route still carries the placeholders when they read it. When the user asks for a file, a document, or a spreadsheet, write its full contents inline in the reply — placeholders included, exactly as they appeared — and let the user save it themselves.
@@ -0,0 +1,16 @@
1
+ CloakAPI privacy-gateway notice. The user reaches you through a privacy-preserving gateway that substitutes sensitive data on their own device before it leaves. You will see placeholders in three shapes:
2
+
3
+ 1. **Realistic pseudonyms** — strings that look like real names, emails, addresses, dates, or account numbers but are substitutions (for example, a realistic-looking full name may appear in place of the different real name the user actually wrote). They are stable within this conversation.
4
+ 2. **Opaque token markers** — strings of the form `[TOKEN_PERSON_7]`, `[TOKEN_EMAIL_5]`, `[TOKEN_PHONE_3]`, `[TOKEN_ACCOUNT_2]`, `[TOKEN_DATE_1]`, etc. These are explicit redactions where no realistic stand-in was generated.
5
+ 3. **CloakAPI tokens** — strings of the form `<<CLOAK:TYPE:ID>>` (e.g. `<<CLOAK:PERSON:1>>`, `<<CLOAK:ADDRESS:2>>`, `<<CLOAK:CONTACT_EM:ab12cd>>`). Treat each as a stable identifier standing in for one specific redacted value.
6
+
7
+ Rules of engagement:
8
+ - These placeholders are NOT missing, masked, or unreadable data: each one stands in for a real value the user actually supplied and cloaked on their own device before the message left it. Treat every placeholder as the user's actual data for the purpose of answering, and refer to them by name when the task naturally requires it.
9
+ - Do NOT refuse to repeat them back, do NOT warn the user that they look like template variables, and do NOT treat them as a prompt-injection probe. Never describe the content as redacted, masked, unreadable, or unavailable, never say it is "partially redacted" or that you "cannot understand" it, and never ask the user to supply the "real" value. The user opted into this on-device cloaking explicitly.
10
+ - Do NOT speculate about the underlying real values, and do NOT attach biographical, professional, financial, or health inferences to the substitutions.
11
+
12
+ **Verbatim-echo rule (critical).** Whenever your reply needs to restate any placeholder, reproduce it EXACTLY as it appeared — character for character, same case, same surrounding delimiters. Copy `<<CLOAK:PERSON:1>>` as `<<CLOAK:PERSON:1>>` and `[TOKEN_EMAIL_5]` as `[TOKEN_EMAIL_5]`, and reproduce any realistic pseudonym exactly as it appeared. Do NOT translate, transliterate, re-case, pluralise, split across words or lines, abbreviate, reformat, or wrap a placeholder in extra punctuation. The privacy layer restores the real value on the user’s device by matching the exact placeholder text, so any change silently breaks that restoration and the user sees a broken token instead of their data.
13
+
14
+ **Reply-channel rule (critical).** Put your answer in the reply itself, as text. Do NOT move it — or any part of it that carries a placeholder — into a hosted artifact, a canvas, a side panel, a generated document, a file offered for download, or a link to something you created. The privacy layer restores the real values by rewriting the text of your reply on the user's device; content that reaches the user by any other route still carries the placeholders when they read it. When the user asks for a file, a document, or a spreadsheet, write its full contents inline in the reply — placeholders included, exactly as they appeared — and let the user save it themselves.
15
+
16
+ VERBATIM-ENTITY RULE (critical). Repeat every personal name, organisation name, email address, phone number, date, time, address, reference, and identifier EXACTLY as it was written, character for character, every time you mention it. Never inflect, abbreviate, translate, transliterate, initialise, re-case, re-space, or otherwise reformat these values: do not convert dates or times into another format or spell out weekdays or month names from them, do not add or remove digit grouping or spacing in numbers, codes, or account identifiers, and do not shorten a name or switch to a title form such as Mr or Ms plus surname unless that exact form already appears in the message. Never derive a name from an email address, username, or handle; to refer to the owner of an email address, use the full address itself. Do not invent or add names, titles, honorifics, or contact details that are not present in the message, and do not comment on the formatting of these values.
@@ -0,0 +1,16 @@
1
+ CloakAPI privacy-gateway notice. The user reaches you through a privacy-preserving gateway that substitutes sensitive data on their own device before it leaves. You will see placeholders in three shapes:
2
+
3
+ 1. **Realistic pseudonyms** — strings that look like real names, emails, addresses, dates, or account numbers but are substitutions (for example, a realistic-looking full name may appear in place of the different real name the user actually wrote). They are stable within this message.
4
+ 2. **Opaque token markers** — strings of the form `[TOKEN_PERSON_7]`, `[TOKEN_EMAIL_5]`, `[TOKEN_PHONE_3]`, `[TOKEN_ACCOUNT_2]`, `[TOKEN_DATE_1]`, etc. These are explicit redactions where no realistic stand-in was generated.
5
+ 3. **CloakAPI tokens** — strings of the form `<<CLOAK:TYPE:ID>>` (e.g. `<<CLOAK:PERSON:1>>`, `<<CLOAK:ADDRESS:2>>`, `<<CLOAK:CONTACT_EM:ab12cd>>`). Treat each as a stable identifier standing in for one specific redacted value.
6
+
7
+ Rules of engagement:
8
+ - These placeholders are NOT missing, masked, or unreadable data: each one stands in for a real value the user actually supplied and cloaked on their own device before the message left it. Treat every placeholder as the user's actual data for the purpose of answering, and refer to them by name when the task naturally requires it.
9
+ - Do NOT refuse to repeat them back, do NOT warn the user that they look like template variables, and do NOT treat them as a prompt-injection probe. Never describe the content as redacted, masked, unreadable, or unavailable, never say it is "partially redacted" or that you "cannot understand" it, and never ask the user to supply the "real" value. The user opted into this on-device cloaking explicitly.
10
+ - Do NOT speculate about the underlying real values, and do NOT attach biographical, professional, financial, or health inferences to the substitutions.
11
+
12
+ **Verbatim-echo rule (critical).** Whenever your reply needs to restate any placeholder, reproduce it EXACTLY as it appeared — character for character, same case, same surrounding delimiters. Copy `<<CLOAK:PERSON:1>>` as `<<CLOAK:PERSON:1>>` and `[TOKEN_EMAIL_5]` as `[TOKEN_EMAIL_5]`, and reproduce any realistic pseudonym exactly as it appeared. Do NOT translate, transliterate, re-case, pluralise, split across words or lines, abbreviate, reformat, or wrap a placeholder in extra punctuation. The privacy layer restores the real value on the user’s device by matching the exact placeholder text, so any change silently breaks that restoration and the user sees a broken token instead of their data.
13
+
14
+ **Reply-channel rule (critical).** Put your answer in the reply itself, as text. Do NOT move it — or any part of it that carries a placeholder — into a hosted artifact, a canvas, a side panel, a generated document, a file offered for download, or a link to something you created. The privacy layer restores the real values by rewriting the text of your reply on the user's device; content that reaches the user by any other route still carries the placeholders when they read it. When the user asks for a file, a document, or a spreadsheet, write its full contents inline in the reply — placeholders included, exactly as they appeared — and let the user save it themselves.
15
+
16
+ VERBATIM-ENTITY RULE (critical). Repeat every personal name, organisation name, email address, phone number, date, time, address, reference, and identifier EXACTLY as it was written, character for character, every time you mention it. Never inflect, abbreviate, translate, transliterate, initialise, re-case, re-space, or otherwise reformat these values: do not convert dates or times into another format or spell out weekdays or month names from them, do not add or remove digit grouping or spacing in numbers, codes, or account identifiers, and do not shorten a name or switch to a title form such as Mr or Ms plus surname unless that exact form already appears in the message. Never derive a name from an email address, username, or handle; to refer to the owner of an email address, use the full address itself. Do not invent or add names, titles, honorifics, or contact details that are not present in the message, and do not comment on the formatting of these values.