omnikey-cli 1.0.26 → 1.0.27
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.
|
@@ -746,5 +746,59 @@ function createAgentRouter() {
|
|
|
746
746
|
res.status(500).json({ error: 'Internal server error' });
|
|
747
747
|
}
|
|
748
748
|
});
|
|
749
|
+
// GET /api/agent/sessions/:sessionId/messages
|
|
750
|
+
// Returns a compact, human-readable transcript of the session history
|
|
751
|
+
// (user + assistant turns only, internal XML tags stripped).
|
|
752
|
+
router.get('/sessions/:sessionId/messages', async (req, res) => {
|
|
753
|
+
const { subscription, logger: log } = res.locals;
|
|
754
|
+
const { sessionId } = req.params;
|
|
755
|
+
if (!sessionId || typeof sessionId !== 'string' || sessionId.length > 128) {
|
|
756
|
+
res.status(400).json({ error: 'Invalid session ID' });
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
try {
|
|
760
|
+
const session = await agentSession_1.AgentSession.findOne({
|
|
761
|
+
where: { id: sessionId, subscriptionId: subscription.id },
|
|
762
|
+
attributes: ['id', 'historyJson'],
|
|
763
|
+
});
|
|
764
|
+
if (!session) {
|
|
765
|
+
res.status(404).json({ error: 'Session not found' });
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
const raw = JSON.parse(session.historyJson || '[]');
|
|
769
|
+
// Strip / unwrap all internal XML-like tags used by the agent protocol.
|
|
770
|
+
const stripInternals = (text) => text
|
|
771
|
+
// Unwrap user input — keep the inner text, drop the tag.
|
|
772
|
+
.replace(/<user_input>([\s\S]*?)<\/user_input>/gi, '$1')
|
|
773
|
+
// Unwrap final answer — keep the inner text, drop the tag.
|
|
774
|
+
.replace(/<final_answer>([\s\S]*?)<\/final_answer>/gi, '$1')
|
|
775
|
+
// Replace shell script blocks with a placeholder.
|
|
776
|
+
.replace(/<shell_script[\s\S]*?<\/shell_script>/gi, '[shell command]')
|
|
777
|
+
// Drop stored instructions entirely — not meaningful to the user.
|
|
778
|
+
.replace(/<stored_instructions>[\s\S]*?<\/stored_instructions>/gi, '')
|
|
779
|
+
// Drop terminal output blocks — shown separately on the client.
|
|
780
|
+
.replace(/<terminal[\s\S]*?<\/terminal>/gi, '')
|
|
781
|
+
// Drop the @omniAgent mention that triggers the agent.
|
|
782
|
+
.replace(/@omniagent/gi, '')
|
|
783
|
+
.trim();
|
|
784
|
+
const MAX_CHARS = 5000;
|
|
785
|
+
const messages = raw
|
|
786
|
+
.filter((m) => m.role === 'user' || m.role === 'assistant')
|
|
787
|
+
.map((m, index) => {
|
|
788
|
+
const rawText = typeof m.content === 'string' ? m.content : JSON.stringify(m.content);
|
|
789
|
+
const cleaned = stripInternals(rawText);
|
|
790
|
+
const truncated = cleaned.length > MAX_CHARS
|
|
791
|
+
? cleaned.slice(0, MAX_CHARS) + '… [message truncated]'
|
|
792
|
+
: cleaned;
|
|
793
|
+
return { id: `${index}-${m.role}`, role: m.role, text: truncated };
|
|
794
|
+
})
|
|
795
|
+
.filter((m) => m.text.length > 0);
|
|
796
|
+
res.json({ messages });
|
|
797
|
+
}
|
|
798
|
+
catch (err) {
|
|
799
|
+
log.error('Failed to fetch agent session messages', { sessionId, error: err });
|
|
800
|
+
res.status(500).json({ error: 'Internal server error' });
|
|
801
|
+
}
|
|
802
|
+
});
|
|
749
803
|
return router;
|
|
750
804
|
}
|
package/backend-dist/index.js
CHANGED
|
@@ -68,8 +68,8 @@ app.get('/macos/appcast', (req, res) => {
|
|
|
68
68
|
const appcastUrl = `${baseUrl}/macos/appcast`;
|
|
69
69
|
// These should match the values embedded into the macOS app
|
|
70
70
|
// Info.plist in macOS/build_release_dmg.sh.
|
|
71
|
-
const bundleVersion = '
|
|
72
|
-
const shortVersion = '1.0.
|
|
71
|
+
const bundleVersion = '21';
|
|
72
|
+
const shortVersion = '1.0.20';
|
|
73
73
|
const xml = `<?xml version="1.0" encoding="utf-8"?>
|
|
74
74
|
<rss version="2.0"
|
|
75
75
|
xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public",
|
|
5
5
|
"registry": "https://registry.npmjs.org/"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.0.
|
|
7
|
+
"version": "1.0.27",
|
|
8
8
|
"description": "CLI for onboarding users to Omnikey AI and configuring OPENAI_API_KEY. Use Yarn for install/build.",
|
|
9
9
|
"engines": {
|
|
10
10
|
"node": ">=14.0.0",
|