forkit-connect 0.1.31 → 0.1.32

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/README.md CHANGED
@@ -123,7 +123,7 @@ Then install the generated tarball into a clean directory:
123
123
  mkdir -p /tmp/forkit-connect-smoke
124
124
  cd /tmp/forkit-connect-smoke
125
125
  npm init -y
126
- npm install /absolute/path/to/forkit-connect-0.1.24.tgz
126
+ npm install /absolute/path/to/forkit-connect-<version>.tgz
127
127
  npx forkit-connect --help
128
128
  npx forkit-connect status
129
129
  npx forkit-connect inbox
@@ -309,7 +309,8 @@ function canonicalJson(value) {
309
309
  return JSON.stringify(canonicalize(value));
310
310
  }
311
311
  function modelNameFromKey(modelKeyValue) {
312
- return String(modelKeyValue || '').split('#')[0]?.trim() || 'unknown';
312
+ const rawName = String(modelKeyValue || '').split('#')[0]?.trim() || 'unknown';
313
+ return rawName.startsWith('model:') ? rawName.slice('model:'.length) : rawName;
313
314
  }
314
315
  function modelDigestFromKey(modelKeyValue) {
315
316
  const digest = String(modelKeyValue || '').split('#')[1]?.trim() || '';
@@ -7080,6 +7081,7 @@ class ConnectV1Service {
7080
7081
  // Don't consume a retry_count increment here — this is a throttle, not a real failure.
7081
7082
  return;
7082
7083
  }
7084
+ attempted += 1;
7083
7085
  if (!event.passport_gaid) {
7084
7086
  if (event.event_type === 'connect_runtime_unavailable') {
7085
7087
  this.stateStore.discardC2Event(event.event_id, 'c2_local_only_runtime_unavailable');
@@ -7169,14 +7171,39 @@ class ConnectV1Service {
7169
7171
  }
7170
7172
  }
7171
7173
  const queuedEvents = dedupedEvents.slice(0, C2_SYNC_BATCH_SIZE);
7172
- attempted = queuedEvents.length;
7173
- for (let i = 0; i < queuedEvents.length; i += C2_FLUSH_CONCURRENCY) {
7174
- // Stop sending once rate-limited for this cycle.
7174
+ const eventsByPassport = new Map();
7175
+ for (const event of queuedEvents) {
7176
+ const groupKey = event.passport_gaid
7177
+ ? `passport:${event.passport_gaid}`
7178
+ : `event:${event.event_id}`;
7179
+ const group = eventsByPassport.get(groupKey) ?? [];
7180
+ group.push(event);
7181
+ eventsByPassport.set(groupKey, group);
7182
+ }
7183
+ // Keep throughput across independent passports, but process each passport
7184
+ // sequentially so a credential/governor halt leaves later events untouched.
7185
+ while (eventsByPassport.size > 0) {
7175
7186
  if (rateLimitedUntilMs !== null && Date.now() < rateLimitedUntilMs) {
7176
7187
  break;
7177
7188
  }
7178
- const chunk = queuedEvents.slice(i, i + C2_FLUSH_CONCURRENCY);
7179
- await Promise.all(chunk.map(processSingleEvent));
7189
+ const round = [];
7190
+ for (const key of [...eventsByPassport.keys()]) {
7191
+ const group = eventsByPassport.get(key);
7192
+ const event = group?.shift();
7193
+ if (event) {
7194
+ round.push(event);
7195
+ }
7196
+ if (!group || group.length === 0) {
7197
+ eventsByPassport.delete(key);
7198
+ }
7199
+ }
7200
+ for (let i = 0; i < round.length; i += C2_FLUSH_CONCURRENCY) {
7201
+ if (rateLimitedUntilMs !== null && Date.now() < rateLimitedUntilMs) {
7202
+ break;
7203
+ }
7204
+ const chunk = round.slice(i, i + C2_FLUSH_CONCURRENCY);
7205
+ await Promise.all(chunk.map(processSingleEvent));
7206
+ }
7180
7207
  }
7181
7208
  const lastSyncAt = attempted > 0 ? nowIso() : state.last_c2_sync_at;
7182
7209
  const lastSyncError = firstError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forkit-connect",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "Forkit Connect Local Engine - The Global AI Governance Fabric",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -34,7 +34,6 @@
34
34
  "cors": "^2.8.6",
35
35
  "express": "^4.19.2",
36
36
  "ps-list": "^8.1.1",
37
- "uuid": "^10.0.0",
38
37
  "ws": "^8.16.0",
39
38
  "zod": "^3.22.0"
40
39
  },
@@ -43,7 +42,6 @@
43
42
  "@types/cors": "^2.8.19",
44
43
  "@types/express": "^4.17.21",
45
44
  "@types/node": "^20.0.0",
46
- "@types/uuid": "^10.0.0",
47
45
  "@types/ws": "^8.5.10",
48
46
  "typescript": "^5.0.0"
49
47
  },