@atom-workflow-agent/contracts 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 (108) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +31 -0
  3. package/README.zh-CN.md +31 -0
  4. package/dist/atoms/agent.d.ts +29 -0
  5. package/dist/atoms/agent.d.ts.map +1 -0
  6. package/dist/atoms/agent.js +22 -0
  7. package/dist/atoms/agent.js.map +1 -0
  8. package/dist/atoms/descriptors.d.ts +88 -0
  9. package/dist/atoms/descriptors.d.ts.map +1 -0
  10. package/dist/atoms/descriptors.js +56 -0
  11. package/dist/atoms/descriptors.js.map +1 -0
  12. package/dist/atoms/host.d.ts +200 -0
  13. package/dist/atoms/host.d.ts.map +1 -0
  14. package/dist/atoms/host.js +109 -0
  15. package/dist/atoms/host.js.map +1 -0
  16. package/dist/atoms/lifecycle.d.ts +257 -0
  17. package/dist/atoms/lifecycle.d.ts.map +1 -0
  18. package/dist/atoms/lifecycle.js +201 -0
  19. package/dist/atoms/lifecycle.js.map +1 -0
  20. package/dist/atoms/manifest.d.ts +68 -0
  21. package/dist/atoms/manifest.d.ts.map +1 -0
  22. package/dist/atoms/manifest.js +144 -0
  23. package/dist/atoms/manifest.js.map +1 -0
  24. package/dist/atoms/package.d.ts +11 -0
  25. package/dist/atoms/package.d.ts.map +1 -0
  26. package/dist/atoms/package.js +11 -0
  27. package/dist/atoms/package.js.map +1 -0
  28. package/dist/errors/atom-workflow-error.d.ts +7 -0
  29. package/dist/errors/atom-workflow-error.d.ts.map +1 -0
  30. package/dist/errors/atom-workflow-error.js +21 -0
  31. package/dist/errors/atom-workflow-error.js.map +1 -0
  32. package/dist/index.d.ts +25 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +25 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/json-schema/validate-instance.d.ts +7 -0
  37. package/dist/json-schema/validate-instance.d.ts.map +1 -0
  38. package/dist/json-schema/validate-instance.js +186 -0
  39. package/dist/json-schema/validate-instance.js.map +1 -0
  40. package/dist/planner/plan-record.d.ts +194 -0
  41. package/dist/planner/plan-record.d.ts.map +1 -0
  42. package/dist/planner/plan-record.js +57 -0
  43. package/dist/planner/plan-record.js.map +1 -0
  44. package/dist/planner/planner-draft.d.ts +194 -0
  45. package/dist/planner/planner-draft.d.ts.map +1 -0
  46. package/dist/planner/planner-draft.js +102 -0
  47. package/dist/planner/planner-draft.js.map +1 -0
  48. package/dist/planner/planner-validation.d.ts +830 -0
  49. package/dist/planner/planner-validation.d.ts.map +1 -0
  50. package/dist/planner/planner-validation.js +52 -0
  51. package/dist/planner/planner-validation.js.map +1 -0
  52. package/dist/planner/planner.d.ts +456 -0
  53. package/dist/planner/planner.d.ts.map +1 -0
  54. package/dist/planner/planner.js +85 -0
  55. package/dist/planner/planner.js.map +1 -0
  56. package/dist/planner/planning-capability.d.ts +576 -0
  57. package/dist/planner/planning-capability.d.ts.map +1 -0
  58. package/dist/planner/planning-capability.js +105 -0
  59. package/dist/planner/planning-capability.js.map +1 -0
  60. package/dist/planner/planning-workspace.d.ts +1791 -0
  61. package/dist/planner/planning-workspace.d.ts.map +1 -0
  62. package/dist/planner/planning-workspace.js +279 -0
  63. package/dist/planner/planning-workspace.js.map +1 -0
  64. package/dist/runtime/diagnostics.d.ts +35 -0
  65. package/dist/runtime/diagnostics.d.ts.map +1 -0
  66. package/dist/runtime/diagnostics.js +22 -0
  67. package/dist/runtime/diagnostics.js.map +1 -0
  68. package/dist/runtime/machine.d.ts +52 -0
  69. package/dist/runtime/machine.d.ts.map +1 -0
  70. package/dist/runtime/machine.js +41 -0
  71. package/dist/runtime/machine.js.map +1 -0
  72. package/dist/runtime/records.d.ts +306 -0
  73. package/dist/runtime/records.d.ts.map +1 -0
  74. package/dist/runtime/records.js +213 -0
  75. package/dist/runtime/records.js.map +1 -0
  76. package/dist/runtime/resume.d.ts +32 -0
  77. package/dist/runtime/resume.d.ts.map +1 -0
  78. package/dist/runtime/resume.js +19 -0
  79. package/dist/runtime/resume.js.map +1 -0
  80. package/dist/workflows/ir.d.ts +117 -0
  81. package/dist/workflows/ir.d.ts.map +1 -0
  82. package/dist/workflows/ir.js +2 -0
  83. package/dist/workflows/ir.js.map +1 -0
  84. package/dist/workflows/policy.d.ts +22 -0
  85. package/dist/workflows/policy.d.ts.map +1 -0
  86. package/dist/workflows/policy.js +22 -0
  87. package/dist/workflows/policy.js.map +1 -0
  88. package/dist/workflows/revision.d.ts +187 -0
  89. package/dist/workflows/revision.d.ts.map +1 -0
  90. package/dist/workflows/revision.js +61 -0
  91. package/dist/workflows/revision.js.map +1 -0
  92. package/dist/workflows/spec.d.ts +427 -0
  93. package/dist/workflows/spec.d.ts.map +1 -0
  94. package/dist/workflows/spec.js +86 -0
  95. package/dist/workflows/spec.js.map +1 -0
  96. package/dist/workflows/topology.d.ts +58 -0
  97. package/dist/workflows/topology.d.ts.map +1 -0
  98. package/dist/workflows/topology.js +37 -0
  99. package/dist/workflows/topology.js.map +1 -0
  100. package/dist/workflows/validation.d.ts +247 -0
  101. package/dist/workflows/validation.d.ts.map +1 -0
  102. package/dist/workflows/validation.js +130 -0
  103. package/dist/workflows/validation.js.map +1 -0
  104. package/dist/workflows/visualization.d.ts +526 -0
  105. package/dist/workflows/visualization.d.ts.map +1 -0
  106. package/dist/workflows/visualization.js +132 -0
  107. package/dist/workflows/visualization.js.map +1 -0
  108. package/package.json +48 -0
@@ -0,0 +1,200 @@
1
+ import { z } from "zod";
2
+ export declare const HostContinuationSchema: z.ZodObject<{
3
+ schemaVersion: z.ZodLiteral<"1.0">;
4
+ token: z.ZodString;
5
+ nonce: z.ZodString;
6
+ runId: z.ZodString;
7
+ workflowRevisionId: z.ZodString;
8
+ nodeId: z.ZodString;
9
+ activationId: z.ZodString;
10
+ attemptId: z.ZodString;
11
+ hostTaskId: z.ZodString;
12
+ workflowIrHash: z.ZodString;
13
+ outputSchemaHash: z.ZodString;
14
+ projectScope: z.ZodString;
15
+ hostScope: z.ZodString;
16
+ createdAt: z.ZodString;
17
+ expiresAt: z.ZodOptional<z.ZodString>;
18
+ }, z.core.$strict>;
19
+ export type HostContinuation = z.infer<typeof HostContinuationSchema>;
20
+ export declare const HostTaskRequestSchema: z.ZodObject<{
21
+ schemaVersion: z.ZodLiteral<"1.0">;
22
+ hostTaskId: z.ZodString;
23
+ atom: z.ZodObject<{
24
+ id: z.ZodString;
25
+ version: z.ZodString;
26
+ }, z.core.$strict>;
27
+ runId: z.ZodString;
28
+ workflowRevisionId: z.ZodString;
29
+ nodeId: z.ZodString;
30
+ activationId: z.ZodString;
31
+ attemptId: z.ZodString;
32
+ instruction: z.ZodString;
33
+ input: z.ZodType<import("./manifest.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("./manifest.js").JsonValue, unknown>>;
34
+ context: z.ZodType<import("./manifest.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("./manifest.js").JsonValue, unknown>>;
35
+ artifacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
36
+ id: z.ZodString;
37
+ kind: z.ZodString;
38
+ hash: z.ZodOptional<z.ZodString>;
39
+ }, z.core.$strict>>>;
40
+ expected: z.ZodObject<{
41
+ outputSchema: z.ZodRecord<z.ZodString, z.ZodType<import("./manifest.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("./manifest.js").JsonValue, unknown>>>;
42
+ }, z.core.$strict>;
43
+ projectScope: z.ZodString;
44
+ hostScope: z.ZodString;
45
+ resume: z.ZodObject<{
46
+ schemaVersion: z.ZodLiteral<"1.0">;
47
+ runId: z.ZodString;
48
+ instruction: z.ZodString;
49
+ command: z.ZodLiteral<"resume-host">;
50
+ hostTaskId: z.ZodString;
51
+ }, z.core.$strict>;
52
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<import("./manifest.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("./manifest.js").JsonValue, unknown>>>>;
53
+ continuation: z.ZodObject<{
54
+ schemaVersion: z.ZodLiteral<"1.0">;
55
+ token: z.ZodString;
56
+ nonce: z.ZodString;
57
+ runId: z.ZodString;
58
+ workflowRevisionId: z.ZodString;
59
+ nodeId: z.ZodString;
60
+ activationId: z.ZodString;
61
+ attemptId: z.ZodString;
62
+ hostTaskId: z.ZodString;
63
+ workflowIrHash: z.ZodString;
64
+ outputSchemaHash: z.ZodString;
65
+ projectScope: z.ZodString;
66
+ hostScope: z.ZodString;
67
+ createdAt: z.ZodString;
68
+ expiresAt: z.ZodOptional<z.ZodString>;
69
+ }, z.core.$strict>;
70
+ }, z.core.$strict>;
71
+ export type HostTaskRequest = z.infer<typeof HostTaskRequestSchema>;
72
+ export declare const HostTaskResultSchema: z.ZodObject<{
73
+ schemaVersion: z.ZodLiteral<"1.0">;
74
+ output: z.ZodType<import("./manifest.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("./manifest.js").JsonValue, unknown>>;
75
+ artifacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
76
+ id: z.ZodString;
77
+ kind: z.ZodString;
78
+ hash: z.ZodOptional<z.ZodString>;
79
+ }, z.core.$strict>>>;
80
+ summary: z.ZodString;
81
+ }, z.core.$strict>;
82
+ export type HostTaskResult = z.infer<typeof HostTaskResultSchema>;
83
+ export declare const HostTaskResumeRequestSchema: z.ZodObject<{
84
+ schemaVersion: z.ZodLiteral<"1.0">;
85
+ hostTaskId: z.ZodString;
86
+ continuationToken: z.ZodString;
87
+ projectScope: z.ZodString;
88
+ hostScope: z.ZodString;
89
+ result: z.ZodObject<{
90
+ schemaVersion: z.ZodLiteral<"1.0">;
91
+ output: z.ZodType<import("./manifest.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("./manifest.js").JsonValue, unknown>>;
92
+ artifacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
93
+ id: z.ZodString;
94
+ kind: z.ZodString;
95
+ hash: z.ZodOptional<z.ZodString>;
96
+ }, z.core.$strict>>>;
97
+ summary: z.ZodString;
98
+ }, z.core.$strict>;
99
+ }, z.core.$strict>;
100
+ export type HostTaskResumeRequest = z.infer<typeof HostTaskResumeRequestSchema>;
101
+ export declare const HostTaskStatusSchema: z.ZodEnum<{
102
+ cancelled: "cancelled";
103
+ waiting: "waiting";
104
+ consumed: "consumed";
105
+ expired: "expired";
106
+ }>;
107
+ export type HostTaskStatus = z.infer<typeof HostTaskStatusSchema>;
108
+ export declare const HostTaskRecordSchema: z.ZodObject<{
109
+ schemaVersion: z.ZodLiteral<"1.0">;
110
+ request: z.ZodObject<{
111
+ schemaVersion: z.ZodLiteral<"1.0">;
112
+ hostTaskId: z.ZodString;
113
+ atom: z.ZodObject<{
114
+ id: z.ZodString;
115
+ version: z.ZodString;
116
+ }, z.core.$strict>;
117
+ runId: z.ZodString;
118
+ workflowRevisionId: z.ZodString;
119
+ nodeId: z.ZodString;
120
+ activationId: z.ZodString;
121
+ attemptId: z.ZodString;
122
+ instruction: z.ZodString;
123
+ input: z.ZodType<import("./manifest.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("./manifest.js").JsonValue, unknown>>;
124
+ context: z.ZodType<import("./manifest.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("./manifest.js").JsonValue, unknown>>;
125
+ artifacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
126
+ id: z.ZodString;
127
+ kind: z.ZodString;
128
+ hash: z.ZodOptional<z.ZodString>;
129
+ }, z.core.$strict>>>;
130
+ expected: z.ZodObject<{
131
+ outputSchema: z.ZodRecord<z.ZodString, z.ZodType<import("./manifest.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("./manifest.js").JsonValue, unknown>>>;
132
+ }, z.core.$strict>;
133
+ projectScope: z.ZodString;
134
+ hostScope: z.ZodString;
135
+ resume: z.ZodObject<{
136
+ schemaVersion: z.ZodLiteral<"1.0">;
137
+ runId: z.ZodString;
138
+ instruction: z.ZodString;
139
+ command: z.ZodLiteral<"resume-host">;
140
+ hostTaskId: z.ZodString;
141
+ }, z.core.$strict>;
142
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<import("./manifest.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("./manifest.js").JsonValue, unknown>>>>;
143
+ continuation: z.ZodObject<{
144
+ schemaVersion: z.ZodLiteral<"1.0">;
145
+ token: z.ZodString;
146
+ nonce: z.ZodString;
147
+ runId: z.ZodString;
148
+ workflowRevisionId: z.ZodString;
149
+ nodeId: z.ZodString;
150
+ activationId: z.ZodString;
151
+ attemptId: z.ZodString;
152
+ hostTaskId: z.ZodString;
153
+ workflowIrHash: z.ZodString;
154
+ outputSchemaHash: z.ZodString;
155
+ projectScope: z.ZodString;
156
+ hostScope: z.ZodString;
157
+ createdAt: z.ZodString;
158
+ expiresAt: z.ZodOptional<z.ZodString>;
159
+ }, z.core.$strict>;
160
+ }, z.core.$strict>;
161
+ declaration: z.ZodObject<{
162
+ schemaVersion: z.ZodLiteral<"1.0">;
163
+ instruction: z.ZodString;
164
+ context: z.ZodDefault<z.ZodType<import("./manifest.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("./manifest.js").JsonValue, unknown>>>;
165
+ artifacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
166
+ id: z.ZodString;
167
+ kind: z.ZodString;
168
+ hash: z.ZodOptional<z.ZodString>;
169
+ }, z.core.$strict>>>;
170
+ responseSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./manifest.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("./manifest.js").JsonValue, unknown>>>>;
171
+ requireSameProject: z.ZodDefault<z.ZodLiteral<true>>;
172
+ expiresInMs: z.ZodOptional<z.ZodNumber>;
173
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<import("./manifest.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("./manifest.js").JsonValue, unknown>>>>;
174
+ }, z.core.$strict>;
175
+ status: z.ZodEnum<{
176
+ cancelled: "cancelled";
177
+ waiting: "waiting";
178
+ consumed: "consumed";
179
+ expired: "expired";
180
+ }>;
181
+ consumedAt: z.ZodOptional<z.ZodString>;
182
+ cancelledAt: z.ZodOptional<z.ZodString>;
183
+ result: z.ZodOptional<z.ZodObject<{
184
+ schemaVersion: z.ZodLiteral<"1.0">;
185
+ output: z.ZodType<import("./manifest.js").JsonValue, unknown, z.core.$ZodTypeInternals<import("./manifest.js").JsonValue, unknown>>;
186
+ artifacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
187
+ id: z.ZodString;
188
+ kind: z.ZodString;
189
+ hash: z.ZodOptional<z.ZodString>;
190
+ }, z.core.$strict>>>;
191
+ summary: z.ZodString;
192
+ }, z.core.$strict>>;
193
+ }, z.core.$strict>;
194
+ export type HostTaskRecord = z.infer<typeof HostTaskRecordSchema>;
195
+ export declare const HostTaskArtifactListSchema: z.ZodArray<z.ZodObject<{
196
+ id: z.ZodString;
197
+ kind: z.ZodString;
198
+ hash: z.ZodOptional<z.ZodString>;
199
+ }, z.core.$strict>>;
200
+ //# sourceMappingURL=host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/atoms/host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgBxB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;kBAoBjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAyChC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,oBAAoB;;;;;;;;;kBAKtB,CAAC;AACZ,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;kBAO7B,CAAC;AACZ,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,oBAAoB;;;;;EAA0D,CAAC;AAC5F,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAqB/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,0BAA0B;;;;mBAAuC,CAAC"}
@@ -0,0 +1,109 @@
1
+ import { z } from "zod";
2
+ import { AtomArtifactReferenceSchema, AtomHostTaskDeclarationSchema, } from "./lifecycle.js";
3
+ import { JsonSchemaSchema, JsonValueSchema, SemanticVersionSchema, AtomIdSchema, } from "./manifest.js";
4
+ import { HostResumeDirectiveSchema } from "../runtime/resume.js";
5
+ const HashSchema = z.string().regex(/^sha256:[a-f0-9]{64}$/);
6
+ const TimestampSchema = z.string().datetime({ offset: true });
7
+ export const HostContinuationSchema = z.object({
8
+ schemaVersion: z.literal("1.0"),
9
+ token: z.string().regex(/^[A-Za-z0-9_-]{32,}$/),
10
+ nonce: z.string().regex(/^[A-Za-z0-9_-]{16,}$/),
11
+ runId: z.string().trim().min(1),
12
+ workflowRevisionId: z.string().trim().min(1),
13
+ nodeId: z.string().trim().min(1),
14
+ activationId: z.string().trim().min(1),
15
+ attemptId: z.string().trim().min(1),
16
+ hostTaskId: z.string().trim().min(1),
17
+ workflowIrHash: HashSchema,
18
+ outputSchemaHash: HashSchema,
19
+ projectScope: z.string().trim().min(1),
20
+ hostScope: z.string().trim().min(1),
21
+ createdAt: TimestampSchema,
22
+ expiresAt: TimestampSchema.optional(),
23
+ }).strict().superRefine((continuation, context) => {
24
+ if (continuation.expiresAt && Date.parse(continuation.expiresAt) <= Date.parse(continuation.createdAt)) {
25
+ context.addIssue({ code: "custom", path: ["expiresAt"], message: "Continuation expiry must be after creation" });
26
+ }
27
+ });
28
+ export const HostTaskRequestSchema = z.object({
29
+ schemaVersion: z.literal("1.0"),
30
+ hostTaskId: z.string().trim().min(1),
31
+ atom: z.object({ id: AtomIdSchema, version: SemanticVersionSchema }).strict(),
32
+ runId: z.string().trim().min(1),
33
+ workflowRevisionId: z.string().trim().min(1),
34
+ nodeId: z.string().trim().min(1),
35
+ activationId: z.string().trim().min(1),
36
+ attemptId: z.string().trim().min(1),
37
+ instruction: z.string().trim().min(1),
38
+ input: JsonValueSchema,
39
+ context: JsonValueSchema,
40
+ artifacts: z.array(AtomArtifactReferenceSchema).default([]),
41
+ expected: z.object({
42
+ outputSchema: JsonSchemaSchema,
43
+ }).strict(),
44
+ projectScope: z.string().trim().min(1),
45
+ hostScope: z.string().trim().min(1),
46
+ resume: HostResumeDirectiveSchema,
47
+ metadata: z.record(z.string(), JsonValueSchema).default({}),
48
+ continuation: HostContinuationSchema,
49
+ }).strict().superRefine((request, context) => {
50
+ const bindings = [
51
+ ["hostTaskId", request.hostTaskId, request.continuation.hostTaskId],
52
+ ["runId", request.runId, request.continuation.runId],
53
+ ["workflowRevisionId", request.workflowRevisionId, request.continuation.workflowRevisionId],
54
+ ["nodeId", request.nodeId, request.continuation.nodeId],
55
+ ["activationId", request.activationId, request.continuation.activationId],
56
+ ["attemptId", request.attemptId, request.continuation.attemptId],
57
+ ["projectScope", request.projectScope, request.continuation.projectScope],
58
+ ["hostScope", request.hostScope, request.continuation.hostScope],
59
+ ];
60
+ for (const [field, outer, bound] of bindings) {
61
+ if (outer !== bound)
62
+ context.addIssue({ code: "custom", path: ["continuation", field], message: `${field} does not match its Continuation binding` });
63
+ }
64
+ if (request.resume.runId !== request.runId) {
65
+ context.addIssue({ code: "custom", path: ["resume", "runId"], message: "resume.runId does not match the HostTask runId" });
66
+ }
67
+ if (request.resume.hostTaskId !== request.hostTaskId) {
68
+ context.addIssue({ code: "custom", path: ["resume", "hostTaskId"], message: "resume.hostTaskId does not match the HostTask id" });
69
+ }
70
+ });
71
+ export const HostTaskResultSchema = z.object({
72
+ schemaVersion: z.literal("1.0"),
73
+ output: JsonValueSchema,
74
+ artifacts: z.array(AtomArtifactReferenceSchema).default([]),
75
+ summary: z.string().trim().min(1),
76
+ }).strict();
77
+ export const HostTaskResumeRequestSchema = z.object({
78
+ schemaVersion: z.literal("1.0"),
79
+ hostTaskId: z.string().trim().min(1),
80
+ continuationToken: z.string().regex(/^[A-Za-z0-9_-]{32,}$/),
81
+ projectScope: z.string().trim().min(1),
82
+ hostScope: z.string().trim().min(1),
83
+ result: HostTaskResultSchema,
84
+ }).strict();
85
+ export const HostTaskStatusSchema = z.enum(["waiting", "consumed", "cancelled", "expired"]);
86
+ export const HostTaskRecordSchema = z.object({
87
+ schemaVersion: z.literal("1.0"),
88
+ request: HostTaskRequestSchema,
89
+ declaration: AtomHostTaskDeclarationSchema,
90
+ status: HostTaskStatusSchema,
91
+ consumedAt: TimestampSchema.optional(),
92
+ cancelledAt: TimestampSchema.optional(),
93
+ result: HostTaskResultSchema.optional(),
94
+ }).strict().superRefine((record, context) => {
95
+ if (record.status === "consumed" && (!record.consumedAt || !record.result)) {
96
+ context.addIssue({ code: "custom", path: ["status"], message: "Consumed HostTask requires consumedAt and result" });
97
+ }
98
+ if (record.status === "cancelled" && !record.cancelledAt) {
99
+ context.addIssue({ code: "custom", path: ["status"], message: "Cancelled HostTask requires cancelledAt" });
100
+ }
101
+ if (record.status !== "consumed" && (record.consumedAt || record.result)) {
102
+ context.addIssue({ code: "custom", path: ["status"], message: "Only a consumed HostTask may contain a result" });
103
+ }
104
+ if (record.status !== "cancelled" && record.cancelledAt) {
105
+ context.addIssue({ code: "custom", path: ["status"], message: "Only a cancelled HostTask may contain cancelledAt" });
106
+ }
107
+ });
108
+ export const HostTaskArtifactListSchema = z.array(AtomArtifactReferenceSchema);
109
+ //# sourceMappingURL=host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.js","sourceRoot":"","sources":["../../src/atoms/host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;AAC7D,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAE9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAC/B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,sBAAsB,CAAC;IAC/C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,sBAAsB,CAAC;IAC/C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,G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C,EAAE,CAAC,CAAC;IACnH,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QACxD,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,mDAAmD,EAAE,CAAC,CAAC;IACvH,CAAC;AACH,CAAC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC"}
@@ -0,0 +1,257 @@
1
+ import { z } from "zod";
2
+ import { type AtomManifest, type JsonValue } from "./manifest.js";
3
+ export declare const AtomInstanceStateSchema: z.ZodEnum<{
4
+ enabled: "enabled";
5
+ discovered: "discovered";
6
+ loading: "loading";
7
+ validated: "validated";
8
+ registered: "registered";
9
+ draining: "draining";
10
+ disposed: "disposed";
11
+ }>;
12
+ export type AtomInstanceState = z.infer<typeof AtomInstanceStateSchema>;
13
+ export declare const AtomAttemptStateSchema: z.ZodEnum<{
14
+ created: "created";
15
+ running: "running";
16
+ awaiting_signal: "awaiting_signal";
17
+ awaiting_host: "awaiting_host";
18
+ succeeded: "succeeded";
19
+ failed: "failed";
20
+ cancelled: "cancelled";
21
+ interrupted: "interrupted";
22
+ unknown_outcome: "unknown_outcome";
23
+ }>;
24
+ export type AtomAttemptState = z.infer<typeof AtomAttemptStateSchema>;
25
+ export declare const AtomArtifactReferenceSchema: z.ZodObject<{
26
+ id: z.ZodString;
27
+ kind: z.ZodString;
28
+ hash: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strict>;
30
+ export type AtomArtifactReference = z.infer<typeof AtomArtifactReferenceSchema>;
31
+ export declare const AtomSignalRequestSchema: z.ZodObject<{
32
+ schemaVersion: z.ZodLiteral<"1.0">;
33
+ key: z.ZodString;
34
+ prompt: z.ZodString;
35
+ context: z.ZodDefault<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
36
+ responseSchema: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
37
+ expiresInMs: z.ZodOptional<z.ZodNumber>;
38
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
39
+ }, z.core.$strict>;
40
+ export type AtomSignalRequest = z.infer<typeof AtomSignalRequestSchema>;
41
+ export declare const AtomSignalResumeSchema: z.ZodObject<{
42
+ schemaVersion: z.ZodLiteral<"1.0">;
43
+ kind: z.ZodLiteral<"signal">;
44
+ signalId: z.ZodString;
45
+ key: z.ZodString;
46
+ response: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
47
+ }, z.core.$strict>;
48
+ export type AtomSignalResume = z.infer<typeof AtomSignalResumeSchema>;
49
+ export declare const AtomHostTaskDeclarationSchema: z.ZodObject<{
50
+ schemaVersion: z.ZodLiteral<"1.0">;
51
+ instruction: z.ZodString;
52
+ context: z.ZodDefault<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
53
+ artifacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
54
+ id: z.ZodString;
55
+ kind: z.ZodString;
56
+ hash: z.ZodOptional<z.ZodString>;
57
+ }, z.core.$strict>>>;
58
+ responseSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
59
+ requireSameProject: z.ZodDefault<z.ZodLiteral<true>>;
60
+ expiresInMs: z.ZodOptional<z.ZodNumber>;
61
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
62
+ }, z.core.$strict>;
63
+ export type AtomHostTaskDeclaration = z.infer<typeof AtomHostTaskDeclarationSchema>;
64
+ export declare const AtomHostCompletionSchema: z.ZodObject<{
65
+ output: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
66
+ artifacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
67
+ id: z.ZodString;
68
+ kind: z.ZodString;
69
+ hash: z.ZodOptional<z.ZodString>;
70
+ }, z.core.$strict>>>;
71
+ summary: z.ZodString;
72
+ }, z.core.$strict>;
73
+ export type AtomHostCompletion = z.infer<typeof AtomHostCompletionSchema>;
74
+ export declare const AtomHostResumeSchema: z.ZodObject<{
75
+ schemaVersion: z.ZodLiteral<"1.0">;
76
+ kind: z.ZodLiteral<"host">;
77
+ hostTaskId: z.ZodString;
78
+ continuationToken: z.ZodString;
79
+ result: z.ZodObject<{
80
+ output: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
81
+ artifacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
82
+ id: z.ZodString;
83
+ kind: z.ZodString;
84
+ hash: z.ZodOptional<z.ZodString>;
85
+ }, z.core.$strict>>>;
86
+ summary: z.ZodString;
87
+ }, z.core.$strict>;
88
+ }, z.core.$strict>;
89
+ export type AtomHostResume = z.infer<typeof AtomHostResumeSchema>;
90
+ export declare const AtomResumeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
91
+ schemaVersion: z.ZodLiteral<"1.0">;
92
+ kind: z.ZodLiteral<"signal">;
93
+ signalId: z.ZodString;
94
+ key: z.ZodString;
95
+ response: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
96
+ }, z.core.$strict>, z.ZodObject<{
97
+ schemaVersion: z.ZodLiteral<"1.0">;
98
+ kind: z.ZodLiteral<"host">;
99
+ hostTaskId: z.ZodString;
100
+ continuationToken: z.ZodString;
101
+ result: z.ZodObject<{
102
+ output: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
103
+ artifacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
104
+ id: z.ZodString;
105
+ kind: z.ZodString;
106
+ hash: z.ZodOptional<z.ZodString>;
107
+ }, z.core.$strict>>>;
108
+ summary: z.ZodString;
109
+ }, z.core.$strict>;
110
+ }, z.core.$strict>], "kind">;
111
+ export type AtomResume = z.infer<typeof AtomResumeSchema>;
112
+ export declare const MAX_LIFECYCLE_POLL_DELAY_MS = 86400000;
113
+ export declare const AtomRunningResultSchema: z.ZodObject<{
114
+ schemaVersion: z.ZodLiteral<"1.0">;
115
+ status: z.ZodLiteral<"running">;
116
+ checkpoint: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
117
+ nextPollAfterMs: z.ZodOptional<z.ZodNumber>;
118
+ }, z.core.$strict>;
119
+ export interface AtomRunningResult<TCheckpoint = JsonValue> {
120
+ readonly schemaVersion: "1.0";
121
+ readonly status: "running";
122
+ readonly checkpoint: TCheckpoint;
123
+ readonly nextPollAfterMs?: number | undefined;
124
+ }
125
+ export declare const AtomAwaitingSignalResultSchema: z.ZodObject<{
126
+ schemaVersion: z.ZodLiteral<"1.0">;
127
+ status: z.ZodLiteral<"awaiting_signal">;
128
+ checkpoint: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
129
+ signal: z.ZodObject<{
130
+ schemaVersion: z.ZodLiteral<"1.0">;
131
+ key: z.ZodString;
132
+ prompt: z.ZodString;
133
+ context: z.ZodDefault<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
134
+ responseSchema: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
135
+ expiresInMs: z.ZodOptional<z.ZodNumber>;
136
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
137
+ }, z.core.$strict>;
138
+ }, z.core.$strict>;
139
+ export interface AtomAwaitingSignalResult<TCheckpoint = JsonValue> {
140
+ readonly schemaVersion: "1.0";
141
+ readonly status: "awaiting_signal";
142
+ readonly checkpoint: TCheckpoint;
143
+ readonly signal: AtomSignalRequest;
144
+ }
145
+ export declare const AtomAwaitingHostResultSchema: z.ZodObject<{
146
+ schemaVersion: z.ZodLiteral<"1.0">;
147
+ status: z.ZodLiteral<"awaiting_host">;
148
+ checkpoint: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
149
+ task: z.ZodObject<{
150
+ schemaVersion: z.ZodLiteral<"1.0">;
151
+ instruction: z.ZodString;
152
+ context: z.ZodDefault<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
153
+ artifacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
154
+ id: z.ZodString;
155
+ kind: z.ZodString;
156
+ hash: z.ZodOptional<z.ZodString>;
157
+ }, z.core.$strict>>>;
158
+ responseSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
159
+ requireSameProject: z.ZodDefault<z.ZodLiteral<true>>;
160
+ expiresInMs: z.ZodOptional<z.ZodNumber>;
161
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
162
+ }, z.core.$strict>;
163
+ }, z.core.$strict>;
164
+ export interface AtomAwaitingHostResult<TCheckpoint = JsonValue> {
165
+ readonly schemaVersion: "1.0";
166
+ readonly status: "awaiting_host";
167
+ readonly checkpoint: TCheckpoint;
168
+ readonly task: AtomHostTaskDeclaration;
169
+ }
170
+ export declare const AtomSucceededResultSchema: z.ZodObject<{
171
+ schemaVersion: z.ZodLiteral<"1.0">;
172
+ status: z.ZodLiteral<"succeeded">;
173
+ output: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
174
+ artifacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
175
+ id: z.ZodString;
176
+ kind: z.ZodString;
177
+ hash: z.ZodOptional<z.ZodString>;
178
+ }, z.core.$strict>>>;
179
+ }, z.core.$strict>;
180
+ export interface AtomSucceededResult<TOutput = JsonValue> {
181
+ readonly schemaVersion: "1.0";
182
+ readonly status: "succeeded";
183
+ readonly output: TOutput;
184
+ readonly artifacts?: readonly AtomArtifactReference[];
185
+ }
186
+ export declare const AtomLifecycleResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
187
+ schemaVersion: z.ZodLiteral<"1.0">;
188
+ status: z.ZodLiteral<"running">;
189
+ checkpoint: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
190
+ nextPollAfterMs: z.ZodOptional<z.ZodNumber>;
191
+ }, z.core.$strict>, z.ZodObject<{
192
+ schemaVersion: z.ZodLiteral<"1.0">;
193
+ status: z.ZodLiteral<"awaiting_signal">;
194
+ checkpoint: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
195
+ signal: z.ZodObject<{
196
+ schemaVersion: z.ZodLiteral<"1.0">;
197
+ key: z.ZodString;
198
+ prompt: z.ZodString;
199
+ context: z.ZodDefault<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
200
+ responseSchema: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
201
+ expiresInMs: z.ZodOptional<z.ZodNumber>;
202
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
203
+ }, z.core.$strict>;
204
+ }, z.core.$strict>, z.ZodObject<{
205
+ schemaVersion: z.ZodLiteral<"1.0">;
206
+ status: z.ZodLiteral<"awaiting_host">;
207
+ checkpoint: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
208
+ task: z.ZodObject<{
209
+ schemaVersion: z.ZodLiteral<"1.0">;
210
+ instruction: z.ZodString;
211
+ context: z.ZodDefault<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
212
+ artifacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
213
+ id: z.ZodString;
214
+ kind: z.ZodString;
215
+ hash: z.ZodOptional<z.ZodString>;
216
+ }, z.core.$strict>>>;
217
+ responseSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
218
+ requireSameProject: z.ZodDefault<z.ZodLiteral<true>>;
219
+ expiresInMs: z.ZodOptional<z.ZodNumber>;
220
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
221
+ }, z.core.$strict>;
222
+ }, z.core.$strict>, z.ZodObject<{
223
+ schemaVersion: z.ZodLiteral<"1.0">;
224
+ status: z.ZodLiteral<"succeeded">;
225
+ output: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
226
+ artifacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
227
+ id: z.ZodString;
228
+ kind: z.ZodString;
229
+ hash: z.ZodOptional<z.ZodString>;
230
+ }, z.core.$strict>>>;
231
+ }, z.core.$strict>], "status">;
232
+ export type AtomLifecycleResult<TCheckpoint = JsonValue, TOutput = JsonValue> = AtomRunningResult<TCheckpoint> | AtomAwaitingSignalResult<TCheckpoint> | AtomAwaitingHostResult<TCheckpoint> | AtomSucceededResult<TOutput>;
233
+ export declare const AtomLifecycleValidationErrorCodeSchema: z.ZodEnum<{
234
+ ATOM_LIFECYCLE_RESULT_INVALID: "ATOM_LIFECYCLE_RESULT_INVALID";
235
+ ATOM_OUTPUT_SCHEMA_MISMATCH: "ATOM_OUTPUT_SCHEMA_MISMATCH";
236
+ ATOM_SIGNAL_RESUME_INVALID: "ATOM_SIGNAL_RESUME_INVALID";
237
+ ATOM_SIGNAL_RESPONSE_SCHEMA_MISMATCH: "ATOM_SIGNAL_RESPONSE_SCHEMA_MISMATCH";
238
+ ATOM_HOST_RESUME_INVALID: "ATOM_HOST_RESUME_INVALID";
239
+ ATOM_HOST_RESULT_SCHEMA_MISMATCH: "ATOM_HOST_RESULT_SCHEMA_MISMATCH";
240
+ }>;
241
+ export type AtomLifecycleValidationErrorCode = z.infer<typeof AtomLifecycleValidationErrorCodeSchema>;
242
+ export interface AtomLifecycleValidationError {
243
+ readonly code: AtomLifecycleValidationErrorCode;
244
+ readonly path: string;
245
+ readonly message: string;
246
+ }
247
+ export type AtomLifecycleValidationResult<T> = {
248
+ readonly success: true;
249
+ readonly data: T;
250
+ } | {
251
+ readonly success: false;
252
+ readonly errors: readonly AtomLifecycleValidationError[];
253
+ };
254
+ export declare function validateAtomLifecycleResult(manifest: AtomManifest, raw: unknown): AtomLifecycleValidationResult<AtomLifecycleResult<JsonValue, JsonValue>>;
255
+ export declare function validateAtomSignalResume(request: AtomSignalRequest, raw: unknown): AtomLifecycleValidationResult<AtomSignalResume>;
256
+ export declare function validateAtomHostResume(manifest: AtomManifest, hostTaskId: string, continuationToken: string, raw: unknown, responseSchema?: Record<string, JsonValue>): AtomLifecycleValidationResult<AtomHostResume>;
257
+ //# sourceMappingURL=lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/atoms/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,uBAAuB;;;;;;;;EAQlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,sBAAsB;;;;;;;;;;EAUjC,CAAC;AAEH,MA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