@xenosystem/agent-interface-host 0.1.157 → 0.1.158
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.
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Does a client's saved copy of a conversation say what the host's log says? (Decision 0001.)
|
|
3
|
+
*
|
|
4
|
+
* The copy can only be retired once the log can stand in for it, and this measures that rather than assuming it. Read
|
|
5
|
+
* only: it reports lengths and ids, never a word of the conversation, so its output is safe to paste anywhere.
|
|
6
|
+
*
|
|
7
|
+
* @unwired-by-design A measurement, called by `scripts/smoke-terminal-conversation.mjs`, not by the running host.
|
|
8
|
+
*/
|
|
9
|
+
import type { AgentConversationTranscriptItem } from '@xenosystem/agent-interface-contract';
|
|
10
|
+
export interface ConversationParityReport {
|
|
11
|
+
turnsCompared: number;
|
|
12
|
+
/** Replies the host has and the copy does not. */
|
|
13
|
+
onlyInHost: string[];
|
|
14
|
+
/** Replies the copy has and the host does not: what would be lost if the copy went away today. */
|
|
15
|
+
onlyInCopy: string[];
|
|
16
|
+
replyTextDiffers: Array<{
|
|
17
|
+
requestId: string;
|
|
18
|
+
copyLength: number;
|
|
19
|
+
hostLength: number;
|
|
20
|
+
}>;
|
|
21
|
+
promptTextDiffers: Array<{
|
|
22
|
+
requestId: string;
|
|
23
|
+
copyLength: number;
|
|
24
|
+
hostLength: number;
|
|
25
|
+
}>;
|
|
26
|
+
toolCountDiffers: Array<{
|
|
27
|
+
requestId: string;
|
|
28
|
+
copy: number;
|
|
29
|
+
host: number;
|
|
30
|
+
}>;
|
|
31
|
+
/** Reply ids in the copy that hold things a transcript has no place for, by what they hold. */
|
|
32
|
+
copyOnly: Record<string, string[]>;
|
|
33
|
+
clean: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare function compareConversationCopy(messages: readonly unknown[], items: readonly AgentConversationTranscriptItem[]): ConversationParityReport;
|
|
36
|
+
//# sourceMappingURL=conversationParity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversationParity.d.ts","sourceRoot":"","sources":["../../src/transcript/conversationParity.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAA;AAE3F,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,MAAM,CAAA;IACrB,kDAAkD;IAClD,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,kGAAkG;IAClG,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,gBAAgB,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACtF,iBAAiB,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACvF,gBAAgB,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC1E,+FAA+F;IAC/F,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IAClC,KAAK,EAAE,OAAO,CAAA;CACf;AAMD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,+BAA+B,EAAE,GAAG,wBAAwB,CAuCjJ"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const text = (value) => (typeof value === 'string' ? value.trim() : '');
|
|
2
|
+
const hasItems = (value) => Array.isArray(value) && value.length > 0;
|
|
3
|
+
export function compareConversationCopy(messages, items) {
|
|
4
|
+
const prompts = new Map(items.flatMap((item) => (item.kind === 'user' ? [[item.requestId, item.text]] : [])));
|
|
5
|
+
const replies = new Map(items.flatMap((item) => (item.kind === 'assistant' ? [[item.requestId, item]] : [])));
|
|
6
|
+
const report = { turnsCompared: 0, onlyInHost: [], onlyInCopy: [], replyTextDiffers: [], promptTextDiffers: [], toolCountDiffers: [], copyOnly: {}, clean: true };
|
|
7
|
+
const note = (what, id) => { (report.copyOnly[what] ??= []).push(id); };
|
|
8
|
+
const seen = new Set();
|
|
9
|
+
let lastPrompt;
|
|
10
|
+
for (const value of messages) {
|
|
11
|
+
const message = value;
|
|
12
|
+
if (message.role === 'user') {
|
|
13
|
+
lastPrompt = message;
|
|
14
|
+
if (hasItems(message.attachments))
|
|
15
|
+
note('attachments', String(message.id));
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
const id = String(message.id);
|
|
19
|
+
if (message.isCommandResult) {
|
|
20
|
+
lastPrompt = undefined;
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (message.rating)
|
|
24
|
+
note('rating', id);
|
|
25
|
+
const reply = replies.get(id);
|
|
26
|
+
if (!reply) {
|
|
27
|
+
report.onlyInCopy.push(id);
|
|
28
|
+
lastPrompt = undefined;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
seen.add(id);
|
|
32
|
+
report.turnsCompared += 1;
|
|
33
|
+
const copyText = text(message.content);
|
|
34
|
+
const hostText = text(reply.text);
|
|
35
|
+
if (copyText !== hostText)
|
|
36
|
+
report.replyTextDiffers.push({ requestId: id, copyLength: copyText.length, hostLength: hostText.length });
|
|
37
|
+
const hostPrompt = text(prompts.get(id));
|
|
38
|
+
const copyPrompt = text(lastPrompt?.content);
|
|
39
|
+
if (lastPrompt && copyPrompt !== hostPrompt)
|
|
40
|
+
report.promptTextDiffers.push({ requestId: id, copyLength: copyPrompt.length, hostLength: hostPrompt.length });
|
|
41
|
+
const copyTools = Array.isArray(message.toolCalls) ? message.toolCalls.length : 0;
|
|
42
|
+
if (copyTools !== reply.tools.length)
|
|
43
|
+
report.toolCountDiffers.push({ requestId: id, copy: copyTools, host: reply.tools.length });
|
|
44
|
+
lastPrompt = undefined;
|
|
45
|
+
}
|
|
46
|
+
for (const id of replies.keys())
|
|
47
|
+
if (!seen.has(id))
|
|
48
|
+
report.onlyInHost.push(id);
|
|
49
|
+
report.clean = !report.onlyInHost.length && !report.onlyInCopy.length && !report.replyTextDiffers.length
|
|
50
|
+
&& !report.promptTextDiffers.length && !report.toolCountDiffers.length;
|
|
51
|
+
return report;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=conversationParity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversationParity.js","sourceRoot":"","sources":["../../src/transcript/conversationParity.ts"],"names":[],"mappings":"AAyBA,MAAM,IAAI,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AAChF,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAA;AAE7E,MAAM,UAAU,uBAAuB,CAAC,QAA4B,EAAE,KAAiD;IACrH,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IACtH,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,C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,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;QAChI,UAAU,GAAG,SAAS,CAAA;IACxB,CAAC;IACD,KAAK,MAAM,EAAE,IAAI,OAAO,CAAC,IAAI,EAAE;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC9E,MAAM,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM;WACnG,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAA;IACxE,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xenosystem/agent-interface-host",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.158",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"@xenosystem/capability-sdk": "0.1.1",
|
|
38
38
|
"@xenosystem/primitives": "0.3.1",
|
|
39
39
|
"zod": "4.6.7",
|
|
40
|
-
"@xenosystem/
|
|
41
|
-
"@xenosystem/
|
|
42
|
-
"@xenosystem/agent-interface-core": "0.1.
|
|
40
|
+
"@xenosystem/capability-mcp": "0.1.158",
|
|
41
|
+
"@xenosystem/agent-interface-contract": "0.1.158",
|
|
42
|
+
"@xenosystem/agent-interface-core": "0.1.158"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
45
|
"@xenosystem/acp-agent": "0.2.25",
|
|
46
|
-
"@xenosystem/agent-interface-client": "0.1.
|
|
46
|
+
"@xenosystem/agent-interface-client": "0.1.158"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@xeno-corporation/account": "0.4.1",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"better-sqlite3": "13.0.3",
|
|
67
67
|
"node-pty": "^1.1.0",
|
|
68
68
|
"fflate": "^0.8.3",
|
|
69
|
-
"@xenosystem/agent-interface-client": "0.1.
|
|
69
|
+
"@xenosystem/agent-interface-client": "0.1.158"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {}
|
|
72
72
|
}
|