@xeonr/pipelines-sdk 0.0.0-stage → 0.1.0

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 (102) hide show
  1. package/README.md +267 -2
  2. package/dist/auth.d.ts +72 -0
  3. package/dist/auth.d.ts.map +1 -0
  4. package/dist/auth.js +139 -0
  5. package/dist/auth.js.map +1 -0
  6. package/dist/client.d.ts +118 -0
  7. package/dist/client.d.ts.map +1 -0
  8. package/dist/client.js +101 -0
  9. package/dist/client.js.map +1 -0
  10. package/dist/errors.d.ts +77 -0
  11. package/dist/errors.d.ts.map +1 -0
  12. package/dist/errors.js +72 -0
  13. package/dist/errors.js.map +1 -0
  14. package/dist/gen/buf/validate/validate_pb.d.ts +4828 -0
  15. package/dist/gen/buf/validate/validate_pb.d.ts.map +1 -0
  16. package/dist/gen/buf/validate/validate_pb.js +357 -0
  17. package/dist/gen/buf/validate/validate_pb.js.map +1 -0
  18. package/dist/gen/gnostic/openapi/v3/annotations_pb.d.ts +24 -0
  19. package/dist/gen/gnostic/openapi/v3/annotations_pb.d.ts.map +1 -0
  20. package/dist/gen/gnostic/openapi/v3/annotations_pb.js +37 -0
  21. package/dist/gen/gnostic/openapi/v3/annotations_pb.js.map +1 -0
  22. package/dist/gen/gnostic/openapi/v3/openapiv3_pb.d.ts +2245 -0
  23. package/dist/gen/gnostic/openapi/v3/openapiv3_pb.d.ts.map +1 -0
  24. package/dist/gen/gnostic/openapi/v3/openapiv3_pb.js +410 -0
  25. package/dist/gen/gnostic/openapi/v3/openapiv3_pb.js.map +1 -0
  26. package/dist/gen/xeonr/pipelines/private/v1/attempt_pb.d.ts +1031 -0
  27. package/dist/gen/xeonr/pipelines/private/v1/attempt_pb.d.ts.map +1 -0
  28. package/dist/gen/xeonr/pipelines/private/v1/attempt_pb.js +219 -0
  29. package/dist/gen/xeonr/pipelines/private/v1/attempt_pb.js.map +1 -0
  30. package/dist/gen/xeonr/pipelines/private/v1/runners_pb.d.ts +190 -0
  31. package/dist/gen/xeonr/pipelines/private/v1/runners_pb.d.ts.map +1 -0
  32. package/dist/gen/xeonr/pipelines/private/v1/runners_pb.js +53 -0
  33. package/dist/gen/xeonr/pipelines/private/v1/runners_pb.js.map +1 -0
  34. package/dist/gen/xeonr/pipelines/private/v1/step_local_pb.d.ts +1161 -0
  35. package/dist/gen/xeonr/pipelines/private/v1/step_local_pb.d.ts.map +1 -0
  36. package/dist/gen/xeonr/pipelines/private/v1/step_local_pb.js +269 -0
  37. package/dist/gen/xeonr/pipelines/private/v1/step_local_pb.js.map +1 -0
  38. package/dist/gen/xeonr/pipelines/private/v1/worker_pb.d.ts +915 -0
  39. package/dist/gen/xeonr/pipelines/private/v1/worker_pb.d.ts.map +1 -0
  40. package/dist/gen/xeonr/pipelines/private/v1/worker_pb.js +159 -0
  41. package/dist/gen/xeonr/pipelines/private/v1/worker_pb.js.map +1 -0
  42. package/dist/gen/xeonr/pipelines/v1/common_pb.d.ts +550 -0
  43. package/dist/gen/xeonr/pipelines/v1/common_pb.d.ts.map +1 -0
  44. package/dist/gen/xeonr/pipelines/v1/common_pb.js +453 -0
  45. package/dist/gen/xeonr/pipelines/v1/common_pb.js.map +1 -0
  46. package/dist/gen/xeonr/pipelines/v1/definition_pb.d.ts +760 -0
  47. package/dist/gen/xeonr/pipelines/v1/definition_pb.d.ts.map +1 -0
  48. package/dist/gen/xeonr/pipelines/v1/definition_pb.js +190 -0
  49. package/dist/gen/xeonr/pipelines/v1/definition_pb.js.map +1 -0
  50. package/dist/gen/xeonr/pipelines/v1/pools_pb.d.ts +800 -0
  51. package/dist/gen/xeonr/pipelines/v1/pools_pb.d.ts.map +1 -0
  52. package/dist/gen/xeonr/pipelines/v1/pools_pb.js +247 -0
  53. package/dist/gen/xeonr/pipelines/v1/pools_pb.js.map +1 -0
  54. package/dist/gen/xeonr/pipelines/v1/registry_pb.d.ts +895 -0
  55. package/dist/gen/xeonr/pipelines/v1/registry_pb.d.ts.map +1 -0
  56. package/dist/gen/xeonr/pipelines/v1/registry_pb.js +277 -0
  57. package/dist/gen/xeonr/pipelines/v1/registry_pb.js.map +1 -0
  58. package/dist/gen/xeonr/pipelines/v1/runs_pb.d.ts +1217 -0
  59. package/dist/gen/xeonr/pipelines/v1/runs_pb.d.ts.map +1 -0
  60. package/dist/gen/xeonr/pipelines/v1/runs_pb.js +204 -0
  61. package/dist/gen/xeonr/pipelines/v1/runs_pb.js.map +1 -0
  62. package/dist/gen/xeonr/pipelines/v1/secrets_pb.d.ts +642 -0
  63. package/dist/gen/xeonr/pipelines/v1/secrets_pb.d.ts.map +1 -0
  64. package/dist/gen/xeonr/pipelines/v1/secrets_pb.js +181 -0
  65. package/dist/gen/xeonr/pipelines/v1/secrets_pb.js.map +1 -0
  66. package/dist/gen/xeonr/pipelines/v1/sinks_pb.d.ts +381 -0
  67. package/dist/gen/xeonr/pipelines/v1/sinks_pb.d.ts.map +1 -0
  68. package/dist/gen/xeonr/pipelines/v1/sinks_pb.js +145 -0
  69. package/dist/gen/xeonr/pipelines/v1/sinks_pb.js.map +1 -0
  70. package/dist/gen/xeonr/platform/v1/options_pb.d.ts +313 -0
  71. package/dist/gen/xeonr/platform/v1/options_pb.d.ts.map +1 -0
  72. package/dist/gen/xeonr/platform/v1/options_pb.js +235 -0
  73. package/dist/gen/xeonr/platform/v1/options_pb.js.map +1 -0
  74. package/dist/handler.d.ts +94 -0
  75. package/dist/handler.d.ts.map +1 -0
  76. package/dist/handler.js +18 -0
  77. package/dist/handler.js.map +1 -0
  78. package/dist/index.d.ts +29 -0
  79. package/dist/index.d.ts.map +1 -0
  80. package/dist/index.js +23 -0
  81. package/dist/index.js.map +1 -0
  82. package/dist/internal/time.d.ts +8 -0
  83. package/dist/internal/time.d.ts.map +1 -0
  84. package/dist/internal/time.js +25 -0
  85. package/dist/internal/time.js.map +1 -0
  86. package/dist/logship.d.ts +67 -0
  87. package/dist/logship.d.ts.map +1 -0
  88. package/dist/logship.js +176 -0
  89. package/dist/logship.js.map +1 -0
  90. package/dist/testing/index.d.ts +202 -0
  91. package/dist/testing/index.d.ts.map +1 -0
  92. package/dist/testing/index.js +909 -0
  93. package/dist/testing/index.js.map +1 -0
  94. package/dist/transport.d.ts +43 -0
  95. package/dist/transport.d.ts.map +1 -0
  96. package/dist/transport.js +44 -0
  97. package/dist/transport.js.map +1 -0
  98. package/dist/worker.d.ts +213 -0
  99. package/dist/worker.d.ts.map +1 -0
  100. package/dist/worker.js +664 -0
  101. package/dist/worker.js.map +1 -0
  102. package/package.json +70 -3
@@ -0,0 +1,235 @@
1
+ // xeonr.platform.v1 — the RPC authorisation options every product declares on
2
+ // its methods, defined once (BUILDING-SERVICES.md §4.5, PLAT-69).
3
+ //
4
+ // Before this module each product extended google.protobuf.MethodOptions with
5
+ // its own copy of these — auth at 9100, upl-im at 8999, profiles at 9200,
6
+ // burrow at 9400, dev at 9500, dbaas at 9600 — which meant go-platform's
7
+ // authn interceptor could not read any of them generically, `require_scope`
8
+ // and `required_scope` had already diverged, and three modules claimed 9300 in
9
+ // one afternoon. A product imports this file and declares these; it keeps a
10
+ // product-specific extension (burrow's allow_api_tokens, upl-im's
11
+ // allow_integration_api_key) in its own internal.proto on its own numbers.
12
+ //
13
+ // Extension numbers 9900-9999 are reserved for this module. The allocation
14
+ // table is `protocol/scripts/check-extensions.py --list`.
15
+ //
16
+ // Enforcement: go-platform/authn reads these off the method descriptor at
17
+ // request time. no_authentication, require_scope, one_of_scopes and
18
+ // allow_service_accounts are enforced by the interceptor itself;
19
+ // require_admin and allow_automation_keys are exposed on authn.Policy for the
20
+ // service's own check (what "admin" means, and what an automation key is, are
21
+ // the product's business).
22
+ import { enumDesc, extDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
23
+ import { file_google_protobuf_descriptor } from "@bufbuild/protobuf/wkt";
24
+ /**
25
+ * Describes the file xeonr/platform/v1/options.proto.
26
+ */
27
+ export const file_xeonr_platform_v1_options = /*@__PURE__*/ fileDesc("Ch94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29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucxiuTSABKAlSDm1jcERlc2NyaXB0aW9uQlZaVHByb3RvLnByb2Qud3RmL2dlbi9nby94ZW9uci9wbGF0Zm9ybS9wcm90b2NvbGJ1ZmZlcnMvZ28veGVvbnIvcGxhdGZvcm0vdjE7cGxhdGZvcm12MWIGcHJvdG8z", [file_google_protobuf_descriptor]);
28
+ /**
29
+ * Describes the message xeonr.platform.v1.McpTool.
30
+ * Use `create(McpToolSchema)` to create a new message.
31
+ */
32
+ export const McpToolSchema = /*@__PURE__*/ messageDesc(file_xeonr_platform_v1_options, 0);
33
+ /**
34
+ * Describes the message xeonr.platform.v1.McpToolset.
35
+ * Use `create(McpToolsetSchema)` to create a new message.
36
+ */
37
+ export const McpToolsetSchema = /*@__PURE__*/ messageDesc(file_xeonr_platform_v1_options, 1);
38
+ /**
39
+ * Describes the message xeonr.platform.v1.McpProduct.
40
+ * Use `create(McpProductSchema)` to create a new message.
41
+ */
42
+ export const McpProductSchema = /*@__PURE__*/ messageDesc(file_xeonr_platform_v1_options, 2);
43
+ /**
44
+ * McpTier says whether the gateway lists a tool or only finds it on request.
45
+ *
46
+ * @generated from enum xeonr.platform.v1.McpTier
47
+ */
48
+ export var McpTier;
49
+ (function (McpTier) {
50
+ /**
51
+ * @generated from enum value: MCP_TIER_UNSPECIFIED = 0;
52
+ */
53
+ McpTier[McpTier["UNSPECIFIED"] = 0] = "UNSPECIFIED";
54
+ /**
55
+ * Listed in tools/list. About 15 per product (mcpx.Lint enforces the budget).
56
+ *
57
+ * @generated from enum value: MCP_TIER_CORE = 1;
58
+ */
59
+ McpTier[McpTier["CORE"] = 1] = "CORE";
60
+ /**
61
+ * Reached through xeonr_find_tools / xeonr_describe_tool / xeonr_call_tool.
62
+ *
63
+ * @generated from enum value: MCP_TIER_EXTENDED = 2;
64
+ */
65
+ McpTier[McpTier["EXTENDED"] = 2] = "EXTENDED";
66
+ })(McpTier || (McpTier = {}));
67
+ /**
68
+ * Describes the enum xeonr.platform.v1.McpTier.
69
+ */
70
+ export const McpTierSchema = /*@__PURE__*/ enumDesc(file_xeonr_platform_v1_options, 0);
71
+ /**
72
+ * McpEffect drives the MCP tool annotations (readOnlyHint, destructiveHint).
73
+ *
74
+ * @generated from enum xeonr.platform.v1.McpEffect
75
+ */
76
+ export var McpEffect;
77
+ (function (McpEffect) {
78
+ /**
79
+ * @generated from enum value: MCP_EFFECT_UNSPECIFIED = 0;
80
+ */
81
+ McpEffect[McpEffect["UNSPECIFIED"] = 0] = "UNSPECIFIED";
82
+ /**
83
+ * @generated from enum value: MCP_EFFECT_READ_ONLY = 1;
84
+ */
85
+ McpEffect[McpEffect["READ_ONLY"] = 1] = "READ_ONLY";
86
+ /**
87
+ * @generated from enum value: MCP_EFFECT_WRITE = 2;
88
+ */
89
+ McpEffect[McpEffect["WRITE"] = 2] = "WRITE";
90
+ /**
91
+ * @generated from enum value: MCP_EFFECT_DESTRUCTIVE = 3;
92
+ */
93
+ McpEffect[McpEffect["DESTRUCTIVE"] = 3] = "DESTRUCTIVE";
94
+ })(McpEffect || (McpEffect = {}));
95
+ /**
96
+ * Describes the enum xeonr.platform.v1.McpEffect.
97
+ */
98
+ export const McpEffectSchema = /*@__PURE__*/ enumDesc(file_xeonr_platform_v1_options, 1);
99
+ /**
100
+ * no_authentication marks a method callable without a bearer token. A
101
+ * bearer that IS presented is still verified and, when valid, placed on the
102
+ * context — so a public method can render an owner's view — but an absent
103
+ * or invalid bearer does not reject the call. It MUST agree with the
104
+ * service's authn.Exempt list in main; §12.3(a) requires a test that it
105
+ * does.
106
+ *
107
+ * @generated from extension: bool no_authentication = 9900;
108
+ */
109
+ export const no_authentication = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 0);
110
+ /**
111
+ * require_scope names the scopes the caller's token must carry — all of
112
+ * them, unless one_of_scopes is set. Scopes are `<product>:<resource>:<verb>`
113
+ * with admin implying edit implying read within one resource family (§4.4),
114
+ * so a method requiring `x:y:read` is satisfied by `x:y:edit` or
115
+ * `x:y:admin` and the option never lists the weaker form. A missing scope
116
+ * is PermissionDenied. Absent on a method that is not no_authentication,
117
+ * any valid token of the right audience may call it.
118
+ *
119
+ * @generated from extension: repeated string require_scope = 9901;
120
+ */
121
+ export const require_scope = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 1);
122
+ /**
123
+ * one_of_scopes relaxes require_scope to "any one of these".
124
+ *
125
+ * @generated from extension: bool one_of_scopes = 9902;
126
+ */
127
+ export const one_of_scopes = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 2);
128
+ /**
129
+ * require_admin marks a method only a platform administrator may call. Who
130
+ * is an administrator is the product's decision: authn exposes this on
131
+ * Policy and the service's OnPrincipal hook (or its own interceptor)
132
+ * enforces it. The product MUST enforce it — an option nobody reads is a
133
+ * silent no-op, which is how auth/api's copy was found (finding #126).
134
+ *
135
+ * @generated from extension: bool require_admin = 9903;
136
+ */
137
+ export const require_admin = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 3);
138
+ /**
139
+ * allow_service_accounts marks a method a machine caller may invoke: a
140
+ * service account (urn:xeonr:auth:uid:service_account:…) or a client acting
141
+ * as itself (urn:xeonr:auth:client:…, client_credentials). Absent, such a
142
+ * subject is PermissionDenied — the default is that an API is for people,
143
+ * and the set of methods carrying this is the whole of what a machine
144
+ * credential can reach.
145
+ *
146
+ * @generated from extension: bool allow_service_accounts = 9904;
147
+ */
148
+ export const allow_service_accounts = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 4);
149
+ /**
150
+ * allow_automation_keys marks a method callable with an application
151
+ * automation key (Authorization: Bearer xak_…). Keys are not JWTs and
152
+ * never reach authn's verifier; the product that issues them reads this
153
+ * off Policy in its own interceptor. Absent everywhere the product does not
154
+ * issue keys.
155
+ *
156
+ * @generated from extension: bool allow_automation_keys = 9905;
157
+ */
158
+ export const allow_automation_keys = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 5);
159
+ /**
160
+ * audit_event names the trail sub-type recorded for this method by the
161
+ * trail SDK's interceptor (git.prod.wtf/xeonr/trail/sdk-go): the baseline
162
+ * event written after the handler returns, with the actor from the
163
+ * principal, the outcome from the error, and the target from the handler's
164
+ * annotations. Absent on a mutating method is a lint finding once the
165
+ * trail gate is enabled; absent on a read method is normal. The key is the
166
+ * project-local "<type>.<verb>" form ("database.created").
167
+ *
168
+ * @generated from extension: string audit_event = 9906;
169
+ */
170
+ export const audit_event = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 6);
171
+ /**
172
+ * audit_failure_event is recorded instead of audit_event when the handler
173
+ * returns an error, for the cases where a failure is a different kind of
174
+ * event ("login.failed" beside "login.succeeded"). Absent, a failure records
175
+ * audit_event with OUTCOME_FAILURE.
176
+ *
177
+ * @generated from extension: string audit_failure_event = 9907;
178
+ */
179
+ export const audit_failure_event = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 7);
180
+ /**
181
+ * audit_skip_success records only failures for this method: the handler
182
+ * emits the success itself (because it has to be inside the mutation's
183
+ * transaction, or because a success is high-frequency and coalesced).
184
+ *
185
+ * @generated from extension: bool audit_skip_success = 9908;
186
+ */
187
+ export const audit_skip_success = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 8);
188
+ /**
189
+ * allow_api_keys marks a method callable with a Xeonr Auth API key
190
+ * (Authorization: Bearer xk_…, or a product's registered legacy prefix).
191
+ * authn resolves the key through xeonr.auth.api.v1.ApiKeysService.VerifyApiKey
192
+ * and places a Principal whose Subject is the key's owner (or, for an
193
+ * identityless key, the key itself) on the context. A key is
194
+ * PermissionDenied on every method that does not carry this option, so
195
+ * the set of methods carrying it is the whole of what a key can reach.
196
+ * require_scope still applies: the key's scopes are the union of its
197
+ * key-level and binding scopes, and a BOUND key's per-resource check is the
198
+ * handler's job via Principal.ResourceAllowed.
199
+ *
200
+ * @generated from extension: bool allow_api_keys = 9909;
201
+ */
202
+ export const allow_api_keys = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 9);
203
+ /**
204
+ * mcp_tool publishes a unary RPC as an MCP tool.
205
+ *
206
+ * @generated from extension: xeonr.platform.v1.McpTool mcp_tool = 9910;
207
+ */
208
+ export const mcp_tool = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 10);
209
+ /**
210
+ * mcp_team marks the string field holding the team URN being acted on
211
+ * (urn:xeonr:auth:team:<uuid>). At most one per request message, top level.
212
+ * The gateway replaces it with its uniform `team` argument and writes the
213
+ * resolved URN into it.
214
+ *
215
+ * @generated from extension: bool mcp_team = 9900;
216
+ */
217
+ export const mcp_team = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 11);
218
+ /**
219
+ * mcp_hidden keeps a field out of the tool's input schema (idempotency
220
+ * keys, client hints); the gateway fills or omits it.
221
+ *
222
+ * @generated from extension: bool mcp_hidden = 9901;
223
+ */
224
+ export const mcp_hidden = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 12);
225
+ /**
226
+ * mcp_description is the field's description in the tool's JSON Schema,
227
+ * written for a model. Generated Go descriptors carry no comments, so this
228
+ * is how a field gets a description from the binary alone; without it mcpx
229
+ * falls back to the field's leading comment when the product hands it
230
+ * source info (mcpx.WithSourceInfo), and otherwise omits the description.
231
+ *
232
+ * @generated from extension: string mcp_description = 9902;
233
+ */
234
+ export const mcp_description = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 13);
235
+ //# sourceMappingURL=options_pb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options_pb.js","sourceRoot":"","sources":["../../../../../src/gen/xeonr/platform/v1/options_pb.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,kEAAkE;AAClE,EAAE;AACF,8EAA8E;AAC9E,0EAA0E;AAC1E,yEAAyE;AACzE,4EAA4E;AAC5E,+EAA+E;AAC/E,4EAA4E;AAC5E,kEAAkE;AAClE,2EAA2E;AAC3E,EAAE;AACF,2EAA2E;AAC3E,0DAA0D;AAC1D,EAAE;AACF,0EAA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,CAAC,8BAA8B,EAAE,CAAC,CAAC,CAAC;AAE7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAyC,aAAa,CACzE,OAAO,CAAC,8BAA8B,EAAE,EAAE,CAAC,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAwC,aAAa,CACxE,OAAO,CAAC,8BAA8B,EAAE,EAAE,CAAC,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAwC,aAAa,CAC1E,OAAO,CAAC,8BAA8B,EAAE,EAAE,CAAC,CAAC;AAE9C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAuC,aAAa,CAC9E,OAAO,CAAC,8BAA8B,EAAE,EAAE,CAAC,CAAC"}
@@ -0,0 +1,94 @@
1
+ import type { JsonObject, JsonValue, MessageInitShape } from "@bufbuild/protobuf";
2
+ import type { InputSlotSchema, OutputSlotSchema } from "./gen/xeonr/pipelines/v1/registry_pb.js";
3
+ /** The `<namespace>/<name>` pattern the contract holds handler names to. */
4
+ export declare const HANDLER_NAME: RegExp;
5
+ /** One attempt of a node, as the handler running it sees it. */
6
+ export interface AttemptInfo {
7
+ /** The attempt's id. Logs and the console address it. */
8
+ readonly id: string;
9
+ readonly runId: string;
10
+ readonly nodeId: string;
11
+ /** Counts the node's attempts from 1: above 1 this is a retry. */
12
+ readonly number: number;
13
+ /** The claim epoch this worker holds the attempt at. */
14
+ readonly claimEpoch: bigint;
15
+ /** The team the run belongs to. */
16
+ readonly tenant: string;
17
+ /** When the worker stops the handler, if the attempt has a timeout. */
18
+ readonly deadline: Date | undefined;
19
+ /** What the run is about, as the product described it. */
20
+ readonly resource: {
21
+ kind: string;
22
+ id: string;
23
+ json: JsonObject | undefined;
24
+ } | undefined;
25
+ /** The run's attested facts and variables. Context only. */
26
+ readonly attestedFacts: JsonObject | undefined;
27
+ readonly variables: JsonObject | undefined;
28
+ }
29
+ /** Writes to the attempt's log in pipelines (shown in the console). */
30
+ export interface AttemptLogger {
31
+ info(message: string, fields?: Record<string, unknown>): void;
32
+ warn(message: string, fields?: Record<string, unknown>): void;
33
+ error(message: string, fields?: Record<string, unknown>): void;
34
+ /** Appends raw text as is. */
35
+ write(text: string): void;
36
+ }
37
+ /** What a handler is given. */
38
+ export interface HandlerContext<I> {
39
+ /** The handler's inputs (the job's payload), parsed by `parseInput` when given. */
40
+ readonly input: I;
41
+ /**
42
+ * Fires when the handler must stop: the run was cancelled, the deadline
43
+ * passed, the lease was lost, or the worker is shutting down. Its `reason`
44
+ * is an {@link AttemptAbortedError} saying which. Pass it to anything
45
+ * cancellable (`fetch`, database drivers).
46
+ */
47
+ readonly signal: AbortSignal;
48
+ readonly attempt: AttemptInfo;
49
+ /** The attempt's log in pipelines. */
50
+ readonly log: AttemptLogger;
51
+ }
52
+ /** kv outputs a handler returns, by output slot. */
53
+ export type HandlerOutputs = Record<string, JsonValue>;
54
+ /** A worker handler: its registry identity, manifest and code. */
55
+ export interface HandlerDefinition<I = JsonObject, O extends HandlerOutputs | void = HandlerOutputs | void> {
56
+ /** `<namespace>/<name>`; the namespace is the owning team's. */
57
+ readonly name: string;
58
+ /**
59
+ * The version published to the registry at boot. Versions are immutable:
60
+ * change the manifest, bump the version. Runs pin the newest READY version
61
+ * when they are created.
62
+ */
63
+ readonly version: string;
64
+ readonly description?: string;
65
+ /** The manifest's inputs (kv slots, with JSON Schemas the platform checks). */
66
+ readonly inputs?: MessageInitShape<typeof InputSlotSchema>[];
67
+ /** The manifest's outputs (kv slots). */
68
+ readonly outputs?: MessageInitShape<typeof OutputSlotSchema>[];
69
+ /** Resource kinds the handler accepts; empty accepts any. */
70
+ readonly resourceKinds?: string[];
71
+ readonly readmeMd?: string;
72
+ /**
73
+ * The most attempts of this handler one worker process runs at once.
74
+ * Default: the worker's overall concurrency.
75
+ */
76
+ readonly concurrency?: number;
77
+ /**
78
+ * Turns the raw payload into the handler's typed input (a zod `parse`, for
79
+ * example). A throw fails the attempt as a handler error.
80
+ */
81
+ readonly parseInput?: (raw: JsonObject) => I;
82
+ /**
83
+ * The handler. Return the kv outputs (or nothing). A throw or a rejection
84
+ * fails this attempt with `FAILURE_CLASS_HANDLER_ERROR`; it never takes
85
+ * the process down.
86
+ */
87
+ readonly run: (ctx: HandlerContext<I>) => Promise<O> | O;
88
+ }
89
+ /**
90
+ * Defines a handler with its types inferred. It only checks the definition;
91
+ * register it with `worker.handle`.
92
+ */
93
+ export declare function defineHandler<I = JsonObject, O extends HandlerOutputs | void = HandlerOutputs | void>(def: HandlerDefinition<I, O>): HandlerDefinition<I, O>;
94
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAEjG,4EAA4E;AAC5E,eAAO,MAAM,YAAY,QAAuD,CAAC;AAGjF,gEAAgE;AAChE,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,mCAAmC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;IACpC,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAA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;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC,OAAO,eAAe,CAAC,EAAE,CAAC;IAC7D,yCAAyC;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC,OAAO,gBAAgB,CAAC,EAAE,CAAC;IAC/D,6DAA6D;IAC7D,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,CAAC,CAAC;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAC1D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,GAAG,UAAU,EAAE,CAAC,SAAS,cAAc,GAAG,IAAI,GAAG,cAAc,GAAG,IAAI,EACnG,GAAG,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC3B,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,CAOzB"}
@@ -0,0 +1,18 @@
1
+ /** The `<namespace>/<name>` pattern the contract holds handler names to. */
2
+ export const HANDLER_NAME = /^[a-z0-9][a-z0-9-]{0,62}\/[a-z0-9][a-z0-9-]{0,62}$/;
3
+ const VERSION = /^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$/;
4
+ /**
5
+ * Defines a handler with its types inferred. It only checks the definition;
6
+ * register it with `worker.handle`.
7
+ */
8
+ export function defineHandler(def) {
9
+ if (!HANDLER_NAME.test(def.name))
10
+ throw new TypeError(`defineHandler: ${JSON.stringify(def.name)} is not <namespace>/<name>`);
11
+ if (!VERSION.test(def.version))
12
+ throw new TypeError(`defineHandler: ${JSON.stringify(def.version)} is not a semantic version`);
13
+ if (def.concurrency !== undefined && (!Number.isInteger(def.concurrency) || def.concurrency < 1)) {
14
+ throw new TypeError("defineHandler: concurrency must be a positive integer");
15
+ }
16
+ return def;
17
+ }
18
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAGA,4EAA4E;AAC5E,MAAM,CAAC,MAAM,YAAY,GAAG,oDAAoD,CAAC;AACjF,MAAM,OAAO,GAAG,4CAA4C,CAAC;AAuF7D;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,GAA4B;IAE5B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;IAC9H,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAC/H,IAAI,GAAG,CAAC,WAAW,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,WAAW,GAAG,CAAC,CAAC,EAAE,CAAC;QACjG,MAAM,IAAI,SAAS,CAAC,uDAAuD,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @xeonr/pipelines-sdk: the TypeScript SDK for xeonr pipelines.
3
+ *
4
+ * - {@link PipelinesClient}: start runs and enqueue jobs on the public API
5
+ * (`CreateRun`, `CreateJob`), read and cancel them.
6
+ * - {@link Worker}: run a product's handlers inside its own Node.js process,
7
+ * claiming its attempts from pipelines-api (`WorkerService`).
8
+ * - {@link jwtBearer}: the product's Auth service-account token, cached and
9
+ * refreshed single-flight.
10
+ *
11
+ * The generated messages are under `@xeonr/pipelines-sdk/gen/*`, and an
12
+ * in-memory fake for unit tests under `@xeonr/pipelines-sdk/testing`.
13
+ */
14
+ export { jwtBearer, tokenSource } from "./auth.js";
15
+ export type { JwtBearerOptions, JwtBearerTokenProvider, TokenProvider, TokenSource } from "./auth.js";
16
+ export { PipelinesClient } from "./client.js";
17
+ export type { CreateJobInput, CreatedRun, CreateRunInput, ListRunsInput, PipelinesClientOptions } from "./client.js";
18
+ export { AttemptAbortedError, errorKind, PipelinesAuthError, WorkerStartError } from "./errors.js";
19
+ export type { ErrorKind } from "./errors.js";
20
+ export { defineHandler, HANDLER_NAME } from "./handler.js";
21
+ export type { AttemptInfo, AttemptLogger, HandlerContext, HandlerDefinition, HandlerOutputs } from "./handler.js";
22
+ export { authInterceptor, createPipelinesTransport } from "./transport.js";
23
+ export type { Connection, PipelinesTransportOptions } from "./transport.js";
24
+ export { consoleLogger, Worker } from "./worker.js";
25
+ export type { StopOptions, WorkerLogger, WorkerOptions, WorkerState, WorkerStats } from "./worker.js";
26
+ export { AttemptState, FailureClass, NodeState, RunState, Termination } from "./gen/xeonr/pipelines/v1/common_pb.js";
27
+ export { Visibility, SlotType } from "./gen/xeonr/pipelines/v1/registry_pb.js";
28
+ export type { Run, NodeRun, Attempt } from "./gen/xeonr/pipelines/v1/runs_pb.js";
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,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queue jobs on the public API
5
+ * (`CreateRun`, `CreateJob`), read and cancel them.
6
+ * - {@link Worker}: run a product's handlers inside its own Node.js process,
7
+ * claiming its attempts from pipelines-api (`WorkerService`).
8
+ * - {@link jwtBearer}: the product's Auth service-account token, cached and
9
+ * refreshed single-flight.
10
+ *
11
+ * The generated messages are under `@xeonr/pipelines-sdk/gen/*`, and an
12
+ * in-memory fake for unit tests under `@xeonr/pipelines-sdk/testing`.
13
+ */
14
+ export { jwtBearer, tokenSource } from "./auth.js";
15
+ export { PipelinesClient } from "./client.js";
16
+ export { AttemptAbortedError, errorKind, PipelinesAuthError, WorkerStartError } from "./errors.js";
17
+ export { defineHandler, HANDLER_NAME } from "./handler.js";
18
+ export { authInterceptor, createPipelinesTransport } from "./transport.js";
19
+ export { consoleLogger, Worker } from "./worker.js";
20
+ // The contract's vocabulary, re-exported for convenience.
21
+ export { AttemptState, FailureClass, NodeState, RunState, Termination } from "./gen/xeonr/pipelines/v1/common_pb.js";
22
+ export { Visibility, SlotType } from "./gen/xeonr/pipelines/v1/registry_pb.js";
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEnG,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEpD,0DAA0D;AAC1D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACrH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Sleeps for `ms`, or until `signal` aborts. Resolves true when the time
3
+ * passed and false when it was aborted; never rejects.
4
+ */
5
+ export declare function sleep(ms: number, signal?: AbortSignal): Promise<boolean>;
6
+ /** The next exponential backoff delay with full jitter on the upper half. */
7
+ export declare function backoff(previous: number, min: number, max: number): number;
8
+ //# sourceMappingURL=time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/internal/time.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAaxE;AAED,6EAA6E;AAC7E,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAG1E"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Sleeps for `ms`, or until `signal` aborts. Resolves true when the time
3
+ * passed and false when it was aborted; never rejects.
4
+ */
5
+ export function sleep(ms, signal) {
6
+ if (signal?.aborted)
7
+ return Promise.resolve(false);
8
+ return new Promise((resolve) => {
9
+ const onAbort = () => {
10
+ clearTimeout(t);
11
+ resolve(false);
12
+ };
13
+ const t = setTimeout(() => {
14
+ signal?.removeEventListener("abort", onAbort);
15
+ resolve(true);
16
+ }, Math.max(0, ms));
17
+ signal?.addEventListener("abort", onAbort, { once: true });
18
+ });
19
+ }
20
+ /** The next exponential backoff delay with full jitter on the upper half. */
21
+ export function backoff(previous, min, max) {
22
+ const next = previous <= 0 ? min : Math.min(previous * 2, max);
23
+ return next / 2 + Math.random() * (next / 2);
24
+ }
25
+ //# sourceMappingURL=time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.js","sourceRoot":"","sources":["../../src/internal/time.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAC,EAAU,EAAE,MAAoB;IACpD,IAAI,MAAM,EAAE,OAAO;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,YAAY,CAAC,CAAC,CAAC,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,CAAC;QACF,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,EAAE;YACxB,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC9C,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QACpB,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,OAAO,CAAC,QAAgB,EAAE,GAAW,EAAE,GAAW;IAChE,MAAM,IAAI,GAAG,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAC/D,OAAO,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,67 @@
1
+ /** Where an attempt's chunks go: WorkerService.AppendLogs for one attempt. */
2
+ export type LogSink = (seq: bigint, data: Uint8Array, final: boolean, signal: AbortSignal) => Promise<{
3
+ nextSeq: bigint;
4
+ truncated: boolean;
5
+ }>;
6
+ /** Options for a LogShipper. */
7
+ export interface LogShipperOptions {
8
+ /** Most bytes in one chunk (the API takes 1 MiB). Default 256 KiB. */
9
+ maxChunk?: number;
10
+ /** How long output waits before a part-full chunk is sent. Default 500 ms. */
11
+ flushIntervalMs?: number;
12
+ /**
13
+ * Most bytes held while the API is slow or down. A handler's log calls
14
+ * cannot block, so past this, output is dropped and a marker says how
15
+ * much. Default 8 MiB.
16
+ */
17
+ maxBuffered?: number;
18
+ /** The attempt's log cap (ClaimedAttempt.log_max_bytes); 0 is none. */
19
+ maxBytes?: number;
20
+ /** Told when the attempt is lost (failed_precondition). */
21
+ onLost?: () => void;
22
+ /** Told of each failed send. */
23
+ onRetry?: (err: unknown) => void;
24
+ }
25
+ /**
26
+ * Ships one attempt's log, in the runner's way (pkg/logship): chunks are
27
+ * numbered from 0 without gaps, each sent until acknowledged before the next,
28
+ * so a retry after a lost reply cannot duplicate or reorder anything; the
29
+ * last chunk carries `final`.
30
+ *
31
+ * - `failed_precondition`: the attempt is lost; shipping stops and `onLost`
32
+ * is told.
33
+ * - `out_of_range` (or any other final code): not fatal to the attempt;
34
+ * shipping stops and the rest of the log is dropped.
35
+ * - The server's `truncated`: the log is at its cap; shipping stops.
36
+ * - Anything else is retried with backoff.
37
+ */
38
+ export declare class LogShipper {
39
+ private readonly sink;
40
+ private readonly opt;
41
+ private pending;
42
+ private pendingBytes;
43
+ private total;
44
+ private dropped;
45
+ private capped;
46
+ private stopped;
47
+ private closing;
48
+ private seq;
49
+ private wake;
50
+ private readonly done;
51
+ private readonly abort;
52
+ constructor(sink: LogSink, opt?: LogShipperOptions);
53
+ /** Queues text. Never blocks. */
54
+ write(text: string): void;
55
+ /**
56
+ * Ends the log with `trailer` and waits until the final chunk is
57
+ * acknowledged, shipping stops, or `timeoutMs` passes.
58
+ */
59
+ close(trailer: string, timeoutMs: number): Promise<void>;
60
+ /** Stops shipping at once; nothing more is sent. */
61
+ stop(): void;
62
+ private take;
63
+ private run;
64
+ /** Sends one chunk until acknowledged. False means shipping has stopped. */
65
+ private send;
66
+ }
67
+ //# sourceMappingURL=logship.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logship.d.ts","sourceRoot":"","sources":["../src/logship.ts"],"names":[],"mappings":"AAGA,8EAA8E;AAC9E,MAAM,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAE/I,gCAAgC;AAChC,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,gCAAgC;IAChC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CAClC;AAID;;;;;;;;;;;;GAYG;AACH,qBAAa,UAAU;IAkBnB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAjBvB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAGlB;IACF,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,GAAG,CAAM;IACjB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