instar 1.3.1632 → 1.3.1633

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 (30) hide show
  1. package/dashboard/index.html +3 -1
  2. package/dist/core/PostUpdateMigrator.d.ts +2 -0
  3. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  4. package/dist/core/PostUpdateMigrator.js +14 -0
  5. package/dist/core/PostUpdateMigrator.js.map +1 -1
  6. package/dist/data/standards-guard-index.json +1 -1
  7. package/dist/data/standards-guard-index.meta.json +2 -2
  8. package/dist/data/standards-registry.meta.json +1 -1
  9. package/dist/native/InstarWedgeCanary.app/Contents/MacOS/InstarWedgeCanary +0 -0
  10. package/dist/native/instar-desktop-host +0 -0
  11. package/dist/server/AgentServer.d.ts.map +1 -1
  12. package/dist/server/AgentServer.js +41 -0
  13. package/dist/server/AgentServer.js.map +1 -1
  14. package/dist/server/CapabilityIndex.js +1 -1
  15. package/dist/server/CapabilityIndex.js.map +1 -1
  16. package/dist/server/mobilePairingRoutes.d.ts.map +1 -1
  17. package/dist/server/mobilePairingRoutes.js +2 -0
  18. package/dist/server/mobilePairingRoutes.js.map +1 -1
  19. package/dist/server/mobileSessionRoutes.d.ts +79 -0
  20. package/dist/server/mobileSessionRoutes.d.ts.map +1 -0
  21. package/dist/server/mobileSessionRoutes.js +192 -0
  22. package/dist/server/mobileSessionRoutes.js.map +1 -0
  23. package/package.json +1 -1
  24. package/src/data/builtin-manifest.json +20 -20
  25. package/src/data/standards-guard-index.json +1 -1
  26. package/src/data/standards-guard-index.meta.json +2 -2
  27. package/src/data/standards-registry.meta.json +1 -1
  28. package/upgrades/1.3.1633.md +21 -0
  29. package/upgrades/side-effects/mobile-open-session.eli16.md +32 -0
  30. package/upgrades/side-effects/mobile-open-session.md +86 -0
@@ -0,0 +1,192 @@
1
+ /**
2
+ * "Open session" for the Instar iPhone app: which session drives a conversation on this machine,
3
+ * and a dashboard link that opens straight onto it.
4
+ *
5
+ * GET /mobile/conversations/session?ref=<conversationRef>
6
+ *
7
+ * `ref` takes the same values the media routes take: `app:<uuid>` (a live native app
8
+ * conversation), `telegram:<topicId>` (a topic this machine knows), or a Slack conversation's
9
+ * canonical key `slack:<team>:<channel>[:<thread>]` held by THIS machine. Device-signed only
10
+ * (a Bearer request gets 403 `operator-device-required`); read-only; the phone's person must be
11
+ * allowed to use the conversation (people and roles §3.4), otherwise 404 like an unknown one.
12
+ *
13
+ * Answer: `{ active, sessionName?, startedAt?, framework?, machineNickname, dashboardUrl?,
14
+ * reason?, ownerMachine? }`. `active` is true only when a session record on THIS machine is
15
+ * running for the conversation (the same records the dashboard lists, so its deep link finds the
16
+ * session). The dashboard link is `<origin>/dashboard?session=<tmux name>`. Origin: with
17
+ * multi-route on, the own name this request's signature was verified against (a name this
18
+ * machine's configuration lists, and the request arrived through this machine's own TLS front),
19
+ * so the link cannot land on a sibling's dashboard; otherwise the origin pairing uses (the running
20
+ * Cloudflare named tunnel, else a verified Tailscale own name) unless an active sibling claims that
21
+ * host; otherwise the paired host the signature was verified against. It never carries a token or PIN:
22
+ * the dashboard asks for its PIN as usual. When the conversation runs on another machine of the
23
+ * pool, the answer is `active:false` naming that machine (`ownerMachine`); this route does not
24
+ * proxy to it.
25
+ */
26
+ import os from 'node:os';
27
+ import { Router } from 'express';
28
+ import { deviceAdmittedHost, deviceMayUse } from './mobilePairingRoutes.js';
29
+ import { parseAppCanonicalKey } from '../core/appConversationText.js';
30
+ import { verifiedEntityName } from '../messaging/shared/channelIdentity.js';
31
+ /** Parse `ref` with exactly the media routes' shapes; anything else is null (400). */
32
+ export function parseSessionConversationRef(raw) {
33
+ if (typeof raw !== 'string' || raw.length === 0 || raw.length > 128)
34
+ return null;
35
+ const app = parseAppCanonicalKey(raw);
36
+ if (app)
37
+ return { kind: 'app', ref: raw, key: app };
38
+ const tg = /^telegram:([1-9][0-9]{0,15})$/.exec(raw);
39
+ if (tg) {
40
+ const topicId = Number(tg[1]);
41
+ return Number.isSafeInteger(topicId) ? { kind: 'telegram', ref: raw, topicId } : null;
42
+ }
43
+ if (/^slack:[^\s]+$/.test(raw))
44
+ return { kind: 'slack', ref: raw };
45
+ return null;
46
+ }
47
+ /** The ref the shared people-and-roles check takes (the bare uuid for an app conversation). */
48
+ export function mayUseRefOf(r) { return r.kind === 'app' ? r.key : r.ref; }
49
+ export const NO_SESSION_REASON = 'No session is running for this chat right now; your next message starts one.';
50
+ /** The dashboard deep link for a session (no token, no PIN). Null when no usable origin. */
51
+ export function dashboardSessionUrl(origin, sessionName) {
52
+ if (!origin)
53
+ return null;
54
+ let u;
55
+ try {
56
+ u = new URL(origin);
57
+ }
58
+ catch {
59
+ return null;
60
+ } // @silent-fallback-ok — no link is the honest answer
61
+ if (u.protocol !== 'https:' && u.protocol !== 'http:')
62
+ return null;
63
+ return `${u.origin}/dashboard?session=${encodeURIComponent(sessionName)}`;
64
+ }
65
+ /**
66
+ * Decide the answer from what this machine knows (pure; the unit tests cover both sides).
67
+ * A running local session wins; otherwise a known other owner is named; otherwise no session.
68
+ */
69
+ export function resolveOpenSession(input) {
70
+ const base = { machineNickname: input.selfNickname };
71
+ const s = input.localSession;
72
+ if (s) {
73
+ const url = dashboardSessionUrl(input.origin, s.name);
74
+ return {
75
+ active: true, sessionName: s.name,
76
+ ...(s.startedAt ? { startedAt: s.startedAt } : {}),
77
+ ...(s.framework ? { framework: s.framework } : {}),
78
+ ...base,
79
+ ...(url ? { dashboardUrl: url } : { reason: 'This machine has no dashboard address the phone can open yet.' }),
80
+ };
81
+ }
82
+ const owner = input.ownerMachineId;
83
+ if (owner && input.selfMachineId && owner !== input.selfMachineId) {
84
+ const nick = input.ownerNickname;
85
+ return {
86
+ active: false, ...base,
87
+ reason: nick
88
+ ? `This chat runs on ${nick}, not on this machine. Open the dashboard on ${nick} to see its session.`
89
+ : 'This chat runs on another of your machines, whose name I could not confirm, not on this machine.',
90
+ ownerMachine: { machineId: owner, nickname: nick },
91
+ };
92
+ }
93
+ return { active: false, ...base, reason: NO_SESSION_REASON };
94
+ }
95
+ const principalOf = (req) => (req.instarPrincipal) ?? { kind: 'token' };
96
+ /**
97
+ * The origin for this machine's dashboard link. Never a sibling's: a multi-route request's
98
+ * verified own name first; then the pairing origin unless an active sibling claims its host;
99
+ * then the paired host the device signature was checked against.
100
+ */
101
+ export function dashboardOriginFor(pairing, admittedHost) {
102
+ if (pairing.ownNames && admittedHost && pairing.ownNames.accepts(admittedHost))
103
+ return `https://${admittedHost}`;
104
+ const chosen = pairing.pairingOrigin();
105
+ if (chosen && pairing.siblingClaiming(chosen.host) === null)
106
+ return chosen.origin;
107
+ return admittedHost ? `https://${admittedHost}` : null;
108
+ }
109
+ /** This machine's verified name: the pool's nickname, else the host name. */
110
+ export function selfMachineNickname(deps) {
111
+ const id = deps.selfMachineId();
112
+ const pooled = id ? verifiedEntityName(id, deps.nicknameOf(id)) : null;
113
+ if (pooled)
114
+ return pooled;
115
+ const host = os.hostname().replace(/\.local$/i, '');
116
+ return verifiedEntityName(id ?? 'self', host);
117
+ }
118
+ export function createMobileSessionRouter(deps) {
119
+ const router = Router();
120
+ router.get('/mobile/conversations/session', (req, res) => {
121
+ res.setHeader('Cache-Control', 'no-store');
122
+ if (!deps.pairing.enabled()) {
123
+ res.status(503).json({ error: 'mobile-pairing-off' });
124
+ return;
125
+ }
126
+ if (principalOf(req).kind !== 'device') {
127
+ res.status(403).json({ error: 'operator-device-required' });
128
+ return;
129
+ }
130
+ const ref = parseSessionConversationRef(req.query.ref);
131
+ if (!ref) {
132
+ res.status(400).json({ error: 'bad-ref', detail: 'ref is app:<uuid>, telegram:<topicId>, or a Slack conversation key.' });
133
+ return;
134
+ }
135
+ let known = false;
136
+ try {
137
+ known = deps.conversationKnown(ref);
138
+ }
139
+ catch {
140
+ known = false;
141
+ } // @silent-fallback-ok — an unreadable store answers 404
142
+ if (!known || !deviceMayUse(deps.pairing, req, mayUseRefOf(ref))) {
143
+ res.status(404).json({ error: 'unknown-conversation' });
144
+ return;
145
+ }
146
+ let name = null;
147
+ try {
148
+ name = deps.sessionNameFor(ref);
149
+ }
150
+ catch {
151
+ name = null;
152
+ } // @silent-fallback-ok — reported as no session
153
+ let rec = null;
154
+ try {
155
+ rec = name ? deps.runningSession(name) : null;
156
+ }
157
+ catch {
158
+ rec = null;
159
+ } // @silent-fallback-ok — reported as no session
160
+ const selfId = deps.selfMachineId();
161
+ let owner = null;
162
+ try {
163
+ owner = deps.ownerMachineFor(ref);
164
+ }
165
+ catch {
166
+ owner = null;
167
+ } // @silent-fallback-ok — unknown owner reads as this machine
168
+ let origin = null;
169
+ try {
170
+ origin = dashboardOriginFor(deps.pairing, deviceAdmittedHost(req));
171
+ }
172
+ catch {
173
+ origin = null;
174
+ } // @silent-fallback-ok — answered without a link, with the reason
175
+ const nick = (id) => { try {
176
+ return deps.nicknameOf(id);
177
+ }
178
+ catch {
179
+ return null;
180
+ } }; // @silent-fallback-ok — an unconfirmed name is said so
181
+ res.json(resolveOpenSession({
182
+ localSession: name && rec ? { name, startedAt: rec.startedAt ?? null, framework: rec.framework ?? null } : null,
183
+ ownerMachineId: owner,
184
+ selfMachineId: selfId,
185
+ ownerNickname: owner ? verifiedEntityName(owner, nick(owner)) : null,
186
+ selfNickname: selfMachineNickname({ selfMachineId: deps.selfMachineId, nicknameOf: nick }),
187
+ origin,
188
+ }));
189
+ });
190
+ return router;
191
+ }
192
+ //# sourceMappingURL=mobileSessionRoutes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mobileSessionRoutes.js","sourceRoot":"","sources":["../../src/server/mobileSessionRoutes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,EAA+B,MAAM,SAAS,CAAC;AAE9D,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM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,GAAkB,IAAI,CAAC;QACjC,IAAI,CAAC;YAAC,MAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC;YAAC,MAAM,GAAG,IAAI,CAAC;QAAC,CAAC,CAAC,iEAAiE;QACtK,MAAM,IAAI,GAAG,CAAC,EAAU,EAAiB,EAAE,GAAG,IAAI,CAAC;YAAC,OAAO,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC;YAAC,OAAO,IAAI,CAAC;QAAC,CAAC,CAAC,CAAC,CAAC,CAAC,uDAAuD;QACnK,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC;YAC1B,YAAY,EAAE,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,IAAI,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI;YAC/G,cAAc,EAAE,KAAK;YACrB,aAAa,EAAE,MAAM;YACrB,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;YACpE,YAAY,EAAE,mBAAmB,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;YAC1F,MAAM;SACP,CAAC,CAAC,CAAC;IACN,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instar",
3
- "version": "1.3.1632",
3
+ "version": "1.3.1633",
4
4
  "description": "Coherence infrastructure for self-evolving AI agents — on the Claude Code or Codex subscription you already have.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "./builtin-manifest.schema.json",
3
3
  "schemaVersion": 1,
4
- "generatedAt": "2026-11-03T20:05:24.166Z",
5
- "instarVersion": "1.3.1632",
4
+ "generatedAt": "2026-11-03T21:36:00.963Z",
5
+ "instarVersion": "1.3.1633",
6
6
  "entryCount": 206,
7
7
  "entries": {
8
8
  "hook:session-start": {
@@ -11,7 +11,7 @@
11
11
  "domain": "identity",
12
12
  "sourcePath": "src/core/PostUpdateMigrator.ts",
13
13
  "installedPath": ".instar/hooks/instar/session-start.sh",
14
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
14
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
15
15
  "since": "2025-01-01"
16
16
  },
17
17
  "hook:dangerous-command-guard": {
@@ -20,7 +20,7 @@
20
20
  "domain": "safety",
21
21
  "sourcePath": "src/core/PostUpdateMigrator.ts",
22
22
  "installedPath": ".instar/hooks/instar/dangerous-command-guard.sh",
23
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
23
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
24
24
  "since": "2025-01-01"
25
25
  },
26
26
  "hook:grounding-before-messaging": {
@@ -29,7 +29,7 @@
29
29
  "domain": "safety",
30
30
  "sourcePath": "src/core/PostUpdateMigrator.ts",
31
31
  "installedPath": ".instar/hooks/instar/grounding-before-messaging.sh",
32
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
32
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
33
33
  "since": "2025-01-01"
34
34
  },
35
35
  "hook:compaction-recovery": {
@@ -38,7 +38,7 @@
38
38
  "domain": "identity",
39
39
  "sourcePath": "src/core/PostUpdateMigrator.ts",
40
40
  "installedPath": ".instar/hooks/instar/compaction-recovery.sh",
41
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
41
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
42
42
  "since": "2025-01-01"
43
43
  },
44
44
  "hook:external-operation-gate": {
@@ -47,7 +47,7 @@
47
47
  "domain": "safety",
48
48
  "sourcePath": "src/core/PostUpdateMigrator.ts",
49
49
  "installedPath": ".instar/hooks/instar/external-operation-gate.js",
50
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
50
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
51
51
  "since": "2025-01-01"
52
52
  },
53
53
  "hook:deferral-detector": {
@@ -56,7 +56,7 @@
56
56
  "domain": "safety",
57
57
  "sourcePath": "src/core/PostUpdateMigrator.ts",
58
58
  "installedPath": ".instar/hooks/instar/deferral-detector.js",
59
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
59
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
60
60
  "since": "2025-01-01"
61
61
  },
62
62
  "hook:self-stop-guard": {
@@ -65,7 +65,7 @@
65
65
  "domain": "coherence",
66
66
  "sourcePath": "src/core/PostUpdateMigrator.ts",
67
67
  "installedPath": ".instar/hooks/instar/self-stop-guard.js",
68
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
68
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
69
69
  "since": "2025-01-01"
70
70
  },
71
71
  "hook:post-action-reflection": {
@@ -74,7 +74,7 @@
74
74
  "domain": "evolution",
75
75
  "sourcePath": "src/core/PostUpdateMigrator.ts",
76
76
  "installedPath": ".instar/hooks/instar/post-action-reflection.js",
77
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
77
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
78
78
  "since": "2025-01-01"
79
79
  },
80
80
  "hook:external-communication-guard": {
@@ -83,7 +83,7 @@
83
83
  "domain": "safety",
84
84
  "sourcePath": "src/core/PostUpdateMigrator.ts",
85
85
  "installedPath": ".instar/hooks/instar/external-communication-guard.js",
86
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
86
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
87
87
  "since": "2025-01-01"
88
88
  },
89
89
  "hook:telegram-origin-guard": {
@@ -101,7 +101,7 @@
101
101
  "domain": "coherence",
102
102
  "sourcePath": "src/core/PostUpdateMigrator.ts",
103
103
  "installedPath": ".instar/hooks/instar/scope-coherence-collector.js",
104
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
104
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
105
105
  "since": "2025-01-01"
106
106
  },
107
107
  "hook:scope-coherence-checkpoint": {
@@ -110,7 +110,7 @@
110
110
  "domain": "coherence",
111
111
  "sourcePath": "src/core/PostUpdateMigrator.ts",
112
112
  "installedPath": ".instar/hooks/instar/scope-coherence-checkpoint.js",
113
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
113
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
114
114
  "since": "2025-01-01"
115
115
  },
116
116
  "hook:free-text-guard": {
@@ -119,7 +119,7 @@
119
119
  "domain": "safety",
120
120
  "sourcePath": "src/core/PostUpdateMigrator.ts",
121
121
  "installedPath": ".instar/hooks/instar/free-text-guard.sh",
122
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
122
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
123
123
  "since": "2025-01-01"
124
124
  },
125
125
  "hook:claim-intercept": {
@@ -128,7 +128,7 @@
128
128
  "domain": "coherence",
129
129
  "sourcePath": "src/core/PostUpdateMigrator.ts",
130
130
  "installedPath": ".instar/hooks/instar/claim-intercept.js",
131
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
131
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
132
132
  "since": "2025-01-01"
133
133
  },
134
134
  "hook:claim-intercept-response": {
@@ -137,7 +137,7 @@
137
137
  "domain": "coherence",
138
138
  "sourcePath": "src/core/PostUpdateMigrator.ts",
139
139
  "installedPath": ".instar/hooks/instar/claim-intercept-response.js",
140
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
140
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
141
141
  "since": "2025-01-01"
142
142
  },
143
143
  "hook:stop-gate-router": {
@@ -146,7 +146,7 @@
146
146
  "domain": "safety",
147
147
  "sourcePath": "src/core/PostUpdateMigrator.ts",
148
148
  "installedPath": ".instar/hooks/instar/stop-gate-router.js",
149
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
149
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
150
150
  "since": "2025-01-01"
151
151
  },
152
152
  "hook:auto-approve-permissions": {
@@ -155,7 +155,7 @@
155
155
  "domain": "safety",
156
156
  "sourcePath": "src/core/PostUpdateMigrator.ts",
157
157
  "installedPath": ".instar/hooks/instar/auto-approve-permissions.js",
158
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
158
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
159
159
  "since": "2025-01-01"
160
160
  },
161
161
  "job:health-check": {
@@ -1563,7 +1563,7 @@
1563
1563
  "type": "subsystem",
1564
1564
  "domain": "server",
1565
1565
  "sourcePath": "src/server/AgentServer.ts",
1566
- "contentHash": "44882e7835c15ab45726502f2880934852d3b0796374d3b54357e2502e822597",
1566
+ "contentHash": "bd218bfe17b10c50a145a97ee947592811042e156a5bbbda9484c3918b8dcf1a",
1567
1567
  "since": "2025-01-01"
1568
1568
  },
1569
1569
  "subsystem:session-manager": {
@@ -1595,7 +1595,7 @@
1595
1595
  "type": "subsystem",
1596
1596
  "domain": "updates",
1597
1597
  "sourcePath": "src/core/PostUpdateMigrator.ts",
1598
- "contentHash": "bcab729c9a8af5336ae9cfb40565c4fee54df1cab4ec2b7e0b0b59b10430bfbf",
1598
+ "contentHash": "cc98663815c7fbfb978bcb12679e73a68456413d94ff1f1d9bdea04db2f6fd52",
1599
1599
  "since": "2025-01-01"
1600
1600
  },
1601
1601
  "subsystem:scheduler": {
@@ -2,7 +2,7 @@
2
2
  "schemaVersion": 1,
3
3
  "generatedFrom": "source-tree",
4
4
  "registrySha256": "db01d9f92c6aa26ca903702896b41be53722982ed07d27633237bb254c214290",
5
- "packageVersion": "1.3.1632",
5
+ "packageVersion": "1.3.1633",
6
6
  "guards": [
7
7
  {
8
8
  "ref": "docs/audits/phase-b/f10-triage.md",
@@ -1,5 +1,5 @@
1
1
  {
2
- "sha256": "de36de81cdc0a17f322e643423784191087f908ffe676006ef62c46849716417",
2
+ "sha256": "2f7afefeb59b84ee60b142a874247831933efa076c9fa9a7e79dca4d16b68dce",
3
3
  "registrySha256": "db01d9f92c6aa26ca903702896b41be53722982ed07d27633237bb254c214290",
4
- "packageVersion": "1.3.1632"
4
+ "packageVersion": "1.3.1633"
5
5
  }
@@ -2,5 +2,5 @@
2
2
  "sha256": "db01d9f92c6aa26ca903702896b41be53722982ed07d27633237bb254c214290",
3
3
  "articleCount": 93,
4
4
  "generatedFrom": "docs/STANDARDS-REGISTRY.md",
5
- "packageVersion": "1.3.1632"
5
+ "packageVersion": "1.3.1633"
6
6
  }
@@ -0,0 +1,21 @@
1
+ # Upgrade Guide — vNEXT
2
+
3
+ <!-- assembled-by: assemble-next-md -->
4
+ <!-- bump: patch -->
5
+
6
+ ## What Changed
7
+
8
+ The Instar iPhone app can ask which session is answering a chat: `GET /mobile/conversations/session?ref=<app:<uuid> | telegram:<topicId> | Slack conversationKey>` (signed by a paired phone, read-only). The answer is `{ active, sessionName, startedAt, framework, machineNickname, dashboardUrl, reason, ownerMachine }`. When a session is running, `dashboardUrl` opens the dashboard on this machine's permanent address, focused on that session (`/dashboard?session=<name>`); it carries no token or PIN, and the dashboard asks for its PIN as usual. When none is running, `active` is false with a plain reason, and when the chat runs on another machine, the answer names that machine. The dashboard now waits up to 10 seconds for its session list before giving up on a `?session=` link.
9
+
10
+ ## What to Tell Your User
11
+
12
+ The Instar app can now take you straight from a chat to the live session answering it on the dashboard, once the app adds its "Open session" button. If nothing is running for that chat, it tells you so, and your next message starts one. You still type the dashboard PIN.
13
+
14
+ ## Summary of New Capabilities
15
+
16
+ - A paired phone can ask which session drives a chat and get a dashboard link focused on it.
17
+ - An honest "no session is running" answer, or the name of the machine that runs the chat.
18
+
19
+ ## Evidence
20
+
21
+ Unit tests cover the reference shapes, the link builder and both sides of each decision (running here, not running, running elsewhere, no address). Integration tests go through the real device check: active, inactive, another machine, wrong references, the agent token refused, a revoked phone refused, and the allowlist entry. A production-path test boots the server, pairs a phone, starts a conversation, and sees the answer flip from "no session" to an active link that the served dashboard reads.
@@ -0,0 +1,32 @@
1
+ # "Open session" from the Instar iPhone app — plain-English overview
2
+
3
+ ## What this is
4
+
5
+ Every chat in the Instar app (an app conversation, a Telegram topic, or a Slack channel) is answered by a session: a running copy of the agent in a terminal on one of the operator's computers. The dashboard can show that terminal live. Until now, the app had no way to jump from a chat to the terminal answering it, so the operator had to open the dashboard and hunt for the right session by name.
6
+
7
+ This change adds one question the app can ask the agent: "which session is answering this chat right now, and how do I open it?" The agent answers with either a link that opens the dashboard already focused on that session, or a plain sentence saying why there is nothing to open.
8
+
9
+ ## What already existed
10
+
11
+ - The dashboard already understood a link of the form `/dashboard?session=<name>`: after you type the PIN, it selects that session and starts streaming it.
12
+ - The agent already knows which session each chat is bound to (the same mapping it uses to deliver your messages).
13
+ - The app already signs every request with a key kept on the phone, and the agent already checks which chats each phone may see.
14
+
15
+ ## What is new
16
+
17
+ - A read-only question, `GET /mobile/conversations/session?ref=…`, that only a paired phone can ask. The agent's own password-like token is refused, so it is not a new way in for anything else.
18
+ - The answer says whether a session is running, its name, when it started, which AI engine runs it, the computer's name, and the dashboard link.
19
+ - When nothing is running, the answer says so in a plain sentence: "No session is running for this chat right now; your next message starts one."
20
+ - When the chat runs on another of the operator's computers, the answer names that computer instead of pretending there is nothing.
21
+ - The dashboard now waits up to ten seconds (instead of three) for its session list after the PIN, so the link works over a slow phone connection.
22
+
23
+ ## Safeguards
24
+
25
+ - The link never contains a password, token or PIN. Opening it still asks for the dashboard PIN as usual.
26
+ - A phone can only ask about chats it is already allowed to use. A phone set up for another person gets "unknown" for chats that are not theirs.
27
+ - The question changes nothing. It cannot start, stop or move a session.
28
+ - The link points to the computer's permanent address (the same one used for pairing), so it keeps working.
29
+
30
+ ## What a reader needs to decide
31
+
32
+ Nothing to approve. It is small, read-only, sits behind the existing phone-pairing switch, and removing it is a single revert. The app side (the button itself) is built separately in the iPhone app and calls this question.
@@ -0,0 +1,86 @@
1
+ # Side-Effects Review — "Open session" for the Instar iPhone app
2
+
3
+ **Version / slug:** `mobile-open-session`
4
+ **Date:** `2026-11-03`
5
+ **Author:** `Echo`
6
+ **Second-pass reviewer:** `independent subagent (see the end of this file)`
7
+
8
+ ## Summary of the change
9
+
10
+ Operator request (Justin, 2026-11-03 12:10 PST): an "open session" button in the app that takes him straight to the dashboard session driving the chat, and says so when no session is running.
11
+
12
+ New device-signed read route `GET /mobile/conversations/session?ref=<ref>` (`src/server/mobileSessionRoutes.ts`, mounted in `AgentServer` beside the media router). `ref` takes the media routes' three shapes (`app:<uuid>`, `telegram:<topicId>`, a Slack `conversationKey`) with the same "held by this machine" checks (live app conversation; Telegram topic in this machine's mappings; Slack key minted by this machine's registry with `slackOwnerUserId` set). The phone's person must be allowed to use the conversation (`deviceMayUse`), otherwise 404 like an unknown one.
13
+
14
+ Answer: `{ active, sessionName?, startedAt?, framework?, machineNickname, dashboardUrl?, reason?, ownerMachine? }`.
15
+ - `active:true` only when the conversation's bound tmux session has a **running** session record on this machine (the same records the dashboard lists, so the deep link finds it).
16
+ - `dashboardUrl` = `<origin>/dashboard?session=<encoded tmux name>` (`dashboardOriginFor`). Origin: with multi-route on, the own name this request's signature was verified against (listed for this machine, arrived through its own local TLS front); else `pairing.pairingOrigin()` (running Cloudflare named tunnel, else a verified Tailscale own name) unless an active sibling machine claims that host (the same `siblingClaiming` check pairing's mint uses); else the paired host the signature was verified against. Never a token, PIN or signature.
17
+ - No session: `active:false`, `reason` "No session is running for this chat right now; your next message starts one."
18
+ - Another machine owns it (Telegram: ownership registry, else the lease holder; app: the lease holder when this machine is not it): `active:false`, `reason` naming that machine, `ownerMachine: {machineId, nickname}`. No proxy: the owner's route refuses Bearer, so a pool proxy is not trivial.
19
+
20
+ The dashboard already deep-links with `?session=<tmuxSession>` (`handleDeepLink`, runs after the PIN overlay closes). The only dashboard change: its wait for the first session list grows from 3 s to 10 s, so a phone over a tunnel does not miss it.
21
+
22
+ The device allowlist gains `GET /mobile/conversations/session` (active devices, no body, `conversationRef: true`). CapabilityIndex describes it.
23
+
24
+ Tier 1: read-only route behind the existing dev-gated `mobilePairing` gate, one allowlist entry, a revert removes it entirely. Size: 1 new module (~150 lines), ~35 lines of wiring, 2 lines allowlist, 3 lines dashboard, 3 test files. Effort: one design pass, no spec rounds.
25
+
26
+ ## Decision-point inventory
27
+
28
+ - Device allowlist — add — one GET route, active devices only, flagged as naming a conversation.
29
+ - Whether the phone may read a conversation's session — pass-through — the existing `deviceMayUse` people-and-roles check.
30
+ - "Active" — add — a running session record bound to the conversation on this machine (a signal shown to the operator, not a gate on anything).
31
+
32
+ ## 1. Over-block
33
+
34
+ A session that is alive in tmux but whose record is not yet `running` (seconds after spawn) reads `active:false`; the next tap shows it. A conversation this machine does not hold (a Telegram topic only another machine maps, a Slack key minted elsewhere) answers 404, the same as the media routes; the app asks the machine that listed it. Telegram on a standby with no Telegram adapter answers 404 for every topic.
35
+
36
+ ## 2. Under-block
37
+
38
+ The route only reads; it reveals a tmux session name, start time and framework for a conversation the phone may already use. Those are already visible to the same owner on the PIN-locked dashboard and (for the owner) in `GET /sessions`, which is already on the device allowlist. An MSP phone gets 404 for conversations it may not use. The link carries nothing secret; the dashboard still needs its PIN.
39
+
40
+ ## 3. Level-of-abstraction fit
41
+
42
+ The decision is a pure function (`resolveOpenSession`) with the machine lookups injected from `AgentServer`, which already owns the Telegram adapter, Slack bridge, conversation service, session manager and pool registries. The deep link reuses the dashboard's existing `?session=` handling rather than adding a parallel one.
43
+
44
+ ## 4. Signal vs authority compliance
45
+
46
+ No authority added. The route reports state; it blocks nothing and changes nothing. Access control is the existing device authenticator plus the existing `deviceMayUse` check (`docs/signal-vs-authority.md`: no brittle check gains blocking power).
47
+
48
+ ## 5. Interactions
49
+
50
+ `GET /mobile/conversations/session` sits beside `PATCH/DELETE /mobile/conversations/:key`; those take a strict UUID and there is no `GET /mobile/conversations/:key`, so no route shadows it. The allowlist regex for PATCH/DELETE uses the UUID pattern and cannot match `session`. The read uses the shared per-device read allowance, like the other reads. The DEVICE_ALLOWLIST coverage test now lists this route.
51
+
52
+ ## 6. External surfaces
53
+
54
+ The iPhone app gains one read endpoint. The answer shape is additive and new. No change for agents, other machines, Telegram or Slack. The dashboard change is a longer wait for an already-supported deep link.
55
+
56
+ ## 6b. Operator-surface quality
57
+
58
+ The only operator-surface change is the dashboard's existing `?session=` deep-link handler waiting up to 10 s (was 3 s) for its first session list. No markup, label or control changes.
59
+ 1. **Leads with the primary action?** Yes: the link opens the dashboard on the Sessions tab with the session already selected and streaming, after the usual PIN; nothing to find or tap.
60
+ 2. **Zero raw internals as primary content?** Yes: no new content is shown. The tmux name stays in the URL query only, as it already did when the dashboard recorded the active session.
61
+ 3. **Destructive actions de-emphasized?** Not affected: no actions are added or moved; the existing session tile and its controls are unchanged.
62
+ 4. **Plain language + phone width?** Unchanged dashboard rendering; the longer wait exists precisely so the focus works on a phone over a slower tunnel. The app's button and its "no session" sentence are plain language (`reason` strings are written for the operator).
63
+
64
+ ## 7. Multi-machine posture (Cross-Machine Coherence)
65
+
66
+ Proxied-by-name, not proxied-on-read: each machine answers for its own sessions. When the conversation's owner (ownership registry or lease holder) is another machine and no local session runs, the answer names that machine (`ownerMachine`), so the app can ask it or tell the operator where to look. A local running session always wins, so a stale ownership record never hides a real session. The dashboard URL is built so it cannot open a sibling's dashboard: a multi-route request uses the own name it was verified on; otherwise the pairing origin is used only when no active sibling claims its host. Without multi-route and with a shared host that the sibling registry does not report, the link could still reach whichever machine the tunnel routes to; the dashboard then finds no matching session and simply opens without focus (no wrong action, only a missed focus). A full proxy is not built: the owner's route accepts only device signatures, which a peer cannot forward.
67
+
68
+ ## 8. Rollback cost
69
+
70
+ Revert the commit. No state, no migration, no config. Phones that call the route afterwards get 403 `device-not-allowed`; the app should treat that as "not available on this agent".
71
+
72
+ ## Second-pass review
73
+
74
+ **Reviewer:** independent subagent (read-only, given the code and this artifact, not my conclusions).
75
+
76
+ **First pass — Concern raised:**
77
+ 1. The link could open a sibling's dashboard: `pairingOrigin()` only checks that a named tunnel runs here, while pairing's mint also refuses a host an active sibling claims. Suggested: prefer the verified own name with multi-route on; use the pairing origin only when `siblingClaiming` is null. §7 overclaimed.
78
+ 2. The unconfirmed-owner reason showed a raw machine id in user-facing text.
79
+ 3. No test locked in that `ref` is covered by the signature, that the notify token is refused, or that an MSP phone gets 404 (the §2 claim).
80
+ Minor: the Slack lookup searched a 500-row capped list; three lookups were not try-wrapped.
81
+
82
+ **Fixes:** (1) `dashboardOriginFor` implements exactly the suggested order, with unit tests for each branch, and §7 is corrected. (2) The id is gone from the sentence (it stays in `ownerMachine.machineId`); a unit test asserts it. (3) Integration tests added: a ref changed after signing → 401; notify token → 403; MSP phone → 404 for an app conversation it does not own and for a Slack chat without the grant, 200 for the owner's phone. Minor: the Slack session lookup now resolves the registry entry by key directly; every injected lookup is try-wrapped.
83
+
84
+ **Recheck (same reviewer, read-only, after the fixes): "Concur with the review."** It confirmed each fix at its line: `dashboardOriginFor`'s order and try-wrap, the id gone from the reason, the new integration and unit tests, the exact Slack routing key from `resolveByKey`, and every injected lookup try-wrapped. Remaining notes needed no change (per-request `listRunningSessions` cost matches `GET /sessions` and is device-rate-limited; the e2e dashboard check is a string match on the served page).
85
+
86
+ Agent awareness: a new bullet (`APP_CONVERSATIONS_OPEN_SESSION_LINE`) in the Native app conversations CLAUDE.md section, inserted for existing agents by `migrateClaudeMd` after the pool-read line (content-sniffed, idempotent; unit-tested).