integram-mcp 0.7.131 → 0.7.133

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.
Files changed (3) hide show
  1. package/README.md +4 -4
  2. package/index.js +40 -6
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -15,7 +15,7 @@ claude mcp add integram \
15
15
  -e INTEGRAM_URL=https://ai2o.online \
16
16
  -e INTEGRAM_EMAIL=you@example.com \
17
17
  -e INTEGRAM_PASSWORD=secret \
18
- -- npx -y integram-mcp@0.7.131
18
+ -- npx -y integram-mcp@0.7.133
19
19
  ```
20
20
 
21
21
  Ставить ничего не нужно: `npx` скачает пакет сам.
@@ -49,7 +49,7 @@ claude mcp add integram \
49
49
  -e INTEGRAM_URL=http://localhost:8081 \
50
50
  -e INTEGRAM_EMAIL=you@example.com \
51
51
  -e INTEGRAM_PASSWORD=secret \
52
- -- npx -y integram-mcp@0.7.131
52
+ -- npx -y integram-mcp@0.7.133
53
53
  ```
54
54
 
55
55
  Удалить: `claude mcp remove integram`
@@ -63,7 +63,7 @@ claude mcp add integram \
63
63
  "mcpServers": {
64
64
  "integram": {
65
65
  "command": "npx",
66
- "args": ["-y", "integram-mcp@0.7.131"],
66
+ "args": ["-y", "integram-mcp@0.7.133"],
67
67
  "env": {
68
68
  "INTEGRAM_URL": "https://ai2o.online",
69
69
  "INTEGRAM_EMAIL": "you@example.com",
@@ -83,7 +83,7 @@ claude mcp add integram \
83
83
  "mcpServers": {
84
84
  "integram": {
85
85
  "command": "npx",
86
- "args": ["-y", "integram-mcp@0.7.131"],
86
+ "args": ["-y", "integram-mcp@0.7.133"],
87
87
  "env": {
88
88
  "INTEGRAM_URL": "https://ai2o.online",
89
89
  "INTEGRAM_EMAIL": "you@example.com",
package/index.js CHANGED
@@ -241,6 +241,10 @@ export function withUpdateNotice(result) {
241
241
  extra.push(memoryBriefing);
242
242
  memoryBriefing = null; // one-shot: один брифинг на выбор воркспейса
243
243
  }
244
+ if (instanceNotice) {
245
+ extra.push(instanceNotice);
246
+ instanceNotice = null; // one-shot: блок платформы — один раз на процесс
247
+ }
244
248
  if (!extra.length) return result;
245
249
  return { ...result, content: [...result.content, { type: 'text', text: extra.join('\n') }] };
246
250
  }
@@ -275,9 +279,20 @@ export function buildUnreadNoticeText(data) {
275
279
 
276
280
  let memoryBriefing = null; // текст текущего воркспейса, one-shot
277
281
  let memoryBriefingWs = null; // для какого воркспейса собран
282
+ // Инстанс-правила («Правила платформы») — уровень ПРОЦЕССА: блок платформы
283
+ // доставляется один раз на жизнь процесса. При старте без воркспейса он едет
284
+ // в приписке первого ответа; пер-воркспейсный брифинг после этого просит
285
+ // только воркспейсный слой (?scope=workspace). Рестарт процесса возвращает
286
+ // блок — та же семантика, что у совета по версии; это названная цена.
287
+ let instanceNotice = null; // one-shot текст блока платформы
288
+ let instanceDelivered = false; // блок уже доставлен в этой жизни процесса
278
289
 
279
290
  export function setMemoryBriefing(text, ws) { memoryBriefing = text; memoryBriefingWs = ws; }
280
291
 
292
+ // Тестам и (будущему) ручному обновлению слоя; instanceDelivered не сбрасываем —
293
+ // дедуп в пределах жизни процесса не должен обходиться через сеттер.
294
+ export function setInstanceNotice(text) { instanceNotice = text; }
295
+
281
296
  export function buildMemoryBriefingText({ rules, items }) {
282
297
  const parts = [];
283
298
  if (rules) parts.push(String(rules).trim());
@@ -298,11 +313,28 @@ async function checkMemoryBriefing() {
298
313
  // Фиксируем воркспейс ДО await: две быстрые смены подряд не должны дать
299
314
  // позднему ответу пометить текст чужим слагом (гоночная заметка ревью).
300
315
  const ws = workspace;
301
- if (!ws || memoryBriefingWs === ws) return;
316
+ // Без воркспейса — единственный шанс доставить инстанс-слой ДО первого
317
+ // выбора (сессия стартует с (none)); блок платформы eдет один раз на процесс.
318
+ if (!ws) {
319
+ if (instanceDelivered) return;
320
+ try {
321
+ await ensureAuth();
322
+ const res = await apiFetch('/api/v2/instance/swarm-memory/rules', { signal: AbortSignal.timeout(3000) });
323
+ const rules = (res.data || res)?.rules || '';
324
+ if (rules) {
325
+ instanceNotice = ['\n📎 Правила платформы (общие для всех воркспейсов):', String(rules).trim()].join('\n');
326
+ log(instanceNotice);
327
+ }
328
+ instanceDelivered = true; // ставим и при пустом слое — второй фетч не нужен
329
+ } catch { /* нет сети — при следующем (none)-вызове повторим */ }
330
+ return;
331
+ }
332
+ if (memoryBriefingWs === ws) return;
302
333
  try {
303
334
  await ensureAuth();
335
+ const rulesScope = instanceDelivered ? '?scope=workspace' : ''; // дедуп: блок платформы уже в контексте
304
336
  const [rulesRes, recallRes] = await Promise.all([
305
- apiFetch(`/api/v2/${ws}/swarm-memory/rules`, { signal: AbortSignal.timeout(3000) }),
337
+ apiFetch(`/api/v2/${ws}/swarm-memory/rules${rulesScope}`, { signal: AbortSignal.timeout(3000) }),
306
338
  apiFetch(`/api/v2/${ws}/swarm-memory/recall`, { signal: AbortSignal.timeout(3000) }),
307
339
  ]);
308
340
  if (memoryBriefingWs === ws) return; // воркспейс сменился, пока летел запрос
@@ -311,6 +343,8 @@ async function checkMemoryBriefing() {
311
343
  const text = buildMemoryBriefingText({ rules, items });
312
344
  setMemoryBriefing(text, ws);
313
345
  if (text) log(text);
346
+ // Без ?scope прилетели ОБА блока — инстанс-слой уже в контексте, дальше дедуп
347
+ if (!rulesScope) instanceDelivered = true;
314
348
  } catch { /* нет сети — сессия работает без брифинга */ }
315
349
  }
316
350
 
@@ -949,7 +983,7 @@ Activate via search_tools("memory").
949
983
  - share_insight(key, value) — share with other agents in shared namespace
950
984
  - find_procedure(query) — find step-by-step recipes from memory
951
985
  - list_contradictions / resolve_contradiction — manage conflicting facts
952
- - Правила и топ-факты воркспейса сервер сам приписывает к первому ответу (recall для этого не зови); общие для ВСЕХ агентов правила пиши через add_rule — их подхватывает каждый внутренний агент.
986
+ - Правила и топ-факты воркспейса сервер сам приписывает к первому ответу (recall для этого не зови); правила воркспейса пиши через add_rule (без scope) — их подхватывает каждый внутренний агент. scope=instance — только admin, факты/указатели для всех воркспейсов инстанса.
953
987
 
954
988
  ## Portal (admin)
955
989
 
@@ -1765,9 +1799,9 @@ export const EN_DESCRIPTIONS = {
1765
1799
  list_contradictions: 'Show unresolved contradictions in memory. Use when you need to clarify with the user what is current.',
1766
1800
  resolve_contradiction: 'Resolve a contradiction between two memory facts after clarifying with the user.',
1767
1801
  find_procedure: 'Find a procedure (step-by-step recipe) in memory by topic. Use before complex operations.',
1768
- list_rules: 'Show all workspace rules — positive instructions all agents must follow.',
1769
- add_rule: 'Add a workspace rule — a positive instruction for all agents (max 500 chars, up to 50 rules).',
1770
- remove_rule: 'Remove a workspace rule by key. Get keys via list_rules.',
1802
+ list_rules: 'Show rules — workspace layer by default, or the instance layer (scope=instance: facts/pointers for ALL workspaces).',
1803
+ add_rule: 'Add a workspace rule — a positive instruction for all agents (max 500 chars, up to 50 rules). scope=instance: admin-only, max 300 chars, FACT or POINTER only, never a directive (lands in every workspace context; keep the layer under ~10 entries).',
1804
+ remove_rule: 'Remove a rule by key. Get keys via list_rules.',
1771
1805
  list_shared_memories: 'List shared memories available to all agents.',
1772
1806
  get_shared_state: 'Get a value from the shared state. Without a key — all entries.',
1773
1807
  set_shared_state: 'Set a value in the shared state to coordinate between agents.',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "integram-mcp",
3
- "version": "0.7.131",
3
+ "version": "0.7.133",
4
4
  "type": "module",
5
5
  "description": "MCP server for Integram — connect AI assistants to your workspace via Model Context Protocol",
6
6
  "mcpName": "io.github.judas-priest/integram",