@volter/supercode-interchange 0.1.18 → 0.1.20
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
|
@@ -150,12 +150,18 @@ export function pushClaudeAttachment(value, out) {
|
|
|
150
150
|
}
|
|
151
151
|
if (text == null || nativeTrim(text) === '') return;
|
|
152
152
|
const message = createMessage('user', text); message.metadata.attachmentType = kind;
|
|
153
|
+
Object.assign(message.metadata, claudeUserProvenance(attachment));
|
|
154
|
+
if (field(attachment, 'humanTurn') === true) message.metadata.origin = 'human';
|
|
153
155
|
const mode = stringField(attachment, 'commandMode'); if (mode != null) message.metadata.commandMode = mode;
|
|
156
|
+
const messageId = stringField(attachment, 'msg_id'); if (messageId != null) message.metadata.native_msg_id = messageId;
|
|
154
157
|
out.push(message);
|
|
155
158
|
}
|
|
156
159
|
|
|
157
160
|
export function captureClaudeProvenance(value, messages, from = 0) {
|
|
158
|
-
const
|
|
161
|
+
const origin = field(value, 'origin');
|
|
162
|
+
// Relay receipts identify Claude's peer message, whose ID lives in origin.
|
|
163
|
+
const messageId = stringField(value, 'msg_id') ?? (stringField(origin, 'kind') === 'peer' ? stringField(origin, 'msg_id') : null);
|
|
164
|
+
const facts = [['timestamp', stringField(value, 'timestamp')], ['claude_uuid', stringField(value, 'uuid')], ['native_msg_id', messageId], ['model', stringField(field(value, 'message'), 'model')]];
|
|
159
165
|
for (let index = from; index < messages.length; index++) for (const [key, fact] of facts) {
|
|
160
166
|
if (fact != null && !Object.hasOwn(messages[index].metadata, key)) messages[index].metadata[key] = fact;
|
|
161
167
|
}
|