@dmsdc-ai/aigentry-telepty 0.1.91 → 0.1.93
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/daemon.js +6 -18
- package/entitlement.js +1 -1
- package/package.json +1 -1
package/daemon.js
CHANGED
|
@@ -584,8 +584,12 @@ async function deliverInjectionToSession(id, session, prompt, options = {}) {
|
|
|
584
584
|
mailboxNotifier.notify(id);
|
|
585
585
|
}
|
|
586
586
|
|
|
587
|
-
//
|
|
588
|
-
|
|
587
|
+
// Deliver synchronously — ensures text is written before inject returns success.
|
|
588
|
+
// Mailbox gives us persistence/retry, but the initial delivery must complete
|
|
589
|
+
// before the HTTP response so --submit timing and CR delivery are reliable.
|
|
590
|
+
try {
|
|
591
|
+
await mailboxDelivery.tick();
|
|
592
|
+
} catch {}
|
|
589
593
|
|
|
590
594
|
session.lastActivityAt = new Date(now).toISOString();
|
|
591
595
|
return {
|
|
@@ -784,13 +788,6 @@ app.post('/api/sessions/spawn', (req, res) => {
|
|
|
784
788
|
const { session_id, command, args = [], cwd = process.cwd(), cols = 80, rows = 30, type = 'AGENT' } = req.body;
|
|
785
789
|
if (!session_id) return res.status(400).json({ error: 'session_id is strictly required.' });
|
|
786
790
|
if (sessions[session_id]) return res.status(409).json({ error: `Session ID '${session_id}' is already active.` });
|
|
787
|
-
// Entitlement: check session limit
|
|
788
|
-
const sessionCount = Object.keys(sessions).length;
|
|
789
|
-
const ent = checkEntitlement({ feature: 'telepty.multi_session', currentUsage: sessionCount });
|
|
790
|
-
if (!ent.allowed) {
|
|
791
|
-
console.log(`[ENTITLEMENT] Session limit reached (${sessionCount}/${ent.limit?.max || '?'}), tier: ${ent.tier}`);
|
|
792
|
-
return res.status(402).json({ error: ent.reason, upgrade_url: ent.upgrade_url, tier: ent.tier });
|
|
793
|
-
}
|
|
794
791
|
if (!command) return res.status(400).json({ error: 'command is required' });
|
|
795
792
|
|
|
796
793
|
const isWin = os.platform() === 'win32';
|
|
@@ -895,15 +892,6 @@ app.post('/api/sessions/spawn', (req, res) => {
|
|
|
895
892
|
app.post('/api/sessions/register', (req, res) => {
|
|
896
893
|
const { session_id, command, cwd = process.cwd(), backend, cmux_workspace_id, cmux_surface_id, term_program, term } = req.body;
|
|
897
894
|
if (!session_id) return res.status(400).json({ error: 'session_id is required' });
|
|
898
|
-
// Entitlement: check session limit for new registrations (exempt aterm — embedded IPC, no PTY cost)
|
|
899
|
-
if (!sessions[session_id] && req.body.delivery_type !== 'aterm') {
|
|
900
|
-
const sessionCount = Object.keys(sessions).length;
|
|
901
|
-
const ent = checkEntitlement({ feature: 'telepty.multi_session', currentUsage: sessionCount });
|
|
902
|
-
if (!ent.allowed) {
|
|
903
|
-
console.log(`[ENTITLEMENT] Session limit reached (${sessionCount}/${ent.limit?.max || '?'}), tier: ${ent.tier}`);
|
|
904
|
-
return res.status(402).json({ error: ent.reason, upgrade_url: ent.upgrade_url, tier: ent.tier });
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
895
|
// Idempotent: allow re-registration (update command/cwd, keep clients)
|
|
908
896
|
if (sessions[session_id]) {
|
|
909
897
|
const existing = sessions[session_id];
|
package/entitlement.js
CHANGED
|
@@ -9,7 +9,7 @@ const UPGRADE_URL = 'https://aigentry.dev/upgrade';
|
|
|
9
9
|
|
|
10
10
|
const FEATURES = {
|
|
11
11
|
'telepty.core': { tiers: ['free', 'pro', 'team'] },
|
|
12
|
-
'telepty.multi_session': { tiers: ['pro', 'team']
|
|
12
|
+
'telepty.multi_session': { tiers: ['free', 'pro', 'team'] },
|
|
13
13
|
'telepty.remote_sessions': { tiers: ['pro', 'team'] },
|
|
14
14
|
'telepty.team_broadcast': { tiers: ['team'] }
|
|
15
15
|
};
|