@mcoda/mswarm 0.1.89 → 0.1.91
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/dist/codali-executor.d.ts +107 -6
- package/dist/codali-executor.d.ts.map +1 -1
- package/dist/codali-executor.js +500 -26
- package/dist/codali-executor.js.map +1 -1
- package/dist/runtime.d.ts +6 -3
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +18 -5
- package/dist/runtime.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +18 -3
- package/dist/server.js.map +1 -1
- package/dist/vendor/codali/cli/DatasetCommand.d.ts +38 -0
- package/dist/vendor/codali/cli/DatasetCommand.d.ts.map +1 -0
- package/dist/vendor/codali/cli/DatasetCommand.js +959 -0
- package/dist/vendor/codali/cli/EvalCommand.d.ts +3 -0
- package/dist/vendor/codali/cli/EvalCommand.d.ts.map +1 -1
- package/dist/vendor/codali/cli/EvalCommand.js +55 -1
- package/dist/vendor/codali/cli/ImprovementCommand.d.ts +97 -0
- package/dist/vendor/codali/cli/ImprovementCommand.d.ts.map +1 -0
- package/dist/vendor/codali/cli/ImprovementCommand.js +1879 -0
- package/dist/vendor/codali/cli.d.ts.map +1 -1
- package/dist/vendor/codali/cli.js +15 -0
- package/dist/vendor/codali/dataset-cli.d.ts +3 -0
- package/dist/vendor/codali/dataset-cli.d.ts.map +1 -0
- package/dist/vendor/codali/dataset-cli.js +30 -0
- package/dist/vendor/codali/eval/CodaliGatewayLiveHarness.d.ts +90 -1
- package/dist/vendor/codali/eval/CodaliGatewayLiveHarness.d.ts.map +1 -1
- package/dist/vendor/codali/eval/CodaliGatewayLiveHarness.js +443 -9
- package/dist/vendor/codali/eval/GatewayDatasetEval.d.ts +70 -0
- package/dist/vendor/codali/eval/GatewayDatasetEval.d.ts.map +1 -0
- package/dist/vendor/codali/eval/GatewayDatasetEval.js +477 -0
- package/dist/vendor/codali/eval/GatewayEvalSuite.d.ts +52 -0
- package/dist/vendor/codali/eval/GatewayEvalSuite.d.ts.map +1 -1
- package/dist/vendor/codali/eval/GatewayEvalSuite.js +135 -1
- package/dist/vendor/codali/gateway/CodaliGateway.d.ts +4 -0
- package/dist/vendor/codali/gateway/CodaliGateway.d.ts.map +1 -1
- package/dist/vendor/codali/gateway/CodaliGateway.js +37 -1
- package/dist/vendor/codali/gateway/CodaliGatewaySchemas.d.ts.map +1 -1
- package/dist/vendor/codali/gateway/CodaliGatewaySchemas.js +0 -4
- package/dist/vendor/codali/gateway/CodaliGatewayStore.d.ts.map +1 -1
- package/dist/vendor/codali/gateway/CodaliGatewayStore.js +1 -0
- package/dist/vendor/codali/gateway/GatewayPlanner.d.ts.map +1 -1
- package/dist/vendor/codali/gateway/GatewayPlanner.js +355 -41
- package/dist/vendor/codali/gateway/GatewayStateMachine.d.ts +1 -0
- package/dist/vendor/codali/gateway/GatewayStateMachine.d.ts.map +1 -1
- package/dist/vendor/codali/gateway/GatewayStateMachine.js +221 -5
- package/dist/vendor/codali/improvement/CandidateReleaseBuilder.d.ts +201 -0
- package/dist/vendor/codali/improvement/CandidateReleaseBuilder.d.ts.map +1 -0
- package/dist/vendor/codali/improvement/CandidateReleaseBuilder.js +1175 -0
- package/dist/vendor/codali/improvement/DatasetEligibilityGate.d.ts +75 -0
- package/dist/vendor/codali/improvement/DatasetEligibilityGate.d.ts.map +1 -0
- package/dist/vendor/codali/improvement/DatasetEligibilityGate.js +497 -0
- package/dist/vendor/codali/improvement/DatasetExportManifestReader.d.ts +88 -0
- package/dist/vendor/codali/improvement/DatasetExportManifestReader.d.ts.map +1 -0
- package/dist/vendor/codali/improvement/DatasetExportManifestReader.js +333 -0
- package/dist/vendor/codali/improvement/DocdexRetrievalCandidateBuilder.d.ts +192 -0
- package/dist/vendor/codali/improvement/DocdexRetrievalCandidateBuilder.d.ts.map +1 -0
- package/dist/vendor/codali/improvement/DocdexRetrievalCandidateBuilder.js +625 -0
- package/dist/vendor/codali/improvement/EvalReplayCandidateBuilder.d.ts +173 -0
- package/dist/vendor/codali/improvement/EvalReplayCandidateBuilder.d.ts.map +1 -0
- package/dist/vendor/codali/improvement/EvalReplayCandidateBuilder.js +363 -0
- package/dist/vendor/codali/improvement/FineTuneJobPlanner.d.ts +281 -0
- package/dist/vendor/codali/improvement/FineTuneJobPlanner.d.ts.map +1 -0
- package/dist/vendor/codali/improvement/FineTuneJobPlanner.js +823 -0
- package/dist/vendor/codali/improvement/ImprovementEvalRunner.d.ts +50 -0
- package/dist/vendor/codali/improvement/ImprovementEvalRunner.d.ts.map +1 -0
- package/dist/vendor/codali/improvement/ImprovementEvalRunner.js +648 -0
- package/dist/vendor/codali/improvement/ImprovementPolicy.d.ts +272 -0
- package/dist/vendor/codali/improvement/ImprovementPolicy.d.ts.map +1 -0
- package/dist/vendor/codali/improvement/ImprovementPolicy.js +1450 -0
- package/dist/vendor/codali/improvement/ModelRouterCandidateBuilder.d.ts +186 -0
- package/dist/vendor/codali/improvement/ModelRouterCandidateBuilder.d.ts.map +1 -0
- package/dist/vendor/codali/improvement/ModelRouterCandidateBuilder.js +880 -0
- package/dist/vendor/codali/improvement/OperatorInspector.d.ts +182 -0
- package/dist/vendor/codali/improvement/OperatorInspector.d.ts.map +1 -0
- package/dist/vendor/codali/improvement/OperatorInspector.js +604 -0
- package/dist/vendor/codali/improvement/ProductionGovernance.d.ts +91 -0
- package/dist/vendor/codali/improvement/ProductionGovernance.d.ts.map +1 -0
- package/dist/vendor/codali/improvement/ProductionGovernance.js +329 -0
- package/dist/vendor/codali/improvement/PromptSchemaToolMetadataCandidateBuilder.d.ts +152 -0
- package/dist/vendor/codali/improvement/PromptSchemaToolMetadataCandidateBuilder.d.ts.map +1 -0
- package/dist/vendor/codali/improvement/PromptSchemaToolMetadataCandidateBuilder.js +480 -0
- package/dist/vendor/codali/improvement/PublishOrchestrator.d.ts +113 -0
- package/dist/vendor/codali/improvement/PublishOrchestrator.d.ts.map +1 -0
- package/dist/vendor/codali/improvement/PublishOrchestrator.js +590 -0
- package/dist/vendor/codali/improvement/ReleaseOutcomeReporter.d.ts +133 -0
- package/dist/vendor/codali/improvement/ReleaseOutcomeReporter.d.ts.map +1 -0
- package/dist/vendor/codali/improvement/ReleaseOutcomeReporter.js +501 -0
- package/dist/vendor/codali/improvement/StorageServiceImprovementClient.d.ts +71 -0
- package/dist/vendor/codali/improvement/StorageServiceImprovementClient.d.ts.map +1 -0
- package/dist/vendor/codali/improvement/StorageServiceImprovementClient.js +245 -0
- package/dist/vendor/codali/index.d.ts +43 -0
- package/dist/vendor/codali/index.d.ts.map +1 -1
- package/dist/vendor/codali/index.js +21 -0
- package/dist/vendor/codali/runtime/CodaliRuntime.d.ts +0 -2
- package/dist/vendor/codali/runtime/CodaliRuntime.d.ts.map +1 -1
- package/dist/vendor/codali/runtime/CodaliRuntime.js +0 -5
- package/dist/vendor/codali/storage/CodaliDatasetPrivacyEngine.d.ts +138 -0
- package/dist/vendor/codali/storage/CodaliDatasetPrivacyEngine.d.ts.map +1 -0
- package/dist/vendor/codali/storage/CodaliDatasetPrivacyEngine.js +417 -0
- package/dist/vendor/codali/storage/CodaliFeedbackReviewIngestion.d.ts +50 -0
- package/dist/vendor/codali/storage/CodaliFeedbackReviewIngestion.d.ts.map +1 -0
- package/dist/vendor/codali/storage/CodaliFeedbackReviewIngestion.js +141 -0
- package/dist/vendor/codali/storage/CodaliStorageContracts.d.ts +337 -0
- package/dist/vendor/codali/storage/CodaliStorageContracts.d.ts.map +1 -0
- package/dist/vendor/codali/storage/CodaliStorageContracts.js +1555 -0
- package/dist/vendor/codali/storage/DatasetExportJob.d.ts +51 -0
- package/dist/vendor/codali/storage/DatasetExportJob.d.ts.map +1 -0
- package/dist/vendor/codali/storage/DatasetExportJob.js +358 -0
- package/dist/vendor/codali/storage/DatasetReviewQueue.d.ts +98 -0
- package/dist/vendor/codali/storage/DatasetReviewQueue.d.ts.map +1 -0
- package/dist/vendor/codali/storage/DatasetReviewQueue.js +426 -0
- package/dist/vendor/codali/storage/GatewayDatasetStore.d.ts +233 -0
- package/dist/vendor/codali/storage/GatewayDatasetStore.d.ts.map +1 -0
- package/dist/vendor/codali/storage/GatewayDatasetStore.js +2070 -0
- package/package.json +3 -3
package/dist/codali-executor.js
CHANGED
|
@@ -22,6 +22,8 @@ function normalizeCodaliProviderName(providerOrAdapter) {
|
|
|
22
22
|
return "codex-cli";
|
|
23
23
|
return value;
|
|
24
24
|
}
|
|
25
|
+
export const MSWARM_CODALI_FEEDBACK_SUBMISSION_SCHEMA_VERSION = "codali.feedback_submission.v1";
|
|
26
|
+
export const MSWARM_CODALI_PRODUCT_METADATA_SCHEMA_VERSION = "codali.product_metadata.v1";
|
|
25
27
|
const DEFAULT_RUNTIME_MS = 3600000;
|
|
26
28
|
const DEFAULT_MAX_STEPS = 24;
|
|
27
29
|
const DEFAULT_MAX_TOOL_CALLS = 40;
|
|
@@ -51,6 +53,349 @@ async function loadCodaliModule() {
|
|
|
51
53
|
function optionalText(value) {
|
|
52
54
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
|
|
53
55
|
}
|
|
56
|
+
function recordOrUndefined(value) {
|
|
57
|
+
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
58
|
+
? value
|
|
59
|
+
: undefined;
|
|
60
|
+
}
|
|
61
|
+
function optionalScopeText(record, keys) {
|
|
62
|
+
if (!record)
|
|
63
|
+
return undefined;
|
|
64
|
+
for (const key of keys) {
|
|
65
|
+
const value = optionalText(record[key]);
|
|
66
|
+
if (value)
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
function optionalScopeBoolean(record, keys) {
|
|
72
|
+
if (!record)
|
|
73
|
+
return undefined;
|
|
74
|
+
for (const key of keys) {
|
|
75
|
+
const value = optionalBoolean(record[key]);
|
|
76
|
+
if (value !== undefined)
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
function compactRecord(record) {
|
|
82
|
+
const compacted = Object.fromEntries(Object.entries(record).filter(([, value]) => value !== undefined));
|
|
83
|
+
return Object.keys(compacted).length > 0 ? compacted : undefined;
|
|
84
|
+
}
|
|
85
|
+
function normalizeFeedbackSubmissionVisibility(visibility, tenantWide) {
|
|
86
|
+
const value = optionalText(visibility);
|
|
87
|
+
if (value === "requester" ||
|
|
88
|
+
value === "conversation" ||
|
|
89
|
+
value === "product" ||
|
|
90
|
+
value === "tenant") {
|
|
91
|
+
return value === "tenant" && !tenantWide ? "requester" : value;
|
|
92
|
+
}
|
|
93
|
+
return "requester";
|
|
94
|
+
}
|
|
95
|
+
function buildFeedbackSubmissionProductScope(input) {
|
|
96
|
+
const gatewayProduct = input.codaliGateway?.product;
|
|
97
|
+
const jobContext = recordOrUndefined(input.codaliJob?.context);
|
|
98
|
+
const jobProduct = recordOrUndefined(jobContext?.product);
|
|
99
|
+
const product = gatewayProduct ?? jobProduct;
|
|
100
|
+
const tenant = input.codaliGateway?.tenant ?? input.codaliJob?.tenant;
|
|
101
|
+
return compactRecord({
|
|
102
|
+
product_id: optionalScopeText(product, ["productId", "product_id", "id", "slug", "name"]),
|
|
103
|
+
tenant_hash: optionalScopeText(product, ["tenantHash", "tenant_hash", "tenantScopeHash", "tenant_scope_hash"]) ??
|
|
104
|
+
optionalScopeText(tenant, ["tenantHash", "tenant_hash", "hash", "scopeHash", "scope_hash"]),
|
|
105
|
+
deployment_id: optionalScopeText(product, ["deploymentId", "deployment_id", "deployment"]),
|
|
106
|
+
environment: optionalScopeText(product, ["environment", "env"]),
|
|
107
|
+
product_scope_present: product ? true : undefined,
|
|
108
|
+
tenant_scope_present: tenant ? true : undefined,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function buildFeedbackSubmissionRequesterScope(input) {
|
|
112
|
+
const requester = input.codaliGateway?.requester ?? input.codaliJob?.requester;
|
|
113
|
+
const conversation = recordOrUndefined(input.codaliGateway?.conversation);
|
|
114
|
+
const tenantWide = optionalScopeBoolean(requester, ["tenantWide", "tenant_wide"]) === true;
|
|
115
|
+
const metadata = compactRecord({
|
|
116
|
+
requester_scope_present: requester ? true : undefined,
|
|
117
|
+
conversation_scope_present: conversation ? true : undefined,
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
visibility: normalizeFeedbackSubmissionVisibility(optionalScopeText(requester, ["visibility", "scope"]), tenantWide),
|
|
121
|
+
tenant_wide: tenantWide,
|
|
122
|
+
...(optionalScopeText(requester, [
|
|
123
|
+
"requesterHash",
|
|
124
|
+
"requester_hash",
|
|
125
|
+
"subjectHash",
|
|
126
|
+
"subject_hash",
|
|
127
|
+
"hash",
|
|
128
|
+
])
|
|
129
|
+
? {
|
|
130
|
+
requester_hash: optionalScopeText(requester, [
|
|
131
|
+
"requesterHash",
|
|
132
|
+
"requester_hash",
|
|
133
|
+
"subjectHash",
|
|
134
|
+
"subject_hash",
|
|
135
|
+
"hash",
|
|
136
|
+
]),
|
|
137
|
+
}
|
|
138
|
+
: {}),
|
|
139
|
+
...(optionalScopeText(conversation, ["conversationHash", "conversation_hash", "hash"])
|
|
140
|
+
? { conversation_hash: optionalScopeText(conversation, ["conversationHash", "conversation_hash", "hash"]) }
|
|
141
|
+
: {}),
|
|
142
|
+
...(optionalScopeText(requester, ["requesterType", "requester_type", "type", "role"])
|
|
143
|
+
? { requester_type: optionalScopeText(requester, ["requesterType", "requester_type", "type", "role"]) }
|
|
144
|
+
: {}),
|
|
145
|
+
...(metadata ? { metadata } : {}),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function feedbackSubmissionRole(input) {
|
|
149
|
+
if (input.codaliGateway)
|
|
150
|
+
return "codali_gateway_answer";
|
|
151
|
+
if (input.codaliJob)
|
|
152
|
+
return "codali_job_result";
|
|
153
|
+
return "codali_runtime_result";
|
|
154
|
+
}
|
|
155
|
+
function buildMswarmCodaliFeedbackSubmissionMetadata(input, runId) {
|
|
156
|
+
const role = feedbackSubmissionRole(input);
|
|
157
|
+
const recordMetadata = compactRecord({
|
|
158
|
+
job_id: input.jobId,
|
|
159
|
+
request_id: input.requestId,
|
|
160
|
+
gateway_id: input.codaliGateway?.id,
|
|
161
|
+
codali_job_id: input.codaliJob?.id,
|
|
162
|
+
codali_job_type: input.codaliJob?.jobType,
|
|
163
|
+
});
|
|
164
|
+
const deletionGroupId = optionalScopeText(input.codaliGateway?.metadata, ["deletionGroupId", "deletion_group_id"]) ??
|
|
165
|
+
optionalScopeText(input.codaliJob?.metadata, ["deletionGroupId", "deletion_group_id"]) ??
|
|
166
|
+
`delete-group-${runId}`;
|
|
167
|
+
return {
|
|
168
|
+
schema_version: MSWARM_CODALI_FEEDBACK_SUBMISSION_SCHEMA_VERSION,
|
|
169
|
+
run_id: runId,
|
|
170
|
+
deletion_group_id: deletionGroupId,
|
|
171
|
+
target: {
|
|
172
|
+
record_type: "gateway_record",
|
|
173
|
+
record_id: runId,
|
|
174
|
+
role,
|
|
175
|
+
...(recordMetadata ? { metadata: recordMetadata } : {}),
|
|
176
|
+
},
|
|
177
|
+
candidate_records: [
|
|
178
|
+
{
|
|
179
|
+
record_type: "gateway_record",
|
|
180
|
+
record_id: runId,
|
|
181
|
+
role,
|
|
182
|
+
...(recordMetadata ? { metadata: recordMetadata } : {}),
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
...(buildFeedbackSubmissionProductScope(input)
|
|
186
|
+
? { product_scope: buildFeedbackSubmissionProductScope(input) }
|
|
187
|
+
: {}),
|
|
188
|
+
requester_scope: buildFeedbackSubmissionRequesterScope(input),
|
|
189
|
+
source: {
|
|
190
|
+
runtime: "mswarm",
|
|
191
|
+
job_id: input.jobId,
|
|
192
|
+
request_id: input.requestId,
|
|
193
|
+
agent_slug: input.agent.slug,
|
|
194
|
+
...(input.session?.id ? { session_id: input.session.id } : {}),
|
|
195
|
+
},
|
|
196
|
+
raw_trace_included: false,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function buildProductDatasetCollectionMetadata(metadata) {
|
|
200
|
+
const collection = recordOrUndefined(metadata.datasetCollection ?? metadata.dataset_collection);
|
|
201
|
+
const recordCounts = collection
|
|
202
|
+
? recordOrUndefined(collection.recordCounts ?? collection.record_counts)
|
|
203
|
+
: undefined;
|
|
204
|
+
const errors = collection ? stringArray(collection.errors) : undefined;
|
|
205
|
+
const output = {
|
|
206
|
+
status: optionalScopeText(collection, ["status"]) ?? "not_configured",
|
|
207
|
+
};
|
|
208
|
+
if (collection) {
|
|
209
|
+
const accepted = optionalScopeBoolean(collection, ["accepted"]);
|
|
210
|
+
const recordCount = optionalNumber(collection.recordCount, collection.record_count);
|
|
211
|
+
const objectCount = optionalNumber(collection.objectCount, collection.object_count);
|
|
212
|
+
const replayed = optionalScopeBoolean(collection, ["replayed"]);
|
|
213
|
+
const fallbackUsed = optionalScopeBoolean(collection, ["fallbackUsed", "fallback_used"]);
|
|
214
|
+
if (accepted !== undefined)
|
|
215
|
+
output.accepted = accepted;
|
|
216
|
+
if (recordCount !== undefined)
|
|
217
|
+
output.record_count = recordCount;
|
|
218
|
+
if (objectCount !== undefined)
|
|
219
|
+
output.object_count = objectCount;
|
|
220
|
+
if (replayed !== undefined)
|
|
221
|
+
output.replayed = replayed;
|
|
222
|
+
if (fallbackUsed !== undefined)
|
|
223
|
+
output.fallback_used = fallbackUsed;
|
|
224
|
+
}
|
|
225
|
+
if (errors)
|
|
226
|
+
output.errors = errors;
|
|
227
|
+
if (recordCounts)
|
|
228
|
+
output.record_counts = recordCounts;
|
|
229
|
+
return output;
|
|
230
|
+
}
|
|
231
|
+
function buildProductPrivacyFlags(metadata) {
|
|
232
|
+
const flags = recordOrUndefined(metadata.privacyFlags ?? metadata.privacy_flags);
|
|
233
|
+
const privacy = recordOrUndefined(metadata.privacy ?? metadata.privacy_metadata);
|
|
234
|
+
const uploadAllowed = optionalScopeBoolean(flags, ["uploadAllowed", "upload_allowed", "allowUpload", "allow_upload"]) ??
|
|
235
|
+
optionalScopeBoolean(privacy, ["uploadAllowed", "upload_allowed", "allowUpload", "allow_upload"]) ??
|
|
236
|
+
false;
|
|
237
|
+
const exportAllowed = optionalScopeBoolean(flags, ["exportAllowed", "export_allowed", "allowExport", "allow_export"]) ??
|
|
238
|
+
optionalScopeBoolean(privacy, ["exportAllowed", "export_allowed", "allowExport", "allow_export"]) ??
|
|
239
|
+
false;
|
|
240
|
+
const trainingAllowed = optionalScopeBoolean(flags, [
|
|
241
|
+
"trainingAllowed",
|
|
242
|
+
"training_allowed",
|
|
243
|
+
"allowTraining",
|
|
244
|
+
"allow_training",
|
|
245
|
+
]) ??
|
|
246
|
+
optionalScopeBoolean(privacy, [
|
|
247
|
+
"trainingAllowed",
|
|
248
|
+
"training_allowed",
|
|
249
|
+
"allowTraining",
|
|
250
|
+
"allow_training",
|
|
251
|
+
]) ??
|
|
252
|
+
false;
|
|
253
|
+
return {
|
|
254
|
+
local_only: !(uploadAllowed || exportAllowed || trainingAllowed),
|
|
255
|
+
upload_allowed: uploadAllowed,
|
|
256
|
+
export_allowed: exportAllowed,
|
|
257
|
+
training_allowed: trainingAllowed,
|
|
258
|
+
raw_trace_included: false,
|
|
259
|
+
contains_personal_data: optionalScopeBoolean(flags, [
|
|
260
|
+
"containsPersonalData",
|
|
261
|
+
"contains_personal_data",
|
|
262
|
+
"containsPii",
|
|
263
|
+
"contains_pii",
|
|
264
|
+
]) ??
|
|
265
|
+
optionalScopeBoolean(privacy, [
|
|
266
|
+
"containsPersonalData",
|
|
267
|
+
"contains_personal_data",
|
|
268
|
+
"containsPii",
|
|
269
|
+
"contains_pii",
|
|
270
|
+
]) ??
|
|
271
|
+
true,
|
|
272
|
+
contains_tenant_private_data: optionalScopeBoolean(flags, [
|
|
273
|
+
"containsTenantPrivateData",
|
|
274
|
+
"contains_tenant_private_data",
|
|
275
|
+
]) ??
|
|
276
|
+
optionalScopeBoolean(privacy, [
|
|
277
|
+
"containsTenantPrivateData",
|
|
278
|
+
"contains_tenant_private_data",
|
|
279
|
+
]) ??
|
|
280
|
+
true,
|
|
281
|
+
contains_customer_data: optionalScopeBoolean(flags, ["containsCustomerData", "contains_customer_data"]) ??
|
|
282
|
+
optionalScopeBoolean(privacy, ["containsCustomerData", "contains_customer_data"]) ??
|
|
283
|
+
true,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
function latencyMsFromRecord(record) {
|
|
287
|
+
const metadata = recordOrUndefined(record.metadata);
|
|
288
|
+
const latency = optionalNumber(record.latencyMs, record.latency_ms, record.durationMs, record.duration_ms, metadata?.latencyMs, metadata?.latency_ms, metadata?.durationMs, metadata?.duration_ms);
|
|
289
|
+
return latency !== undefined && latency >= 0 ? latency : undefined;
|
|
290
|
+
}
|
|
291
|
+
function sumLatencyMs(records) {
|
|
292
|
+
let total = 0;
|
|
293
|
+
let found = false;
|
|
294
|
+
for (const record of records) {
|
|
295
|
+
const latency = latencyMsFromRecord(record);
|
|
296
|
+
if (latency === undefined)
|
|
297
|
+
continue;
|
|
298
|
+
total += latency;
|
|
299
|
+
found = true;
|
|
300
|
+
}
|
|
301
|
+
return found ? Math.round(total) : undefined;
|
|
302
|
+
}
|
|
303
|
+
function buildProductModelTiers(gatewayResult) {
|
|
304
|
+
const output = [];
|
|
305
|
+
const seen = new Set();
|
|
306
|
+
const push = (record, roleFallback) => {
|
|
307
|
+
if (!record)
|
|
308
|
+
return;
|
|
309
|
+
const metadata = recordOrUndefined(record.metadata);
|
|
310
|
+
const entry = compactRecord({
|
|
311
|
+
role: optionalScopeText(record, ["role"]) ?? roleFallback,
|
|
312
|
+
tier: optionalScopeText(record, ["tier", "modelTier", "model_tier"]) ??
|
|
313
|
+
optionalScopeText(metadata, ["tier", "modelTier", "model_tier"]),
|
|
314
|
+
model: optionalScopeText(record, ["model", "modelId", "model_id"]) ??
|
|
315
|
+
optionalScopeText(metadata, ["model", "modelId", "model_id"]),
|
|
316
|
+
provider: optionalScopeText(record, ["provider", "providerName", "provider_name"]) ??
|
|
317
|
+
optionalScopeText(metadata, ["provider", "providerName", "provider_name"]),
|
|
318
|
+
agent_slug: optionalScopeText(record, ["agentSlug", "agent_slug"]) ??
|
|
319
|
+
optionalScopeText(metadata, ["agentSlug", "agent_slug"]),
|
|
320
|
+
});
|
|
321
|
+
if (!entry)
|
|
322
|
+
return;
|
|
323
|
+
const key = JSON.stringify(entry);
|
|
324
|
+
if (seen.has(key))
|
|
325
|
+
return;
|
|
326
|
+
seen.add(key);
|
|
327
|
+
output.push(entry);
|
|
328
|
+
};
|
|
329
|
+
push(recordOrUndefined(gatewayResult.finalModel), "final_synthesizer");
|
|
330
|
+
for (const call of gatewayResult.trace.modelCalls) {
|
|
331
|
+
push(recordOrUndefined(call));
|
|
332
|
+
}
|
|
333
|
+
return output;
|
|
334
|
+
}
|
|
335
|
+
function buildMswarmCodaliProductMetadata(gatewayResult, feedbackSubmission) {
|
|
336
|
+
const gatewayTrace = gatewayResult.trace;
|
|
337
|
+
const gatewayMetadata = gatewayResult.metadata ?? {};
|
|
338
|
+
const traceMetadata = gatewayTrace.metadata ?? {};
|
|
339
|
+
const datasetCollection = buildProductDatasetCollectionMetadata(gatewayMetadata);
|
|
340
|
+
const warnings = uniqueStrings(gatewayTrace.warnings, stringArray(gatewayMetadata.warnings)) ?? [];
|
|
341
|
+
const errors = uniqueStrings(gatewayTrace.errors, stringArray(gatewayMetadata.errors)) ?? [];
|
|
342
|
+
const calledTools = uniqueStrings(gatewayTrace.calledTools, stringArray(gatewayMetadata.calledTools), stringArray(gatewayMetadata.called_tools)) ?? [];
|
|
343
|
+
const contextPackId = optionalScopeText(recordOrUndefined(gatewayResult.contextPack), ["id", "contextPackId", "context_pack_id"]) ??
|
|
344
|
+
optionalScopeText(traceMetadata, ["contextPackId", "context_pack_id"]) ??
|
|
345
|
+
optionalScopeText(gatewayMetadata, ["contextPackId", "context_pack_id"]);
|
|
346
|
+
const toolLatencyMs = sumLatencyMs(gatewayTrace.toolCalls);
|
|
347
|
+
const modelLatencyMs = sumLatencyMs(gatewayTrace.modelCalls);
|
|
348
|
+
const totalLatencyMs = optionalNumber(gatewayMetadata.latencyMs, gatewayMetadata.latency_ms, traceMetadata.latencyMs, traceMetadata.latency_ms) ??
|
|
349
|
+
(toolLatencyMs !== undefined || modelLatencyMs !== undefined
|
|
350
|
+
? (toolLatencyMs ?? 0) + (modelLatencyMs ?? 0)
|
|
351
|
+
: undefined);
|
|
352
|
+
return {
|
|
353
|
+
schema_version: MSWARM_CODALI_PRODUCT_METADATA_SCHEMA_VERSION,
|
|
354
|
+
run_id: gatewayResult.runId,
|
|
355
|
+
trace_id: optionalScopeText(traceMetadata, ["traceId", "trace_id"]) ??
|
|
356
|
+
optionalScopeText(gatewayMetadata, ["traceId", "trace_id"]) ??
|
|
357
|
+
gatewayTrace.runId ??
|
|
358
|
+
gatewayResult.runId,
|
|
359
|
+
...(contextPackId ? { context_pack_id: contextPackId } : {}),
|
|
360
|
+
dataset_collection: datasetCollection,
|
|
361
|
+
privacy_flags: buildProductPrivacyFlags(gatewayMetadata),
|
|
362
|
+
record_counts: {
|
|
363
|
+
...(datasetCollection.record_count !== undefined
|
|
364
|
+
? { dataset_records: datasetCollection.record_count }
|
|
365
|
+
: {}),
|
|
366
|
+
sources: gatewayResult.sources.length,
|
|
367
|
+
evidence: gatewayResult.evidence.length,
|
|
368
|
+
tool_calls: gatewayTrace.toolCallCount,
|
|
369
|
+
model_calls: gatewayTrace.modelCallCount,
|
|
370
|
+
context_packs: gatewayResult.contextPack ? 1 : 0,
|
|
371
|
+
final_answers: gatewayResult.answer ? 1 : 0,
|
|
372
|
+
warnings: warnings.length,
|
|
373
|
+
errors: errors.length,
|
|
374
|
+
},
|
|
375
|
+
feedback_ref: {
|
|
376
|
+
schema_version: feedbackSubmission.schema_version,
|
|
377
|
+
run_id: feedbackSubmission.run_id,
|
|
378
|
+
deletion_group_id: feedbackSubmission.deletion_group_id,
|
|
379
|
+
target: feedbackSubmission.target,
|
|
380
|
+
candidate_record_count: feedbackSubmission.candidate_records.length,
|
|
381
|
+
...(feedbackSubmission.product_scope
|
|
382
|
+
? { product_scope: feedbackSubmission.product_scope }
|
|
383
|
+
: {}),
|
|
384
|
+
requester_scope: feedbackSubmission.requester_scope,
|
|
385
|
+
raw_trace_included: false,
|
|
386
|
+
},
|
|
387
|
+
called_tools: calledTools,
|
|
388
|
+
model_tiers: buildProductModelTiers(gatewayResult),
|
|
389
|
+
warnings,
|
|
390
|
+
errors,
|
|
391
|
+
...(totalLatencyMs !== undefined ? { latency_ms: Math.round(totalLatencyMs) } : {}),
|
|
392
|
+
latency: {
|
|
393
|
+
...(totalLatencyMs !== undefined ? { total_ms: Math.round(totalLatencyMs) } : {}),
|
|
394
|
+
...(modelLatencyMs !== undefined ? { model_ms: modelLatencyMs } : {}),
|
|
395
|
+
...(toolLatencyMs !== undefined ? { tool_ms: toolLatencyMs } : {}),
|
|
396
|
+
},
|
|
397
|
+
};
|
|
398
|
+
}
|
|
54
399
|
function textFromMessageContent(content) {
|
|
55
400
|
if (typeof content === "string") {
|
|
56
401
|
return content;
|
|
@@ -134,8 +479,6 @@ function buildRuntimePolicy(agent, policy) {
|
|
|
134
479
|
appToolContracts: policy?.appToolContracts,
|
|
135
480
|
appVirtualTools: policy?.appVirtualTools,
|
|
136
481
|
appToolGateway: policy?.appToolGateway,
|
|
137
|
-
okacamToolContracts: policy?.okacamToolContracts,
|
|
138
|
-
okacamVirtualTools: policy?.okacamVirtualTools,
|
|
139
482
|
maxSteps: allowRuntimeTools ? DEFAULT_MAX_STEPS : 2,
|
|
140
483
|
maxToolCalls: allowRuntimeTools
|
|
141
484
|
? policy?.maxToolCalls ?? DEFAULT_MAX_TOOL_CALLS
|
|
@@ -154,16 +497,19 @@ function buildRuntimeDocdex(workspace, docdex, requestId, attachedMswarmApiKey)
|
|
|
154
497
|
dagSessionId: requestId,
|
|
155
498
|
};
|
|
156
499
|
}
|
|
500
|
+
const credentialSource = docdex?.credentialSource;
|
|
501
|
+
const apiKey = credentialSource === "attached_mswarm_api_key"
|
|
502
|
+
? attachedMswarmApiKey
|
|
503
|
+
: docdex?.apiKey;
|
|
157
504
|
return {
|
|
158
505
|
enabled: docdex.enabled,
|
|
159
506
|
baseUrl: docdex?.baseUrl ?? DEFAULT_DOCDEX_BASE_URL,
|
|
160
507
|
repoRoot: docdex?.repoRoot ?? workspace.root,
|
|
161
508
|
repoId: docdex?.repoId,
|
|
162
509
|
dagSessionId: docdex?.dagSessionId ?? requestId,
|
|
163
|
-
apiKey
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
credentialSource: docdex?.credentialSource,
|
|
510
|
+
apiKey,
|
|
511
|
+
credentialSource,
|
|
512
|
+
immutableRuntimeContext: docdex?.immutableRuntimeContext === true || credentialSource === "attached_mswarm_api_key",
|
|
167
513
|
required: docdex?.required,
|
|
168
514
|
allowedOperations: docdex?.allowedOperations,
|
|
169
515
|
capabilities: docdex?.capabilities,
|
|
@@ -175,6 +521,22 @@ function buildRuntimeDocdex(workspace, docdex, requestId, attachedMswarmApiKey)
|
|
|
175
521
|
toolManifest: docdex?.toolManifest,
|
|
176
522
|
};
|
|
177
523
|
}
|
|
524
|
+
function mergeGatewayDocdexContext(gatewayDocdex, runtimeDocdex) {
|
|
525
|
+
if (!gatewayDocdex)
|
|
526
|
+
return runtimeDocdex;
|
|
527
|
+
if (!runtimeDocdex)
|
|
528
|
+
return gatewayDocdex;
|
|
529
|
+
const credentialSource = gatewayDocdex.credentialSource ?? runtimeDocdex.credentialSource;
|
|
530
|
+
return {
|
|
531
|
+
...runtimeDocdex,
|
|
532
|
+
...gatewayDocdex,
|
|
533
|
+
credentialSource,
|
|
534
|
+
apiKey: gatewayDocdex.apiKey ?? runtimeDocdex.apiKey,
|
|
535
|
+
immutableRuntimeContext: gatewayDocdex.immutableRuntimeContext ??
|
|
536
|
+
runtimeDocdex.immutableRuntimeContext ??
|
|
537
|
+
credentialSource === "attached_mswarm_api_key",
|
|
538
|
+
};
|
|
539
|
+
}
|
|
178
540
|
function runtimeAgent(agent) {
|
|
179
541
|
return {
|
|
180
542
|
slug: agent.slug,
|
|
@@ -294,8 +656,8 @@ function mergeToolContracts(...values) {
|
|
|
294
656
|
return output.length ? output : undefined;
|
|
295
657
|
}
|
|
296
658
|
function buildGatewayPolicy(gatewayPolicy, runtimePolicy) {
|
|
297
|
-
const appToolContracts = mergeToolContracts(policyToolContracts(gatewayPolicy, "appToolContracts", "app_tool_contracts"),
|
|
298
|
-
const appVirtualTools = uniqueStrings(policyStringArray(gatewayPolicy, "appVirtualTools", "app_virtual_tools"),
|
|
659
|
+
const appToolContracts = mergeToolContracts(policyToolContracts(gatewayPolicy, "appToolContracts", "app_tool_contracts"), runtimePolicy.appToolContracts);
|
|
660
|
+
const appVirtualTools = uniqueStrings(policyStringArray(gatewayPolicy, "appVirtualTools", "app_virtual_tools"), runtimePolicy.appVirtualTools);
|
|
299
661
|
const policy = {
|
|
300
662
|
...(gatewayPolicy ?? {}),
|
|
301
663
|
allowedTools: policyStringArray(gatewayPolicy, "allowedTools", "allowed_tools") ??
|
|
@@ -390,7 +752,7 @@ function buildGatewayRequest(input, runtimeInput) {
|
|
|
390
752
|
query: optionalText(gateway.query) ?? messagesToTask(input.messages),
|
|
391
753
|
mode: gateway.mode ?? "balanced",
|
|
392
754
|
conversation: gateway.conversation ?? buildGatewayConversation(input),
|
|
393
|
-
docdex: gateway.docdex
|
|
755
|
+
docdex: mergeGatewayDocdexContext(gateway.docdex, runtimeInput.docdex),
|
|
394
756
|
tools: gateway.tools ?? input.docdex?.toolManifest,
|
|
395
757
|
policy: buildGatewayPolicy(gateway.policy, runtimeInput.policy),
|
|
396
758
|
agentPolicy: gateway.agentPolicy ?? {
|
|
@@ -414,25 +776,131 @@ function buildGatewayRequest(input, runtimeInput) {
|
|
|
414
776
|
},
|
|
415
777
|
};
|
|
416
778
|
}
|
|
417
|
-
function
|
|
779
|
+
function mergeDefinedGatewayAgentRecord(current, next) {
|
|
780
|
+
const merged = { ...(current ?? {}) };
|
|
781
|
+
for (const [key, value] of Object.entries(next)) {
|
|
782
|
+
if (value !== undefined) {
|
|
783
|
+
merged[key] = value;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
return merged;
|
|
787
|
+
}
|
|
788
|
+
function gatewayStageAgentContainers(gateway) {
|
|
789
|
+
const gatewayRecord = recordOrUndefined(gateway);
|
|
790
|
+
const agentPolicy = recordOrUndefined(gateway?.agentPolicy);
|
|
791
|
+
const metadata = recordOrUndefined(gateway?.metadata);
|
|
418
792
|
return [
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
supportsTools: agent.supportsTools,
|
|
426
|
-
supportsJsonSchema: agent.supportsJsonSchema,
|
|
427
|
-
supportsStreaming: agent.supportsStreaming,
|
|
428
|
-
contextWindow: agent.contextWindow,
|
|
429
|
-
maxOutputTokens: agent.maxOutputTokens,
|
|
430
|
-
capabilities: agent.capabilities,
|
|
431
|
-
health_status: "healthy",
|
|
432
|
-
source: "self_hosted",
|
|
433
|
-
},
|
|
793
|
+
recordOrUndefined(gatewayRecord?.stageAgents),
|
|
794
|
+
recordOrUndefined(gatewayRecord?.stage_agents),
|
|
795
|
+
recordOrUndefined(agentPolicy?.stageAgents),
|
|
796
|
+
recordOrUndefined(agentPolicy?.stage_agents),
|
|
797
|
+
recordOrUndefined(metadata?.stageAgents),
|
|
798
|
+
recordOrUndefined(metadata?.stage_agents),
|
|
434
799
|
];
|
|
435
800
|
}
|
|
801
|
+
function gatewayStageAgentRecords(gateway) {
|
|
802
|
+
const records = [];
|
|
803
|
+
for (const container of gatewayStageAgentContainers(gateway)) {
|
|
804
|
+
if (!container) {
|
|
805
|
+
continue;
|
|
806
|
+
}
|
|
807
|
+
for (const candidate of Object.values(container)) {
|
|
808
|
+
const record = recordOrUndefined(candidate);
|
|
809
|
+
if (record) {
|
|
810
|
+
records.push(record);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
return records;
|
|
815
|
+
}
|
|
816
|
+
function gatewayStageAgentTier(value) {
|
|
817
|
+
const tier = optionalText(value)?.toLowerCase();
|
|
818
|
+
return tier === "small" || tier === "medium" || tier === "large" || tier === "image"
|
|
819
|
+
? tier
|
|
820
|
+
: undefined;
|
|
821
|
+
}
|
|
822
|
+
function gatewayStageAgentTierMinContextWindow(tier) {
|
|
823
|
+
if (tier === "large")
|
|
824
|
+
return 16000;
|
|
825
|
+
if (tier === "medium" || tier === "image")
|
|
826
|
+
return 8000;
|
|
827
|
+
if (tier === "small")
|
|
828
|
+
return 4000;
|
|
829
|
+
return undefined;
|
|
830
|
+
}
|
|
831
|
+
function gatewayStageAgentContextWindow(tier, ...values) {
|
|
832
|
+
const explicit = values
|
|
833
|
+
.map((value) => optionalNumber(value))
|
|
834
|
+
.filter((value) => typeof value === "number" && value > 0)
|
|
835
|
+
.sort((left, right) => right - left)[0];
|
|
836
|
+
const minimum = gatewayStageAgentTierMinContextWindow(tier);
|
|
837
|
+
if (explicit && minimum)
|
|
838
|
+
return Math.max(explicit, minimum);
|
|
839
|
+
return explicit ?? minimum;
|
|
840
|
+
}
|
|
841
|
+
function normalizeGatewayStageAgentRecord(value) {
|
|
842
|
+
const nestedAgent = recordOrUndefined(value.codaliAgent) ?? recordOrUndefined(value.codali_agent);
|
|
843
|
+
const nestedProvider = recordOrUndefined(value.codaliProvider) ?? recordOrUndefined(value.codali_provider);
|
|
844
|
+
const capabilities = stringArray(value.capabilities) ?? stringArray(nestedAgent?.capabilities) ?? [];
|
|
845
|
+
const tier = gatewayStageAgentTier(value.tier) ??
|
|
846
|
+
gatewayStageAgentTier(value.modelTier) ??
|
|
847
|
+
gatewayStageAgentTier(value.model_tier) ??
|
|
848
|
+
gatewayStageAgentTier(nestedAgent?.tier) ??
|
|
849
|
+
gatewayStageAgentTier(nestedAgent?.modelTier) ??
|
|
850
|
+
gatewayStageAgentTier(nestedAgent?.model_tier);
|
|
851
|
+
const contextWindow = gatewayStageAgentContextWindow(tier, value.contextWindow, value.context_window, nestedAgent?.contextWindow, nestedAgent?.context_window, nestedProvider?.contextWindow, nestedProvider?.context_window);
|
|
852
|
+
const supportsTools = optionalBoolean(value.supportsTools, value.supports_tools, nestedAgent?.supportsTools, nestedAgent?.supports_tools, nestedProvider?.supportsTools, nestedProvider?.supports_tools);
|
|
853
|
+
const supportsJsonSchema = optionalBoolean(value.supportsJsonSchema, value.supports_json_schema, nestedAgent?.supportsJsonSchema, nestedAgent?.supports_json_schema, nestedProvider?.supportsJsonSchema, nestedProvider?.supports_json_schema);
|
|
854
|
+
return compactRecord({
|
|
855
|
+
...(nestedAgent ?? {}),
|
|
856
|
+
...value,
|
|
857
|
+
capabilities,
|
|
858
|
+
...(tier ? { tier, modelTier: tier, model_tier: tier } : {}),
|
|
859
|
+
...(contextWindow ? { contextWindow, context_window: contextWindow } : {}),
|
|
860
|
+
...(typeof supportsTools === "boolean"
|
|
861
|
+
? { supportsTools, supports_tools: supportsTools }
|
|
862
|
+
: {}),
|
|
863
|
+
...(typeof supportsJsonSchema === "boolean"
|
|
864
|
+
? { supportsJsonSchema, supports_json_schema: supportsJsonSchema }
|
|
865
|
+
: {}),
|
|
866
|
+
healthStatus: optionalText(value.healthStatus) ?? optionalText(value.health_status) ?? "healthy",
|
|
867
|
+
health_status: optionalText(value.health_status) ?? optionalText(value.healthStatus) ?? "healthy",
|
|
868
|
+
source: optionalText(value.source) ?? "self_hosted",
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
function buildGatewayAgentInventory(agent, gateway) {
|
|
872
|
+
const bySlug = new Map();
|
|
873
|
+
const addCandidate = (candidate) => {
|
|
874
|
+
if (!candidate) {
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
const slug = optionalText(candidate.slug) ?? optionalText(candidate.id);
|
|
878
|
+
if (!slug) {
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
bySlug.set(slug, mergeDefinedGatewayAgentRecord(bySlug.get(slug), candidate));
|
|
882
|
+
};
|
|
883
|
+
addCandidate({
|
|
884
|
+
slug: agent.slug,
|
|
885
|
+
adapter: agent.adapter,
|
|
886
|
+
provider: providerNameForAgent(agent),
|
|
887
|
+
model: agent.model,
|
|
888
|
+
baseUrl: agent.baseUrl,
|
|
889
|
+
supportsTools: agent.supportsTools,
|
|
890
|
+
supportsJsonSchema: agent.supportsJsonSchema,
|
|
891
|
+
supportsStreaming: agent.supportsStreaming,
|
|
892
|
+
contextWindow: agent.contextWindow,
|
|
893
|
+
maxOutputTokens: agent.maxOutputTokens,
|
|
894
|
+
capabilities: agent.capabilities,
|
|
895
|
+
healthStatus: "healthy",
|
|
896
|
+
health_status: "healthy",
|
|
897
|
+
source: "self_hosted",
|
|
898
|
+
});
|
|
899
|
+
for (const stageAgent of gatewayStageAgentRecords(gateway)) {
|
|
900
|
+
addCandidate(normalizeGatewayStageAgentRecord(stageAgent));
|
|
901
|
+
}
|
|
902
|
+
return [...bySlug.values()];
|
|
903
|
+
}
|
|
436
904
|
function createGatewayProvider(input) {
|
|
437
905
|
return {
|
|
438
906
|
name: input.providerName,
|
|
@@ -644,7 +1112,7 @@ export class MswarmCodaliExecutor {
|
|
|
644
1112
|
gatewayResult = await runCodaliGateway(gatewayRequest, {
|
|
645
1113
|
provider: createGatewayProvider({ providerName, runtimeInput, runCodali }),
|
|
646
1114
|
taskRunner: createGatewayTaskRunner({ runtimeInput, runCodali }),
|
|
647
|
-
agentInventory: buildGatewayAgentInventory(input.agent),
|
|
1115
|
+
agentInventory: buildGatewayAgentInventory(input.agent, gatewayRequest),
|
|
648
1116
|
workerOptions: {
|
|
649
1117
|
maxRuntimeMs: gatewayRequest.policy?.maxRuntimeMs,
|
|
650
1118
|
maxToolCalls: gatewayRequest.policy?.maxToolCalls,
|
|
@@ -697,6 +1165,8 @@ export class MswarmCodaliExecutor {
|
|
|
697
1165
|
}).length;
|
|
698
1166
|
const gatewayWarnings = gatewayTrace.warnings ?? [];
|
|
699
1167
|
const gatewayErrors = gatewayTrace.errors ?? [];
|
|
1168
|
+
const feedbackSubmission = buildMswarmCodaliFeedbackSubmissionMetadata(input, gatewayResult.runId);
|
|
1169
|
+
const productMetadata = buildMswarmCodaliProductMetadata(gatewayResult, feedbackSubmission);
|
|
700
1170
|
return {
|
|
701
1171
|
output: gatewayResult.answer,
|
|
702
1172
|
runtimeResult: gatewayResult,
|
|
@@ -742,6 +1212,8 @@ export class MswarmCodaliExecutor {
|
|
|
742
1212
|
codali_gateway_warnings: gatewayWarnings,
|
|
743
1213
|
codali_gateway_errors: gatewayErrors,
|
|
744
1214
|
codali_gateway_trace: gatewayTrace,
|
|
1215
|
+
feedback_submission: feedbackSubmission,
|
|
1216
|
+
codali_product_metadata: productMetadata,
|
|
745
1217
|
touched_files: [],
|
|
746
1218
|
warnings: gatewayWarnings,
|
|
747
1219
|
mode: runtimePolicy.mode,
|
|
@@ -755,6 +1227,7 @@ export class MswarmCodaliExecutor {
|
|
|
755
1227
|
}
|
|
756
1228
|
const telemetry = invocationResult.telemetry;
|
|
757
1229
|
const runtimeTelemetry = runtimeResult?.telemetry;
|
|
1230
|
+
const feedbackSubmission = buildMswarmCodaliFeedbackSubmissionMetadata(input, invocationResult.runId);
|
|
758
1231
|
return {
|
|
759
1232
|
output: jobResult?.output ?? runtimeResult?.finalMessage ?? "",
|
|
760
1233
|
usage: invocationResult.usage,
|
|
@@ -781,6 +1254,7 @@ export class MswarmCodaliExecutor {
|
|
|
781
1254
|
codali_job_stage_count: jobResult?.stages.length,
|
|
782
1255
|
codali_job_stages: jobResult?.telemetry.stages,
|
|
783
1256
|
codali_job_errors: jobResult?.errors,
|
|
1257
|
+
feedback_submission: feedbackSubmission,
|
|
784
1258
|
touched_files: invocationResult.touchedFiles,
|
|
785
1259
|
warnings: invocationResult.warnings,
|
|
786
1260
|
mode: runtimePolicy.mode,
|