forkit-connect 0.1.32 → 0.1.33
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/v1/heartbeat.js +17 -1
- package/dist/v1/service.js +22 -2
- package/package.json +1 -1
package/dist/v1/heartbeat.js
CHANGED
|
@@ -137,9 +137,25 @@ function listBoundBindings(state) {
|
|
|
137
137
|
if (!Array.isArray(state.model_bindings)) {
|
|
138
138
|
return [];
|
|
139
139
|
}
|
|
140
|
+
const detectedModelKeys = new Set(state.detected_models.map((item) => `${item.model}#${item.digest}`));
|
|
141
|
+
const scoreBinding = (binding) => {
|
|
142
|
+
let score = 0;
|
|
143
|
+
if (detectedModelKeys.has(binding.modelKey))
|
|
144
|
+
score += 4;
|
|
145
|
+
if (binding.runtimeGaid)
|
|
146
|
+
score += 2;
|
|
147
|
+
if (binding.runtimeSignalKeyPresent)
|
|
148
|
+
score += 1;
|
|
149
|
+
return score;
|
|
150
|
+
};
|
|
140
151
|
return state.model_bindings
|
|
141
152
|
.filter((item) => item.status === 'bound' && typeof item.gaid === 'string' && item.gaid.trim())
|
|
142
|
-
.sort((left, right) =>
|
|
153
|
+
.sort((left, right) => {
|
|
154
|
+
const scoreDelta = scoreBinding(right) - scoreBinding(left);
|
|
155
|
+
if (scoreDelta !== 0)
|
|
156
|
+
return scoreDelta;
|
|
157
|
+
return String(right.updatedAt || '').localeCompare(String(left.updatedAt || ''));
|
|
158
|
+
})
|
|
143
159
|
.map((binding) => ({
|
|
144
160
|
binding,
|
|
145
161
|
detectedModel: state.detected_models.find((item) => `${item.model}#${item.digest}` === binding.modelKey),
|
package/dist/v1/service.js
CHANGED
|
@@ -2833,7 +2833,26 @@ class ConnectV1Service {
|
|
|
2833
2833
|
};
|
|
2834
2834
|
}
|
|
2835
2835
|
getPrimaryBoundBinding(state) {
|
|
2836
|
-
|
|
2836
|
+
const detectedModelKeys = new Set(state.detected_models.map((item) => `${item.model}#${item.digest}`));
|
|
2837
|
+
const scoreBinding = (binding) => {
|
|
2838
|
+
let score = 0;
|
|
2839
|
+
if (detectedModelKeys.has(binding.modelKey))
|
|
2840
|
+
score += 4;
|
|
2841
|
+
if (binding.runtimeGaid)
|
|
2842
|
+
score += 2;
|
|
2843
|
+
if (binding.runtimeSignalKeyPresent)
|
|
2844
|
+
score += 1;
|
|
2845
|
+
return score;
|
|
2846
|
+
};
|
|
2847
|
+
return state.model_bindings
|
|
2848
|
+
.filter((binding) => binding.status === 'bound' && typeof binding.gaid === 'string' && binding.gaid.trim())
|
|
2849
|
+
.sort((left, right) => {
|
|
2850
|
+
const scoreDelta = scoreBinding(right) - scoreBinding(left);
|
|
2851
|
+
if (scoreDelta !== 0)
|
|
2852
|
+
return scoreDelta;
|
|
2853
|
+
return String(right.updatedAt || '').localeCompare(String(left.updatedAt || ''));
|
|
2854
|
+
})
|
|
2855
|
+
.at(0);
|
|
2837
2856
|
}
|
|
2838
2857
|
setRuntimeSignalApiKeyForGaid(gaid, apiKey) {
|
|
2839
2858
|
if (!gaid || !apiKey)
|
|
@@ -3241,7 +3260,8 @@ class ConnectV1Service {
|
|
|
3241
3260
|
const { workspaceId, projectId } = this.resolveRuntimeRunScope(state, gaid);
|
|
3242
3261
|
const runtimeMetadata = isRecord(input.metadata) ? input.metadata : {};
|
|
3243
3262
|
const steps = Array.isArray(input.steps) ? input.steps.filter((step) => isRecord(step)) : [];
|
|
3244
|
-
|
|
3263
|
+
const client = this.getApiClientWithSessionToken(apiKey);
|
|
3264
|
+
return client.pushRuntimeRunLog({
|
|
3245
3265
|
gaid,
|
|
3246
3266
|
apiKey,
|
|
3247
3267
|
schemaVersion: 'runtime.run.v1',
|