@kingsoftcloud/agentkit-harness-node 0.0.10 → 0.0.12
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kingsoftcloud/agentkit-harness-node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Standalone Native Harness Node adapters: a durable SQLite run store, a one-request model HTTP port, and a minimal versioned JSON-RPC 2.0 over NDJSON process entry. Reuses the shared Native adapter implementations and externalizes @kingsoftcloud/agentkit-harness-core; depends on no Studio/DSH code at runtime.",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"src/package-integrity.mjs"
|
|
138
138
|
],
|
|
139
139
|
"dependencies": {
|
|
140
|
-
"@kingsoftcloud/agentkit-harness-core": "0.0.
|
|
140
|
+
"@kingsoftcloud/agentkit-harness-core": "0.0.12",
|
|
141
141
|
"@astral-sh/ruff-wasm-nodejs": "0.16.8",
|
|
142
142
|
"parse5": "7.3.0",
|
|
143
143
|
"playwright-core": "1.58.2",
|
|
@@ -27,6 +27,18 @@ export function nativeToolOutcomeFact(identity, callId, status, presentationTurn
|
|
|
27
27
|
callId: nativeDeliveryId(identity.scope, identity.runId, `call:${callId}`), status };
|
|
28
28
|
}
|
|
29
29
|
const hash = value => createHash('sha256').update(canonical(value)).digest('hex');
|
|
30
|
+
/** Delivery atoms are idempotent: a repeated key must carry identical content.
|
|
31
|
+
* A mismatch means either the journal was written by an older delivery contract
|
|
32
|
+
* or a retried delivery changed its payload. Failing the whole projection makes
|
|
33
|
+
* the session history unreadable, so keep the first delivered atom and skip the
|
|
34
|
+
* conflicting duplicate (the host then renders the first delivery). */
|
|
35
|
+
const reportedDeliveryConflicts = new Set();
|
|
36
|
+
function reportDeliveryConflict(key) {
|
|
37
|
+
if (reportedDeliveryConflicts.has(key)) return;
|
|
38
|
+
reportedDeliveryConflicts.add(key);
|
|
39
|
+
console.warn('[agentkit-harness] native delivery atom conflict; keeping the first atom', { key });
|
|
40
|
+
}
|
|
41
|
+
|
|
30
42
|
const ownObject = value => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
31
43
|
|
|
32
44
|
/** Public display deltas only. Opaque replay/signatures and tool previews are never content. */
|
|
@@ -113,7 +125,10 @@ export function nativeDeliveryProjection() {
|
|
|
113
125
|
const key = atomKey(event);
|
|
114
126
|
if (key === null) return state;
|
|
115
127
|
const fingerprint = atomDigest(event);
|
|
116
|
-
|
|
128
|
+
if (Object.hasOwn(state.atoms, key) && state.atoms[key] !== fingerprint) {
|
|
129
|
+
reportDeliveryConflict(key);
|
|
130
|
+
return state;
|
|
131
|
+
}
|
|
117
132
|
const head = event.type === 'system/message' && event.surfaceOp
|
|
118
133
|
? { id: event.data.message.id, seq: event.seq, content: event.data.message.content } : state.head;
|
|
119
134
|
return { ...state, atoms: { ...state.atoms, [key]: fingerprint }, seqs: { ...state.seqs, [key]: event.seq }, head,
|
|
@@ -171,7 +186,10 @@ export function createNativeSessionDelivery({ store, scope, runId, session, turn
|
|
|
171
186
|
const event = { type, data, ...options }, key = atomKey(event);
|
|
172
187
|
invariant(key !== null, 'native_delivery_event_invalid');
|
|
173
188
|
const fingerprint = atomDigest(event), previous = state().atoms[key];
|
|
174
|
-
if (previous !== undefined) {
|
|
189
|
+
if (previous !== undefined) {
|
|
190
|
+
if (previous !== fingerprint) reportDeliveryConflict(key);
|
|
191
|
+
return state().seqs[key];
|
|
192
|
+
}
|
|
175
193
|
session.append(type, data, options);
|
|
176
194
|
invariant(state().atoms[key] === fingerprint, 'native_delivery_projection_not_advanced');
|
|
177
195
|
return state().seqs[key];
|