instar 0.9.0 → 0.9.2

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 (59) hide show
  1. package/dist/cli.js +0 -0
  2. package/dist/commands/server.d.ts.map +1 -1
  3. package/dist/commands/server.js +202 -71
  4. package/dist/commands/server.js.map +1 -1
  5. package/dist/commands/setup.d.ts.map +1 -1
  6. package/dist/commands/setup.js +38 -4
  7. package/dist/commands/setup.js.map +1 -1
  8. package/dist/core/AgentConnector.d.ts +76 -0
  9. package/dist/core/AgentConnector.d.ts.map +1 -0
  10. package/dist/core/AgentConnector.js +323 -0
  11. package/dist/core/AgentConnector.js.map +1 -0
  12. package/dist/core/AutoUpdater.d.ts +7 -0
  13. package/dist/core/AutoUpdater.d.ts.map +1 -1
  14. package/dist/core/AutoUpdater.js +31 -3
  15. package/dist/core/AutoUpdater.js.map +1 -1
  16. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  17. package/dist/core/PostUpdateMigrator.js +86 -5
  18. package/dist/core/PostUpdateMigrator.js.map +1 -1
  19. package/dist/core/StateWriteAuthority.d.ts +101 -0
  20. package/dist/core/StateWriteAuthority.d.ts.map +1 -0
  21. package/dist/core/StateWriteAuthority.js +167 -0
  22. package/dist/core/StateWriteAuthority.js.map +1 -0
  23. package/dist/core/types.d.ts +104 -0
  24. package/dist/core/types.d.ts.map +1 -1
  25. package/dist/index.d.ts +2 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +1 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/memory/TopicMemory.d.ts +167 -0
  30. package/dist/memory/TopicMemory.d.ts.map +1 -0
  31. package/dist/memory/TopicMemory.js +494 -0
  32. package/dist/memory/TopicMemory.js.map +1 -0
  33. package/dist/memory/TopicSummarizer.d.ts +58 -0
  34. package/dist/memory/TopicSummarizer.d.ts.map +1 -0
  35. package/dist/memory/TopicSummarizer.js +140 -0
  36. package/dist/memory/TopicSummarizer.js.map +1 -0
  37. package/dist/messaging/TelegramAdapter.d.ts +35 -0
  38. package/dist/messaging/TelegramAdapter.d.ts.map +1 -1
  39. package/dist/messaging/TelegramAdapter.js +136 -2
  40. package/dist/messaging/TelegramAdapter.js.map +1 -1
  41. package/dist/server/AgentServer.d.ts +2 -0
  42. package/dist/server/AgentServer.d.ts.map +1 -1
  43. package/dist/server/AgentServer.js +1 -0
  44. package/dist/server/AgentServer.js.map +1 -1
  45. package/dist/server/routes.d.ts +2 -0
  46. package/dist/server/routes.d.ts.map +1 -1
  47. package/dist/server/routes.js +340 -1
  48. package/dist/server/routes.js.map +1 -1
  49. package/dist/users/UserManager.d.ts +21 -0
  50. package/dist/users/UserManager.d.ts.map +1 -1
  51. package/dist/users/UserManager.js +32 -0
  52. package/dist/users/UserManager.js.map +1 -1
  53. package/dist/users/UserOnboarding.d.ts +116 -0
  54. package/dist/users/UserOnboarding.d.ts.map +1 -0
  55. package/dist/users/UserOnboarding.js +365 -0
  56. package/dist/users/UserOnboarding.js.map +1 -0
  57. package/package.json +2 -1
  58. package/upgrades/0.8.23.md +106 -0
  59. package/upgrades/0.9.1.md +91 -0
@@ -0,0 +1,91 @@
1
+ # Upgrade Guide: Instar 0.9.1
2
+
3
+ ## What Changed
4
+
5
+ ### TopicMemory — Persistent Conversational Memory per Topic Thread
6
+
7
+ Previously, you had access to the last 20 messages of a topic when responding to a Telegram message. If the conversation was longer than that, everything before the last 20 messages was lost — no continuity, no recall of earlier decisions, no memory of what was discussed days ago.
8
+
9
+ Now Instar maintains a **persistent SQLite database** of all Telegram topic messages with:
10
+
11
+ - **Full-text search** (FTS5) across all topics — find any past message by keyword
12
+ - **Rolling summaries** — LLM-generated summaries of long conversations, updated incrementally
13
+ - **Rich context loading** — summary + recent messages loaded as your highest-priority context at session start
14
+
15
+ This means you can have a 500-message conversation over weeks and still understand the full context when the user sends a new message.
16
+
17
+ ### How It Works
18
+
19
+ 1. **Dual-write**: Every Telegram message (inbound and outbound) is written to both the JSONL log (source of truth) and the SQLite database (query layer).
20
+ 2. **Session context**: When a session starts for a topic, you receive the topic summary (if one exists) plus the most recent messages. This appears BEFORE your identity files — it's your highest-priority context.
21
+ 3. **Auto-summarization**: When a session ends, if the topic has accumulated enough new messages (default: 20+), a summary is automatically generated or updated using a fast LLM model.
22
+ 4. **Rebuild safety**: The SQLite database can be rebuilt from the JSONL log at any time — the JSONL is the source of truth, SQLite is the query acceleration layer.
23
+
24
+ ### Topic History as Primary Context
25
+
26
+ When you start a session for a Telegram topic, the first thing you see in your context is:
27
+
28
+ ```
29
+ ── TOPIC CONTEXT (Topic: <name>) ──
30
+ Summary: <rolling summary of the full conversation>
31
+
32
+ Recent messages:
33
+ [timestamp] User: ...
34
+ [timestamp] Agent: ...
35
+ ```
36
+
37
+ This comes BEFORE AGENT.md and MEMORY.md. It is your most fundamental context — it tells you what you and the user have been working on in this specific thread.
38
+
39
+ ### Shared Spawn Path — All Sessions Get Topic History
40
+
41
+ Previously, only "respawn" sessions (user typing `/respawn`) got topic history. Auto-spawned sessions (triggered by the user just sending a message) did NOT get history — they started cold with no context.
42
+
43
+ Now both paths use the same `spawnSessionForTopic()` function. Every session, regardless of how it's triggered, gets full topic history.
44
+
45
+ ### Structural Telegram Relay
46
+
47
+ Previously, whether you relayed your response back to Telegram depended on reading a temporary context file. If that file wasn't loaded or was lost during compaction, you'd forget to relay.
48
+
49
+ Now the Telegram relay instructions are embedded structurally in your session-start hook via the `INSTAR_TELEGRAM_TOPIC` environment variable. The hook itself contains the relay instructions — they can't be lost to compaction.
50
+
51
+ **What you should do:**
52
+ - After responding to a user's Telegram message, ALWAYS relay your response back using the command shown in your session-start context
53
+ - This is now a structural expectation, not a "nice to have"
54
+
55
+ ### Update Notification Fix
56
+
57
+ Previously, version update notifications always promised "I'll send you a summary of what's new once I'm back up" — even when no upgrade guide existed for the new version. This created a broken commitment. Now the notification simply says the version was updated, and only mentions summaries when an upgrade guide actually exists.
58
+
59
+ ## API Endpoints (For Your Use)
60
+
61
+ These endpoints are available on the Instar server for you to use programmatically:
62
+
63
+ | Endpoint | Method | What It Does |
64
+ |----------|--------|-------------|
65
+ | `/topic/search?q=keyword` | GET | Full-text search across all topics |
66
+ | `/topic/search?q=keyword&topic=N` | GET | Search within a specific topic |
67
+ | `/topic/context/:topicId` | GET | Get summary + recent messages for a topic |
68
+ | `/topic/list` | GET | List all topics with metadata |
69
+ | `/topic/stats` | GET | Database statistics (message count, size, etc.) |
70
+ | `/topic/summarize` | POST | Check if a topic needs summary update |
71
+ | `/topic/summary` | POST | Save a generated summary |
72
+ | `/topic/rebuild` | POST | Rebuild database from JSONL source |
73
+
74
+ All endpoints require your standard Bearer token authentication.
75
+
76
+ ## What to Tell Your User
77
+
78
+ - **Better memory**: "I now maintain a persistent memory of our conversations in each topic thread. Even if we've exchanged hundreds of messages over weeks, I'll have context from the full history — not just the last 20 messages."
79
+ - **Seamless continuity**: "When you message me, I automatically load a summary of everything we've discussed in that thread plus the most recent messages. You won't need to repeat context."
80
+ - **Search**: "I can search through our past conversations by keyword. If you need me to find something we discussed, just ask."
81
+
82
+ ## Summary of New Capabilities
83
+
84
+ | Capability | How to Use |
85
+ |-----------|-----------|
86
+ | Topic memory | Automatic — all messages stored and indexed |
87
+ | Rolling summaries | Automatic — generated on session end when threshold exceeded |
88
+ | Full-text search | Use `/topic/search` API or ask the agent to find past discussions |
89
+ | Context loading | Automatic — loaded as top-priority context at session start |
90
+ | Telegram relay | Structural — relay instructions embedded in session-start hook |
91
+ | Database rebuild | POST `/topic/rebuild` — recovers from JSONL if needed |