@you-agent-factory/client 0.0.0 → 0.0.1
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.md +1 -1
- package/README.md +78 -17
- package/dist/contracts.d.ts +51 -0
- package/dist/contracts.js +9 -0
- package/dist/event-ordering.d.ts +15 -0
- package/dist/event-ordering.js +33 -0
- package/dist/generated/factory-event.schema.json +5490 -0
- package/dist/generated/factory.schema.json +2606 -0
- package/dist/generated/openapi.d.ts +7587 -0
- package/dist/generated/openapi.js +1020 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/recording.d.ts +34 -0
- package/dist/recording.js +236 -0
- package/dist/replay.d.ts +21 -0
- package/dist/replay.js +82 -0
- package/dist/schema-validation.d.ts +9 -0
- package/dist/schema-validation.js +113 -0
- package/dist/visualization-layout-contracts.d.ts +63 -0
- package/dist/visualization-layout-contracts.js +1 -0
- package/dist/visualization-layout-data.d.ts +9 -0
- package/dist/visualization-layout-data.js +105 -0
- package/dist/visualization-layout-error.d.ts +5 -0
- package/dist/visualization-layout-error.js +10 -0
- package/dist/visualization-layout-fields.d.ts +7 -0
- package/dist/visualization-layout-fields.js +26 -0
- package/dist/visualization-layout-geometry.d.ts +5 -0
- package/dist/visualization-layout-geometry.js +74 -0
- package/dist/visualization-layout-media.d.ts +11 -0
- package/dist/visualization-layout-media.js +110 -0
- package/dist/visualization-layout-safety.d.ts +15 -0
- package/dist/visualization-layout-safety.js +142 -0
- package/dist/visualization-layout-topology.d.ts +11 -0
- package/dist/visualization-layout-topology.js +90 -0
- package/dist/visualization-layout.d.ts +12 -0
- package/dist/visualization-layout.js +299 -0
- package/examples/customer-support.factory-recording.v1.json +64 -0
- package/examples/customer-support.factory-visualization-layout.v1.json +47 -0
- package/package.json +37 -18
- package/recordings/factory-recording.json +0 -36
- package/src/contracts.ts +0 -13
- package/src/generated/factory-recording.schema.json +0 -5521
- package/src/generated/openapi.ts +0 -8134
- package/src/index.js +0 -5
- package/src/index.ts +0 -17
- package/src/recording-parser.d.ts +0 -37
- package/src/recording-parser.js +0 -230
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { FACTORY_VISUALIZATION_LAYOUT_SCHEMA_VERSION, } from "./visualization-layout-contracts.js";
|
|
2
|
+
import { clonePlainData, isInputRecord, validatePlainDataContainers, } from "./visualization-layout-data.js";
|
|
3
|
+
import { FactoryVisualizationLayoutValidationError } from "./visualization-layout-error.js";
|
|
4
|
+
import { emptyStateFields, imageAnnotationFields, imageContentFields, imageSourceFields, layoutFields, noteFields, textContentFields, } from "./visualization-layout-fields.js";
|
|
5
|
+
import { validatePosition, validateSize, } from "./visualization-layout-geometry.js";
|
|
6
|
+
import { MAX_IMAGE_ALT_TEXT_LENGTH, validateEmbeddedImageData, } from "./visualization-layout-media.js";
|
|
7
|
+
import { isUnsafeContentField, MAX_EMPTY_STATE_TEXT_LENGTH, MAX_NOTE_BODY_LENGTH, MAX_NOTE_TITLE_LENGTH, validateDuplicateAnnotationIds, validateDuplicateNodeIds, validatePlainText, } from "./visualization-layout-safety.js";
|
|
8
|
+
import { factoryVisualizationCanonicalNodeIds, validateCanonicalNodeId, } from "./visualization-layout-topology.js";
|
|
9
|
+
const imageMediaTypes = new Set(["image/png", "image/jpeg", "image/webp"]);
|
|
10
|
+
const noteTones = new Set([
|
|
11
|
+
"neutral",
|
|
12
|
+
"accent",
|
|
13
|
+
"info",
|
|
14
|
+
"success",
|
|
15
|
+
"warning",
|
|
16
|
+
"danger",
|
|
17
|
+
]);
|
|
18
|
+
function unsupportedFields(value, fields, path, issues) {
|
|
19
|
+
for (const key of Object.keys(value)) {
|
|
20
|
+
if (!fields.has(key)) {
|
|
21
|
+
issues.push({
|
|
22
|
+
category: "structure",
|
|
23
|
+
code: "unsupported_field",
|
|
24
|
+
path: [...path, key],
|
|
25
|
+
message: `Unsupported field ${key}.`,
|
|
26
|
+
});
|
|
27
|
+
if (isUnsafeContentField(key)) {
|
|
28
|
+
issues.push({
|
|
29
|
+
category: "semantic",
|
|
30
|
+
code: "unsafe_content_field",
|
|
31
|
+
path: [...path, key],
|
|
32
|
+
message: `Executable, connection-like, and URI-bearing content field ${key} is not allowed.`,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function requiredField(value, key, path, issues) {
|
|
39
|
+
if (Object.hasOwn(value, key))
|
|
40
|
+
return true;
|
|
41
|
+
issues.push({
|
|
42
|
+
category: "structure",
|
|
43
|
+
code: "missing_required_field",
|
|
44
|
+
path: [...path, key],
|
|
45
|
+
message: `Expected required field ${key}.`,
|
|
46
|
+
});
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
function stringField(value, key, path, issues, required = true) {
|
|
50
|
+
if (!requiredField(value, key, path, required ? issues : []))
|
|
51
|
+
return false;
|
|
52
|
+
if (!Object.hasOwn(value, key))
|
|
53
|
+
return true;
|
|
54
|
+
if (typeof value[key] === "string")
|
|
55
|
+
return true;
|
|
56
|
+
issues.push({
|
|
57
|
+
category: "structure",
|
|
58
|
+
code: "invalid_type",
|
|
59
|
+
path: [...path, key],
|
|
60
|
+
message: `Expected ${key} to be a string.`,
|
|
61
|
+
});
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
function validateImageSource(input, path, issues, imageBudget) {
|
|
65
|
+
if (!isInputRecord(input)) {
|
|
66
|
+
issues.push({
|
|
67
|
+
category: "structure",
|
|
68
|
+
code: "invalid_type",
|
|
69
|
+
path,
|
|
70
|
+
message: "Expected image source to be an object.",
|
|
71
|
+
});
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
unsupportedFields(input, imageSourceFields, path, issues);
|
|
75
|
+
if (stringField(input, "kind", path, issues) && input.kind !== "embedded") {
|
|
76
|
+
issues.push({
|
|
77
|
+
category: "structure",
|
|
78
|
+
code: "invalid_value",
|
|
79
|
+
path: [...path, "kind"],
|
|
80
|
+
message: "Expected image source kind embedded.",
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
const validMediaType = stringField(input, "mediaType", path, issues);
|
|
84
|
+
if (validMediaType && !imageMediaTypes.has(input.mediaType)) {
|
|
85
|
+
issues.push({
|
|
86
|
+
category: "semantic",
|
|
87
|
+
code: "unsupported_image_media_type",
|
|
88
|
+
path: [...path, "mediaType"],
|
|
89
|
+
message: "Expected a supported embedded raster media type.",
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const validBase64Type = stringField(input, "base64", path, issues);
|
|
93
|
+
if (validBase64Type &&
|
|
94
|
+
validMediaType &&
|
|
95
|
+
typeof input.base64 === "string" &&
|
|
96
|
+
typeof input.mediaType === "string" &&
|
|
97
|
+
imageMediaTypes.has(input.mediaType)) {
|
|
98
|
+
validateEmbeddedImageData(input.base64, input.mediaType, [...path, "base64"], issues, imageBudget);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function validateImageContent(input, path, fields, issues, imageBudget) {
|
|
102
|
+
unsupportedFields(input, fields, path, issues);
|
|
103
|
+
if (stringField(input, "altText", path, issues)) {
|
|
104
|
+
validatePlainText(input.altText, [...path, "altText"], MAX_IMAGE_ALT_TEXT_LENGTH, "image alternative text", issues, true);
|
|
105
|
+
}
|
|
106
|
+
if (requiredField(input, "source", path, issues)) {
|
|
107
|
+
validateImageSource(input.source, [...path, "source"], issues, imageBudget);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function validateAnnotation(input, index, issues, imageBudget) {
|
|
111
|
+
const path = ["annotations", index];
|
|
112
|
+
if (!isInputRecord(input)) {
|
|
113
|
+
issues.push({
|
|
114
|
+
category: "structure",
|
|
115
|
+
code: "invalid_type",
|
|
116
|
+
path,
|
|
117
|
+
message: "Expected annotation to be an object.",
|
|
118
|
+
});
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
stringField(input, "id", path, issues);
|
|
122
|
+
if (!stringField(input, "kind", path, issues))
|
|
123
|
+
return;
|
|
124
|
+
if (input.kind !== "note" && input.kind !== "image") {
|
|
125
|
+
issues.push({
|
|
126
|
+
category: "structure",
|
|
127
|
+
code: "invalid_annotation_kind",
|
|
128
|
+
path: [...path, "kind"],
|
|
129
|
+
message: `Unsupported annotation kind ${input.kind}.`,
|
|
130
|
+
});
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (input.kind === "note") {
|
|
134
|
+
unsupportedFields(input, noteFields, path, issues);
|
|
135
|
+
if (stringField(input, "body", path, issues)) {
|
|
136
|
+
validatePlainText(input.body, [...path, "body"], MAX_NOTE_BODY_LENGTH, "note body", issues, true);
|
|
137
|
+
}
|
|
138
|
+
if (stringField(input, "title", path, issues, false) &&
|
|
139
|
+
typeof input.title === "string") {
|
|
140
|
+
validatePlainText(input.title, [...path, "title"], MAX_NOTE_TITLE_LENGTH, "note title", issues, false);
|
|
141
|
+
}
|
|
142
|
+
if (stringField(input, "tone", path, issues, false) &&
|
|
143
|
+
input.tone !== undefined &&
|
|
144
|
+
!noteTones.has(input.tone)) {
|
|
145
|
+
issues.push({
|
|
146
|
+
category: "structure",
|
|
147
|
+
code: "unsupported_note_tone",
|
|
148
|
+
path: [...path, "tone"],
|
|
149
|
+
message: `Unsupported note tone ${input.tone}.`,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
if (Object.hasOwn(input, "size")) {
|
|
153
|
+
validateSize(input.size, [...path, "size"], issues);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
validateImageContent(input, path, imageAnnotationFields, issues, imageBudget);
|
|
158
|
+
if (requiredField(input, "size", path, issues)) {
|
|
159
|
+
validateSize(input.size, [...path, "size"], issues);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (requiredField(input, "position", path, issues)) {
|
|
163
|
+
validatePosition(input.position, [...path, "position"], issues);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function validateEmptyStateContent(input, path, issues, imageBudget) {
|
|
167
|
+
if (!isInputRecord(input)) {
|
|
168
|
+
issues.push({
|
|
169
|
+
category: "structure",
|
|
170
|
+
code: "invalid_type",
|
|
171
|
+
path,
|
|
172
|
+
message: "Expected empty-state content to be an object.",
|
|
173
|
+
});
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (!stringField(input, "kind", path, issues))
|
|
177
|
+
return;
|
|
178
|
+
if (input.kind === "text") {
|
|
179
|
+
unsupportedFields(input, textContentFields, path, issues);
|
|
180
|
+
if (stringField(input, "text", path, issues)) {
|
|
181
|
+
validatePlainText(input.text, [...path, "text"], MAX_EMPTY_STATE_TEXT_LENGTH, "node empty-state text", issues, true);
|
|
182
|
+
}
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (input.kind === "image") {
|
|
186
|
+
validateImageContent(input, path, imageContentFields, issues, imageBudget);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
issues.push({
|
|
190
|
+
category: "structure",
|
|
191
|
+
code: "invalid_empty_state_kind",
|
|
192
|
+
path: [...path, "kind"],
|
|
193
|
+
message: `Unsupported empty-state content kind ${input.kind}.`,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
function validateNodeEmptyState(input, index, issues, imageBudget, canonicalNodeIds) {
|
|
197
|
+
const path = ["nodeEmptyStates", index];
|
|
198
|
+
if (!isInputRecord(input)) {
|
|
199
|
+
issues.push({
|
|
200
|
+
category: "structure",
|
|
201
|
+
code: "invalid_type",
|
|
202
|
+
path,
|
|
203
|
+
message: "Expected node empty state to be an object.",
|
|
204
|
+
});
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
unsupportedFields(input, emptyStateFields, path, issues);
|
|
208
|
+
if (stringField(input, "nodeId", path, issues)) {
|
|
209
|
+
validateCanonicalNodeId(input.nodeId, [...path, "nodeId"], canonicalNodeIds, issues);
|
|
210
|
+
}
|
|
211
|
+
if (requiredField(input, "content", path, issues)) {
|
|
212
|
+
validateEmptyStateContent(input.content, [...path, "content"], issues, imageBudget);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Validate presentation metadata beside an immutable canonical Factory.
|
|
217
|
+
* The Factory is accepted as context but is never modified or included in the result.
|
|
218
|
+
*/
|
|
219
|
+
export function safeParseFactoryVisualizationLayout(input, factory) {
|
|
220
|
+
if (!isInputRecord(input)) {
|
|
221
|
+
return {
|
|
222
|
+
success: false,
|
|
223
|
+
issues: [
|
|
224
|
+
{
|
|
225
|
+
category: "structure",
|
|
226
|
+
code: "invalid_type",
|
|
227
|
+
path: [],
|
|
228
|
+
message: "Expected Factory visualization layout to be an object.",
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
const issues = [];
|
|
234
|
+
validatePlainDataContainers(input, [], issues);
|
|
235
|
+
if (issues.length > 0)
|
|
236
|
+
return { success: false, issues };
|
|
237
|
+
const imageBudget = {
|
|
238
|
+
total: 0,
|
|
239
|
+
aggregateLimitReported: false,
|
|
240
|
+
};
|
|
241
|
+
const canonicalNodeIds = "canonicalNodeIds" in factory
|
|
242
|
+
? factory.canonicalNodeIds
|
|
243
|
+
: factoryVisualizationCanonicalNodeIds(factory);
|
|
244
|
+
unsupportedFields(input, layoutFields, [], issues);
|
|
245
|
+
if (stringField(input, "schemaVersion", [], issues) &&
|
|
246
|
+
input.schemaVersion !== FACTORY_VISUALIZATION_LAYOUT_SCHEMA_VERSION) {
|
|
247
|
+
issues.push({
|
|
248
|
+
category: "structure",
|
|
249
|
+
code: "unsupported_layout_schema_version",
|
|
250
|
+
path: ["schemaVersion"],
|
|
251
|
+
message: `Unsupported Factory visualization layout schema version: ${input.schemaVersion}.`,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
if (Object.hasOwn(input, "annotations")) {
|
|
255
|
+
if (!Array.isArray(input.annotations)) {
|
|
256
|
+
issues.push({
|
|
257
|
+
category: "structure",
|
|
258
|
+
code: "invalid_type",
|
|
259
|
+
path: ["annotations"],
|
|
260
|
+
message: "Expected annotations to be an array.",
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
for (const [index, annotation] of input.annotations.entries()) {
|
|
265
|
+
validateAnnotation(annotation, index, issues, imageBudget);
|
|
266
|
+
}
|
|
267
|
+
validateDuplicateAnnotationIds(input.annotations, issues);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if (Object.hasOwn(input, "nodeEmptyStates")) {
|
|
271
|
+
if (!Array.isArray(input.nodeEmptyStates)) {
|
|
272
|
+
issues.push({
|
|
273
|
+
category: "structure",
|
|
274
|
+
code: "invalid_type",
|
|
275
|
+
path: ["nodeEmptyStates"],
|
|
276
|
+
message: "Expected nodeEmptyStates to be an array.",
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
for (const [index, emptyState] of input.nodeEmptyStates.entries()) {
|
|
281
|
+
validateNodeEmptyState(emptyState, index, issues, imageBudget, canonicalNodeIds);
|
|
282
|
+
}
|
|
283
|
+
validateDuplicateNodeIds(input.nodeEmptyStates, issues);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return issues.length > 0
|
|
287
|
+
? { success: false, issues }
|
|
288
|
+
: {
|
|
289
|
+
success: true,
|
|
290
|
+
data: clonePlainData(input),
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
export function parseFactoryVisualizationLayout(input, factory) {
|
|
294
|
+
const result = safeParseFactoryVisualizationLayout(input, factory);
|
|
295
|
+
if (!result.success) {
|
|
296
|
+
throw new FactoryVisualizationLayoutValidationError(result.issues);
|
|
297
|
+
}
|
|
298
|
+
return result.data;
|
|
299
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "factory-recording/v1",
|
|
3
|
+
"id": "customer-support-triage-example",
|
|
4
|
+
"title": "Customer support triage topology",
|
|
5
|
+
"summary": "A minimal recording that establishes the Factory topology before work begins.",
|
|
6
|
+
"factory": {
|
|
7
|
+
"name": "customer-support-triage",
|
|
8
|
+
"workTypes": [
|
|
9
|
+
{
|
|
10
|
+
"name": "support-request",
|
|
11
|
+
"states": [
|
|
12
|
+
{ "name": "queued", "type": "INITIAL" },
|
|
13
|
+
{ "name": "resolved", "type": "TERMINAL" }
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"workstations": [
|
|
18
|
+
{
|
|
19
|
+
"name": "triage",
|
|
20
|
+
"worker": "",
|
|
21
|
+
"inputs": [{ "workType": "support-request", "state": "queued" }],
|
|
22
|
+
"outputs": [{ "workType": "support-request", "state": "resolved" }]
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"events": [
|
|
27
|
+
{
|
|
28
|
+
"schemaVersion": "agent-factory.event.v1",
|
|
29
|
+
"id": "evt-topology-001",
|
|
30
|
+
"type": "INITIAL_STRUCTURE_REQUEST",
|
|
31
|
+
"context": {
|
|
32
|
+
"sequence": 1,
|
|
33
|
+
"tick": 0,
|
|
34
|
+
"eventTime": "2026-07-18T00:00:00Z",
|
|
35
|
+
"sessionId": "session-customer-support-example",
|
|
36
|
+
"sessionSequence": 1
|
|
37
|
+
},
|
|
38
|
+
"payload": {
|
|
39
|
+
"factory": {
|
|
40
|
+
"name": "customer-support-triage",
|
|
41
|
+
"workTypes": [
|
|
42
|
+
{
|
|
43
|
+
"name": "support-request",
|
|
44
|
+
"states": [
|
|
45
|
+
{ "name": "queued", "type": "INITIAL" },
|
|
46
|
+
{ "name": "resolved", "type": "TERMINAL" }
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"workstations": [
|
|
51
|
+
{
|
|
52
|
+
"name": "triage",
|
|
53
|
+
"worker": "",
|
|
54
|
+
"inputs": [{ "workType": "support-request", "state": "queued" }],
|
|
55
|
+
"outputs": [
|
|
56
|
+
{ "workType": "support-request", "state": "resolved" }
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "factory-visualization-layout/v1",
|
|
3
|
+
"annotations": [
|
|
4
|
+
{
|
|
5
|
+
"id": "triage-guidance",
|
|
6
|
+
"kind": "note",
|
|
7
|
+
"position": { "x": 120, "y": 80 },
|
|
8
|
+
"size": { "width": 320, "height": 180 },
|
|
9
|
+
"title": "Triage guidance",
|
|
10
|
+
"body": "Review urgency before assigning a specialist.",
|
|
11
|
+
"tone": "info"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"id": "support-mark",
|
|
15
|
+
"kind": "image",
|
|
16
|
+
"position": { "x": 520, "y": 80 },
|
|
17
|
+
"size": { "width": 64, "height": 64 },
|
|
18
|
+
"altText": "Customer support marker",
|
|
19
|
+
"source": {
|
|
20
|
+
"kind": "embedded",
|
|
21
|
+
"mediaType": "image/png",
|
|
22
|
+
"base64": "iVBORw0KGgo="
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"nodeEmptyStates": [
|
|
27
|
+
{
|
|
28
|
+
"nodeId": "workstation:triage",
|
|
29
|
+
"content": {
|
|
30
|
+
"kind": "text",
|
|
31
|
+
"text": "No support requests are waiting."
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"nodeId": "work-state:support-request:resolved",
|
|
36
|
+
"content": {
|
|
37
|
+
"kind": "image",
|
|
38
|
+
"altText": "Resolved queue is empty",
|
|
39
|
+
"source": {
|
|
40
|
+
"kind": "embedded",
|
|
41
|
+
"mediaType": "image/png",
|
|
42
|
+
"base64": "iVBORw0KGgo="
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
package/package.json
CHANGED
|
@@ -1,32 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@you-agent-factory/client",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Transport-neutral Factory contracts and recording utilities.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/portpowered/you-agent-factory.git"
|
|
8
|
+
"url": "git+https://github.com/portpowered/you-agent-factory.git",
|
|
9
|
+
"directory": "ui/packages/client"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
9
13
|
},
|
|
10
|
-
"type": "module",
|
|
11
14
|
"files": [
|
|
12
|
-
"
|
|
15
|
+
"dist",
|
|
16
|
+
"examples",
|
|
13
17
|
"LICENSE.md",
|
|
14
|
-
"
|
|
15
|
-
"src"
|
|
18
|
+
"README.md"
|
|
16
19
|
],
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"ajv": "^8.20.0",
|
|
20
|
-
"ajv-formats": "^3.0.1"
|
|
21
|
-
},
|
|
20
|
+
"type": "module",
|
|
21
|
+
"sideEffects": false,
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
|
-
"types": "./
|
|
25
|
-
"import": "./
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js",
|
|
26
|
+
"default": "./dist/index.js"
|
|
26
27
|
},
|
|
27
|
-
"./
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
"./examples/customer-support.factory-recording.v1.json": "./examples/customer-support.factory-recording.v1.json",
|
|
29
|
+
"./examples/customer-support.factory-visualization-layout.v1.json": "./examples/customer-support.factory-visualization-layout.v1.json"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "node scripts/build-package.mjs",
|
|
33
|
+
"check:installed-consumer": "node scripts/verify-installed-consumer.mjs",
|
|
34
|
+
"check:pack": "node scripts/verify-package-pack.mjs",
|
|
35
|
+
"check:generated": "node scripts/generate-contracts.mjs --check",
|
|
36
|
+
"generate": "node scripts/generate-contracts.mjs",
|
|
37
|
+
"prepack": "bun run build",
|
|
38
|
+
"test": "vitest run --config vitest.config.ts",
|
|
39
|
+
"typecheck": "tsc -p tsconfig.json --noEmit --pretty false",
|
|
40
|
+
"verify": "bun run check:generated && bun run typecheck && bun run test && bun run build && bun run check:pack && bun run check:installed-consumer"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"ajv": "^8.20.0",
|
|
44
|
+
"ajv-formats": "^3.0.1",
|
|
45
|
+
"marked": "^14.0.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"typescript": "~5.9.3",
|
|
49
|
+
"vitest": "4.1.3"
|
|
31
50
|
}
|
|
32
51
|
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"schemaVersion": "agent-factory.recording.v1",
|
|
3
|
-
"sessionId": "example-session",
|
|
4
|
-
"events": [
|
|
5
|
-
{
|
|
6
|
-
"schemaVersion": "agent-factory.event.v1",
|
|
7
|
-
"id": "example-event-1",
|
|
8
|
-
"type": "INITIAL_STRUCTURE_REQUEST",
|
|
9
|
-
"context": {
|
|
10
|
-
"sequence": 0,
|
|
11
|
-
"tick": 0,
|
|
12
|
-
"eventTime": "2026-07-18T00:00:00Z",
|
|
13
|
-
"sessionId": "example-session"
|
|
14
|
-
},
|
|
15
|
-
"payload": {
|
|
16
|
-
"factory": {
|
|
17
|
-
"name": "packaged-recording-example"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"schemaVersion": "agent-factory.event.v1",
|
|
23
|
-
"id": "example-event-2",
|
|
24
|
-
"type": "SESSION_STARTED",
|
|
25
|
-
"context": {
|
|
26
|
-
"sequence": 1,
|
|
27
|
-
"tick": 1,
|
|
28
|
-
"eventTime": "2026-07-18T00:00:01Z",
|
|
29
|
-
"sessionId": "example-session"
|
|
30
|
-
},
|
|
31
|
-
"payload": {
|
|
32
|
-
"startedAt": "2026-07-18T00:00:01Z"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
}
|
package/src/contracts.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { components } from "./generated/openapi.js";
|
|
2
|
-
|
|
3
|
-
/** A canonical event emitted by the Factory runtime. */
|
|
4
|
-
export type FactoryEvent = components["schemas"]["FactoryEvent"];
|
|
5
|
-
|
|
6
|
-
/** The customer-visible canonical Factory event vocabulary. */
|
|
7
|
-
export type FactoryEventType = components["schemas"]["FactoryEventType"];
|
|
8
|
-
|
|
9
|
-
/** A complete authored Factory definition. */
|
|
10
|
-
export type FactoryDefinition = components["schemas"]["Factory"];
|
|
11
|
-
|
|
12
|
-
/** A chapter-free, ordered event recording for one Factory Session. */
|
|
13
|
-
export type FactoryRecording = components["schemas"]["FactoryRecording"];
|