@stigmer/temporal-codecs 0.1.0-dev.20261017020314.g644422724c27
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/LICENSE +194 -0
- package/README.md +48 -0
- package/claimcheck/compressor.d.ts +12 -0
- package/claimcheck/compressor.d.ts.map +1 -0
- package/claimcheck/compressor.js +17 -0
- package/claimcheck/compressor.js.map +1 -0
- package/claimcheck/config.d.ts +17 -0
- package/claimcheck/config.d.ts.map +1 -0
- package/claimcheck/config.js +19 -0
- package/claimcheck/config.js.map +1 -0
- package/claimcheck/payload-codec.d.ts +29 -0
- package/claimcheck/payload-codec.d.ts.map +1 -0
- package/claimcheck/payload-codec.js +110 -0
- package/claimcheck/payload-codec.js.map +1 -0
- package/claimcheck/storage.d.ts +20 -0
- package/claimcheck/storage.d.ts.map +1 -0
- package/claimcheck/storage.js +2 -0
- package/claimcheck/storage.js.map +1 -0
- package/connection/config.d.ts +100 -0
- package/connection/config.d.ts.map +1 -0
- package/connection/config.js +171 -0
- package/connection/config.js.map +1 -0
- package/encryption/config.d.ts +100 -0
- package/encryption/config.d.ts.map +1 -0
- package/encryption/config.js +119 -0
- package/encryption/config.js.map +1 -0
- package/encryption/payload-codec.d.ts +60 -0
- package/encryption/payload-codec.d.ts.map +1 -0
- package/encryption/payload-codec.js +163 -0
- package/encryption/payload-codec.js.map +1 -0
- package/index.d.ts +32 -0
- package/index.d.ts.map +1 -0
- package/index.js +28 -0
- package/index.js.map +1 -0
- package/package.json +42 -0
- package/src/claimcheck/compressor.ts +19 -0
- package/src/claimcheck/config.ts +30 -0
- package/src/claimcheck/payload-codec.ts +144 -0
- package/src/claimcheck/storage.ts +19 -0
- package/src/connection/config.ts +217 -0
- package/src/encryption/config.ts +204 -0
- package/src/encryption/payload-codec.ts +186 -0
- package/src/index.ts +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Stigmer Contributors
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
191
|
+
|
|
192
|
+
Except for the contents of the ee/ directory, which are licensed under the
|
|
193
|
+
Stigmer Enterprise License (see ee/LICENSE), everything in this repository
|
|
194
|
+
is licensed under the Apache License, Version 2.0, above.
|
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @stigmer/temporal-codecs
|
|
2
|
+
|
|
3
|
+
Temporal payload codecs shared by Stigmer's TypeScript Temporal processes:
|
|
4
|
+
|
|
5
|
+
- **`EncryptionPayloadCodec`** — AES-256-GCM encryption of payloads at rest
|
|
6
|
+
in workflow history, with key-id-addressed rotation.
|
|
7
|
+
- **`ClaimcheckPayloadCodec`** — transparent offload of large payloads to
|
|
8
|
+
blob storage (with optional gzip), replaced in history by a small marker.
|
|
9
|
+
|
|
10
|
+
## Why this is a library
|
|
11
|
+
|
|
12
|
+
The encryption envelope is a **cross-language wire contract**: the Java
|
|
13
|
+
decode-only codec in stigmer-cloud's `temporal-starter` must decrypt these
|
|
14
|
+
payloads byte-for-byte, and the Stigmer TypeScript server installs the same
|
|
15
|
+
codecs on its Temporal clients. One implementation, many consumers — the
|
|
16
|
+
contract must never fork. The committed fixture in
|
|
17
|
+
`src/__tests__/fixtures/encrypted-payload-fixture.json` pins the envelope;
|
|
18
|
+
never regenerate it casually (changing it means changing the cross-SDK
|
|
19
|
+
contract, which requires every implementation to move in lockstep).
|
|
20
|
+
|
|
21
|
+
Extracted from `backend/services/runner` (its `src/encryption/` and
|
|
22
|
+
`src/claimcheck/` modules) when the TypeScript server became the second
|
|
23
|
+
consumer.
|
|
24
|
+
|
|
25
|
+
## Consumers
|
|
26
|
+
|
|
27
|
+
- `@stigmer/runner` (`backend/services/runner`) — encode + decode on its
|
|
28
|
+
Temporal workers.
|
|
29
|
+
- The Stigmer TypeScript server — decode for history reads, encode for
|
|
30
|
+
payloads it writes.
|
|
31
|
+
|
|
32
|
+
## Dependency policy
|
|
33
|
+
|
|
34
|
+
`@temporalio/common` and `@temporalio/proto` are pinned **exact and
|
|
35
|
+
identical to the runner's pins** and must be bumped in lockstep with it:
|
|
36
|
+
the runner's consumer-install gate (stigmer/stigmer#786) fails on any
|
|
37
|
+
`@temporalio/*` version mix, because a split dependency tree registers the
|
|
38
|
+
Temporal core-sdk protobuf namespace twice and crashes worker init.
|
|
39
|
+
|
|
40
|
+
## Design notes
|
|
41
|
+
|
|
42
|
+
- The codecs perform no environment or secret reads of their own.
|
|
43
|
+
`loadPayloadEncryptionConfig` takes an injected secret reader, so each
|
|
44
|
+
consumer applies its own secret-custody policy (the runner routes reads
|
|
45
|
+
through its boot-capture credential store; see stigmer/stigmer#508).
|
|
46
|
+
- The claim-check codec depends on the minimal `ClaimcheckStorage` port
|
|
47
|
+
declared here — two methods, `upload` and `download` — which consumers
|
|
48
|
+
satisfy structurally with their own storage clients.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gzip helpers for claim-checked blobs. Synchronous by design: the codec
|
|
3
|
+
* runs on the Temporal worker's payload path where the blobs are bounded
|
|
4
|
+
* by the claim-check threshold, and gzip's format is part of the marker
|
|
5
|
+
* contract (`compressed: true` blobs must gunzip on any consumer).
|
|
6
|
+
*
|
|
7
|
+
* Moved from backend/services/runner/src/claimcheck/compressor.ts when the
|
|
8
|
+
* codecs became @stigmer/temporal-codecs.
|
|
9
|
+
*/
|
|
10
|
+
export declare function compress(data: Buffer): Buffer<ArrayBuffer>;
|
|
11
|
+
export declare function decompress(data: Buffer): Buffer<ArrayBuffer>;
|
|
12
|
+
//# sourceMappingURL=compressor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compressor.d.ts","sourceRoot":"","sources":["../src/claimcheck/compressor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,CAE1D;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,CAE5D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gzip helpers for claim-checked blobs. Synchronous by design: the codec
|
|
3
|
+
* runs on the Temporal worker's payload path where the blobs are bounded
|
|
4
|
+
* by the claim-check threshold, and gzip's format is part of the marker
|
|
5
|
+
* contract (`compressed: true` blobs must gunzip on any consumer).
|
|
6
|
+
*
|
|
7
|
+
* Moved from backend/services/runner/src/claimcheck/compressor.ts when the
|
|
8
|
+
* codecs became @stigmer/temporal-codecs.
|
|
9
|
+
*/
|
|
10
|
+
import { gzipSync, gunzipSync } from "node:zlib";
|
|
11
|
+
export function compress(data) {
|
|
12
|
+
return gzipSync(data);
|
|
13
|
+
}
|
|
14
|
+
export function decompress(data) {
|
|
15
|
+
return gunzipSync(data);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=compressor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compressor.js","sourceRoot":"","sources":["../src/claimcheck/compressor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,QAAQ,CAAC,IAAI,CAAwB,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,UAAU,CAAC,IAAI,CAAwB,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claim-check configuration, env-driven with an enabled-iff-configured
|
|
3
|
+
* gate (CLAIMCHECK_ENABLED) — unlike encryption, the offload threshold and
|
|
4
|
+
* key prefix are operational tuning, not secrets, so plain env reads are
|
|
5
|
+
* the whole policy.
|
|
6
|
+
*
|
|
7
|
+
* Moved from backend/services/runner/src/claimcheck/config.ts when the
|
|
8
|
+
* codecs became @stigmer/temporal-codecs.
|
|
9
|
+
*/
|
|
10
|
+
export interface ClaimcheckConfig {
|
|
11
|
+
readonly enabled: boolean;
|
|
12
|
+
readonly thresholdBytes: number;
|
|
13
|
+
readonly compressionEnabled: boolean;
|
|
14
|
+
readonly keyPrefix: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function loadClaimcheckConfig(): ClaimcheckConfig;
|
|
17
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/claimcheck/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAID,wBAAgB,oBAAoB,IAAI,gBAAgB,CAUvD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claim-check configuration, env-driven with an enabled-iff-configured
|
|
3
|
+
* gate (CLAIMCHECK_ENABLED) — unlike encryption, the offload threshold and
|
|
4
|
+
* key prefix are operational tuning, not secrets, so plain env reads are
|
|
5
|
+
* the whole policy.
|
|
6
|
+
*
|
|
7
|
+
* Moved from backend/services/runner/src/claimcheck/config.ts when the
|
|
8
|
+
* codecs became @stigmer/temporal-codecs.
|
|
9
|
+
*/
|
|
10
|
+
const DEFAULT_THRESHOLD_BYTES = 128 * 1024; // 128KB
|
|
11
|
+
export function loadClaimcheckConfig() {
|
|
12
|
+
return {
|
|
13
|
+
enabled: process.env.CLAIMCHECK_ENABLED === "true",
|
|
14
|
+
thresholdBytes: parseInt(process.env.CLAIMCHECK_THRESHOLD_BYTES ?? String(DEFAULT_THRESHOLD_BYTES), 10),
|
|
15
|
+
compressionEnabled: process.env.CLAIMCHECK_COMPRESSION_ENABLED !== "false",
|
|
16
|
+
keyPrefix: process.env.CLAIMCHECK_KEY_PREFIX ?? "claimcheck/",
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/claimcheck/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,MAAM,uBAAuB,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,QAAQ;AAEpD,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,KAAK,MAAM;QAClD,cAAc,EAAE,QAAQ,CACtB,OAAO,CAAC,GAAG,CAAC,0BAA0B,IAAI,MAAM,CAAC,uBAAuB,CAAC,EACzE,EAAE,CACH;QACD,kBAAkB,EAAE,OAAO,CAAC,GAAG,CAAC,8BAA8B,KAAK,OAAO;QAC1E,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,aAAa;KAC9D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Temporal PayloadCodec that transparently offloads large payloads to
|
|
3
|
+
* external storage ({@link ClaimcheckStorage}). Payloads below the
|
|
4
|
+
* threshold pass through unchanged. Payloads at or above the threshold
|
|
5
|
+
* are compressed (optional), uploaded, and replaced with a small
|
|
6
|
+
* reference marker.
|
|
7
|
+
*
|
|
8
|
+
* On decode, markers are detected, the original payload is downloaded
|
|
9
|
+
* and decompressed, and the original bytes are restored — transparent
|
|
10
|
+
* to workflow/activity code.
|
|
11
|
+
*
|
|
12
|
+
* Moved from backend/services/runner/src/claimcheck/payload-codec.ts when
|
|
13
|
+
* the codecs became @stigmer/temporal-codecs (one home for the
|
|
14
|
+
* cross-language envelope contract; the TS server is the second consumer).
|
|
15
|
+
*/
|
|
16
|
+
import type { Payload, PayloadCodec } from "@temporalio/common";
|
|
17
|
+
import type { ClaimcheckStorage } from "./storage.js";
|
|
18
|
+
import type { ClaimcheckConfig } from "./config.js";
|
|
19
|
+
export declare class ClaimcheckPayloadCodec implements PayloadCodec {
|
|
20
|
+
private readonly storage;
|
|
21
|
+
private readonly config;
|
|
22
|
+
constructor(storage: ClaimcheckStorage, config: ClaimcheckConfig);
|
|
23
|
+
encode(payloads: Payload[]): Promise<Payload[]>;
|
|
24
|
+
decode(payloads: Payload[]): Promise<Payload[]>;
|
|
25
|
+
private encodePayload;
|
|
26
|
+
private decodePayload;
|
|
27
|
+
private isClaimcheckPayload;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=payload-codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-codec.d.ts","sourceRoot":"","sources":["../src/claimcheck/payload-codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAoBpD,qBAAa,sBAAuB,YAAW,YAAY;IAEvD,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE,gBAAgB;IAGrC,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAI/C,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;YAIvC,aAAa;YAoCb,aAAa;IA4B3B,OAAO,CAAC,mBAAmB;CAK5B"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Temporal PayloadCodec that transparently offloads large payloads to
|
|
3
|
+
* external storage ({@link ClaimcheckStorage}). Payloads below the
|
|
4
|
+
* threshold pass through unchanged. Payloads at or above the threshold
|
|
5
|
+
* are compressed (optional), uploaded, and replaced with a small
|
|
6
|
+
* reference marker.
|
|
7
|
+
*
|
|
8
|
+
* On decode, markers are detected, the original payload is downloaded
|
|
9
|
+
* and decompressed, and the original bytes are restored — transparent
|
|
10
|
+
* to workflow/activity code.
|
|
11
|
+
*
|
|
12
|
+
* Moved from backend/services/runner/src/claimcheck/payload-codec.ts when
|
|
13
|
+
* the codecs became @stigmer/temporal-codecs (one home for the
|
|
14
|
+
* cross-language envelope contract; the TS server is the second consumer).
|
|
15
|
+
*/
|
|
16
|
+
import { randomUUID } from "node:crypto";
|
|
17
|
+
import { compress, decompress } from "./compressor.js";
|
|
18
|
+
const MARKER_METADATA_KEY = "encoding";
|
|
19
|
+
const MARKER_ENCODING_VALUE = "binary/claimcheck";
|
|
20
|
+
export class ClaimcheckPayloadCodec {
|
|
21
|
+
storage;
|
|
22
|
+
config;
|
|
23
|
+
constructor(storage, config) {
|
|
24
|
+
this.storage = storage;
|
|
25
|
+
this.config = config;
|
|
26
|
+
}
|
|
27
|
+
async encode(payloads) {
|
|
28
|
+
return Promise.all(payloads.map((p) => this.encodePayload(p)));
|
|
29
|
+
}
|
|
30
|
+
async decode(payloads) {
|
|
31
|
+
return Promise.all(payloads.map((p) => this.decodePayload(p)));
|
|
32
|
+
}
|
|
33
|
+
async encodePayload(payload) {
|
|
34
|
+
const data = payload.data;
|
|
35
|
+
if (!data || data.length < this.config.thresholdBytes) {
|
|
36
|
+
return payload;
|
|
37
|
+
}
|
|
38
|
+
const originalBuf = Buffer.from(data);
|
|
39
|
+
let uploadBuf = originalBuf;
|
|
40
|
+
let compressed = false;
|
|
41
|
+
if (this.config.compressionEnabled) {
|
|
42
|
+
const compressedBuf = compress(originalBuf);
|
|
43
|
+
if (compressedBuf.length < originalBuf.length) {
|
|
44
|
+
uploadBuf = compressedBuf;
|
|
45
|
+
compressed = true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const key = `${this.config.keyPrefix}${randomUUID()}`;
|
|
49
|
+
await this.storage.upload(key, uploadBuf, "application/octet-stream");
|
|
50
|
+
const marker = {
|
|
51
|
+
key,
|
|
52
|
+
size: data.length,
|
|
53
|
+
compressed,
|
|
54
|
+
metadata: serializeMetadata(payload.metadata),
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
metadata: {
|
|
58
|
+
[MARKER_METADATA_KEY]: Buffer.from(MARKER_ENCODING_VALUE),
|
|
59
|
+
},
|
|
60
|
+
data: Buffer.from(JSON.stringify(marker)),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
async decodePayload(payload) {
|
|
64
|
+
if (!this.isClaimcheckPayload(payload)) {
|
|
65
|
+
return payload;
|
|
66
|
+
}
|
|
67
|
+
const marker = JSON.parse(Buffer.from(payload.data).toString("utf-8"));
|
|
68
|
+
let rawBuf;
|
|
69
|
+
try {
|
|
70
|
+
rawBuf = await this.storage.download(marker.key);
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
// Preserve the claimcheck-scoped error contract; the shared download error
|
|
74
|
+
// already carries the HTTP status (proxy) or the miss (local) as the cause.
|
|
75
|
+
const cause = err instanceof Error ? err.message : String(err);
|
|
76
|
+
throw new Error(`Claimcheck retrieve failed for key ${marker.key}: ${cause}`);
|
|
77
|
+
}
|
|
78
|
+
const dataBuf = marker.compressed ? decompress(rawBuf) : rawBuf;
|
|
79
|
+
return {
|
|
80
|
+
metadata: marker.metadata
|
|
81
|
+
? deserializeMetadata(marker.metadata)
|
|
82
|
+
: payload.metadata,
|
|
83
|
+
data: dataBuf,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
isClaimcheckPayload(payload) {
|
|
87
|
+
const encoding = payload.metadata?.[MARKER_METADATA_KEY];
|
|
88
|
+
if (!encoding)
|
|
89
|
+
return false;
|
|
90
|
+
return Buffer.from(encoding).toString("utf-8") === MARKER_ENCODING_VALUE;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function serializeMetadata(metadata) {
|
|
94
|
+
if (!metadata)
|
|
95
|
+
return undefined;
|
|
96
|
+
const out = {};
|
|
97
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
98
|
+
if (value)
|
|
99
|
+
out[key] = Buffer.from(value).toString("base64");
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
function deserializeMetadata(metadata) {
|
|
104
|
+
const out = {};
|
|
105
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
106
|
+
out[key] = Buffer.from(value, "base64");
|
|
107
|
+
}
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=payload-codec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-codec.js","sourceRoot":"","sources":["../src/claimcheck/payload-codec.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The blob-store contract the claim-check codec needs — nothing more.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately minimal (upload + download by key) so any consumer's
|
|
5
|
+
* storage client satisfies it structurally: the runner's ArtifactStorage
|
|
6
|
+
* (a richer interface with presigned-URL minting) matches as-is, and the
|
|
7
|
+
* TS server brings its own. Widening this port widens the wire contract's
|
|
8
|
+
* dependency surface for every consumer — do not add methods the codec
|
|
9
|
+
* itself does not call.
|
|
10
|
+
*/
|
|
11
|
+
export interface ClaimcheckStorage {
|
|
12
|
+
/** Store `content` under `key`; resolves once the blob is durable. */
|
|
13
|
+
upload(key: string, content: Buffer, contentType?: string): Promise<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Return the exact bytes stored under `key`, or throw a descriptive,
|
|
16
|
+
* key-scoped `Error` when the object is missing or the transport fails.
|
|
17
|
+
*/
|
|
18
|
+
download(key: string): Promise<Buffer>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/claimcheck/storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5E;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/claimcheck/storage.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Temporal connection security: how a Stigmer process authenticates to the
|
|
3
|
+
* Temporal frontend it dials. The server's client and worker connections
|
|
4
|
+
* and the runner's worker connection all read it, so it lives here, in the
|
|
5
|
+
* one library both processes share. Unset means today's plaintext
|
|
6
|
+
* connection, unchanged.
|
|
7
|
+
*
|
|
8
|
+
* The settings (each `_PATH` item has a `_DATA` twin holding the PEM text):
|
|
9
|
+
*
|
|
10
|
+
* STIGMER_TEMPORAL_API_KEY bearer key; implies TLS
|
|
11
|
+
* STIGMER_TEMPORAL_TLS "true" or "1": TLS with the
|
|
12
|
+
* system's trusted roots
|
|
13
|
+
* STIGMER_TEMPORAL_TLS_SERVER_NAME SNI / host-name override
|
|
14
|
+
* STIGMER_TEMPORAL_TLS_SERVER_CA_CERT_PATH the frontend's CA (implies TLS)
|
|
15
|
+
* STIGMER_TEMPORAL_TLS_CLIENT_CERT_PATH mutual TLS: the client's
|
|
16
|
+
* STIGMER_TEMPORAL_TLS_CLIENT_KEY_PATH certificate and key, together
|
|
17
|
+
*
|
|
18
|
+
* WHY Stigmer's own names, not Temporal's `TEMPORAL_API_KEY` and
|
|
19
|
+
* `TEMPORAL_TLS_*`: those belong to the user's own Temporal work. A local
|
|
20
|
+
* Stigmer (`stigmer up`) inherits the user's shell, and agents that build
|
|
21
|
+
* Temporal applications export `TEMPORAL_API_KEY` for their own namespaces.
|
|
22
|
+
* Reading it would present the user's key to Stigmer's own Temporal and,
|
|
23
|
+
* through the runner's secret custody, take it away from the agents that
|
|
24
|
+
* need it. The shape follows Temporal's so an operator recognises it.
|
|
25
|
+
*
|
|
26
|
+
* WHY not Temporal's reader (`@temporalio/envconfig`): at the SDK version
|
|
27
|
+
* every Stigmer package pins (1.16.2), it reads `TEMPORAL_TLS=true` as TLS
|
|
28
|
+
* disabled. Releases before 1.22.0 carry that inversion. It also ignores
|
|
29
|
+
* host-verification settings, and it reads the user's own Temporal profile
|
|
30
|
+
* file by default.
|
|
31
|
+
*
|
|
32
|
+
* Misconfiguration fails the boot, the posture of the payload-encryption
|
|
33
|
+
* config beside this module: an operator who set half a client pair, or
|
|
34
|
+
* the same item twice, believes the connection is authenticated, and a
|
|
35
|
+
* silently weaker connection would be a security failure. An empty value
|
|
36
|
+
* means unset, so a blank line in a deployment's environment turns nothing
|
|
37
|
+
* on.
|
|
38
|
+
*
|
|
39
|
+
* Values are read through an injected {@link SecretReader}, as the
|
|
40
|
+
* encryption keys are: secret custody is the consumer's policy. The runner
|
|
41
|
+
* passes its credential store's reader, so the API key and the client key
|
|
42
|
+
* never live in an environment its agent tools can read.
|
|
43
|
+
*/
|
|
44
|
+
import type { SecretReader } from "../encryption/config.js";
|
|
45
|
+
/**
|
|
46
|
+
* TLS settings in the Temporal SDK's own shape (`TLSConfig` in
|
|
47
|
+
* `@temporalio/common`), declared structurally so this library imports
|
|
48
|
+
* nothing internal. An empty object means TLS with the system's roots.
|
|
49
|
+
*/
|
|
50
|
+
export interface TemporalTls {
|
|
51
|
+
readonly serverNameOverride?: string;
|
|
52
|
+
readonly serverRootCACertificate?: Uint8Array;
|
|
53
|
+
readonly clientCertPair?: {
|
|
54
|
+
readonly crt: Uint8Array;
|
|
55
|
+
readonly key: Uint8Array;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* What a connection needs beyond its address. Both fields are absent for a
|
|
60
|
+
* plaintext connection; spread it into `Connection.connect` or
|
|
61
|
+
* `NativeConnection.connect` as is.
|
|
62
|
+
*/
|
|
63
|
+
export interface TemporalConnectionConfig {
|
|
64
|
+
readonly tls?: TemporalTls;
|
|
65
|
+
readonly apiKey?: string;
|
|
66
|
+
}
|
|
67
|
+
export declare const TEMPORAL_API_KEY_ENV = "STIGMER_TEMPORAL_API_KEY";
|
|
68
|
+
export declare const TEMPORAL_TLS_ENV = "STIGMER_TEMPORAL_TLS";
|
|
69
|
+
export declare const TEMPORAL_TLS_SERVER_NAME_ENV = "STIGMER_TEMPORAL_TLS_SERVER_NAME";
|
|
70
|
+
/**
|
|
71
|
+
* The `_DATA` name of the client key: a credential, which the runner takes
|
|
72
|
+
* into custody beside the API key (its `_PATH` twin names a file, not a
|
|
73
|
+
* secret).
|
|
74
|
+
*/
|
|
75
|
+
export declare const TEMPORAL_TLS_CLIENT_KEY_DATA_ENV: string;
|
|
76
|
+
/**
|
|
77
|
+
* Every setting name this module reads, exactly. A process that hands its
|
|
78
|
+
* children their own rendered settings ({@link temporalConnectionEnv})
|
|
79
|
+
* removes these from what the child inherits; other `STIGMER_TEMPORAL_*`
|
|
80
|
+
* names (the CLI's own) are not connection settings.
|
|
81
|
+
*/
|
|
82
|
+
export declare const TEMPORAL_CONNECTION_ENV_NAMES: readonly string[];
|
|
83
|
+
/**
|
|
84
|
+
* Loads the connection settings.
|
|
85
|
+
*
|
|
86
|
+
* @throws when a setting is contradictory or unreadable: a client
|
|
87
|
+
* certificate without its key (or the reverse), both the `_PATH` and the
|
|
88
|
+
* `_DATA` form of one item, a path that cannot be read, or a
|
|
89
|
+
* `STIGMER_TEMPORAL_TLS` that is neither true nor false.
|
|
90
|
+
*/
|
|
91
|
+
export declare function loadTemporalConnectionConfig(read: SecretReader): TemporalConnectionConfig;
|
|
92
|
+
/**
|
|
93
|
+
* Renders loaded settings back as the environment a child runner reads,
|
|
94
|
+
* every PEM item in its `_DATA` form, so that no file has to exist where
|
|
95
|
+
* the child runs. The server's sandbox drivers pass this to the runners
|
|
96
|
+
* they start. Round-trips: loading the rendered environment yields the
|
|
97
|
+
* same settings.
|
|
98
|
+
*/
|
|
99
|
+
export declare function temporalConnectionEnv(config: TemporalConnectionConfig): Record<string, string>;
|
|
100
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/connection/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,UAAU,CAAC;IAC9C,QAAQ,CAAC,cAAc,CAAC,EAAE;QACxB,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;QACzB,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;KAC1B,CAAC;CACH;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,oBAAoB,6BAA6B,CAAC;AAC/D,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AACvD,eAAO,MAAM,4BAA4B,qCAAqC,CAAC;AAS/E;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,QAAgC,CAAC;AAE9E;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,EAAE,SAAS,MAAM,EAK1D,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,YAAY,GACjB,wBAAwB,CA2C1B;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,wBAAwB,GAC/B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBxB"}
|