instar 1.3.1988 → 1.3.1990

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 (41) hide show
  1. package/dashboard/console/allowed-model.js +27 -0
  2. package/dashboard/console/allowed.js +28 -4
  3. package/dashboard/console/needs-model.js +10 -0
  4. package/dist/core/trustJourney/AccountPathService.d.ts +23 -0
  5. package/dist/core/trustJourney/AccountPathService.d.ts.map +1 -1
  6. package/dist/core/trustJourney/AccountPathService.js +194 -58
  7. package/dist/core/trustJourney/AccountPathService.js.map +1 -1
  8. package/dist/core/trustJourney/TrustJourneyStore.d.ts +4 -1
  9. package/dist/core/trustJourney/TrustJourneyStore.d.ts.map +1 -1
  10. package/dist/core/trustJourney/TrustJourneyStore.js +27 -4
  11. package/dist/core/trustJourney/TrustJourneyStore.js.map +1 -1
  12. package/dist/data/standards-guard-index.json +1 -1
  13. package/dist/data/standards-guard-index.meta.json +2 -2
  14. package/dist/data/standards-registry.meta.json +1 -1
  15. package/dist/native/InstarWedgeCanary.app/Contents/MacOS/InstarWedgeCanary +0 -0
  16. package/dist/native/instar-desktop-host +0 -0
  17. package/dist/server/mobilePermissionsRoutes.d.ts.map +1 -1
  18. package/dist/server/mobilePermissionsRoutes.js +1 -0
  19. package/dist/server/mobilePermissionsRoutes.js.map +1 -1
  20. package/dist/server/mobileTrustApproval.d.ts.map +1 -1
  21. package/dist/server/mobileTrustApproval.js +1 -0
  22. package/dist/server/mobileTrustApproval.js.map +1 -1
  23. package/dist/server/needsRoutes.d.ts.map +1 -1
  24. package/dist/server/needsRoutes.js +2 -0
  25. package/dist/server/needsRoutes.js.map +1 -1
  26. package/dist/server/routes.js +4 -4
  27. package/dist/server/routes.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/data/awareness/app-first-owner-approvals.md +9 -0
  30. package/src/data/builtin-manifest.json +46 -46
  31. package/src/data/standards-guard-index.json +1 -1
  32. package/src/data/standards-guard-index.meta.json +2 -2
  33. package/src/data/standards-registry.meta.json +1 -1
  34. package/upgrades/1.3.1989.md +20 -0
  35. package/upgrades/1.3.1990.md +32 -0
  36. package/upgrades/eli16/stale-login-probe-test-isolation.md +7 -0
  37. package/upgrades/side-effects/app-first-owner-approvals.md +105 -0
  38. package/upgrades/side-effects/circuit-breaker-test-isolation.md +71 -0
  39. package/upgrades/side-effects/main-verification-test-isolation.md +70 -0
  40. package/upgrades/side-effects/stale-login-probe-test-isolation.md +49 -0
  41. package/upgrades/side-effects/telegram-connect-fixture-route.md +70 -0
@@ -10,6 +10,33 @@ import { ago } from './home-model.js';
10
10
  import { verifiedDisplayName } from './display-identity.js';
11
11
  import { unreachableClause, poolMachine } from './unreachable-model.js';
12
12
 
13
+ /** Open exact-change requests, shared by the Allowed page and Needs-you. No approval authority here. */
14
+ export function buildTrustRequests(res, now = Date.now()) {
15
+ if (!res || !res.ok) return { ok: false, reason: res && res.reason || 'The approval requests could not be read.', rows: [] };
16
+ const d = res.data;
17
+ if (!d || !Array.isArray(d.requests)) return { ok: false, reason: 'The approval request answer was incomplete.', rows: [] };
18
+ const delivery = d.approvalDelivery;
19
+ const state = delivery && ['accepted', 'setup', 'none', 'unknown'].includes(delivery.state) ? delivery.state : 'unknown';
20
+ const message = delivery && typeof delivery.message === 'string' && delivery.message.trim() ? delivery.message.trim() : null;
21
+ const rows = d.requests.filter((r) => r && r.status === 'open' && typeof r.requestId === 'string'
22
+ && Number.isFinite(Date.parse(r.expiresAt)) && Date.parse(r.expiresAt) > now).map((r) => {
23
+ const summary = Array.isArray(r.summary) ? r.summary.filter((s) => typeof s === 'string') : [];
24
+ let continuation;
25
+ if (state === 'accepted') continuation = message || 'Open Changes to approve in the paired Instar app to review this request.';
26
+ else if (state === 'setup') continuation = message || 'Set up approvals in the paired Instar app before approving this request.';
27
+ else if (state === 'unknown') continuation = message || 'I could not check which device can approve right now. Refresh this list against the machine deciding approvals.';
28
+ else if (r.delivered === true && (r.adapter === 'telegram' || r.adapter === 'slack')) continuation = 'Open the private approval chat and reply to this exact request card.';
29
+ else if (r.adapter === 'device') continuation = message || 'No approving device is reachable. Reconnect your approving iPhone or a Mac with Touch ID.';
30
+ else continuation = message || 'Chat delivery is unconfirmed. Set up approvals in the Instar app, or check your private approval chat.';
31
+ const unconfirmed = r.adapter !== 'device' && r.delivered !== true;
32
+ return { key: `trust:${r.requestId}`, requestId: r.requestId, summary,
33
+ main: ({ 'board-policy': 'Review how the agent starts work cards', 'one-action': 'Review an action the agent wants to take once', 'trust-grant': 'Review what the agent may do' })[r.changeKind] || 'Review a requested change', continuation,
34
+ sub: `${unconfirmed && !continuation.startsWith('Chat delivery is unconfirmed.') ? 'Chat delivery is unconfirmed. ' : ''}${continuation}`,
35
+ expiresAt: r.expiresAt, deliveryState: state };
36
+ });
37
+ return { ok: true, rows, deliveryState: state };
38
+ }
39
+
13
40
  // ── Profile ───────────────────────────────────────────────────────────────
14
41
  export const PROFILES = ['cautious', 'supervised', 'collaborative', 'autonomous'];
15
42
 
@@ -5,11 +5,11 @@
5
5
  // Accepting a guard's risk takes the PIN in the request body (adapter c / 'body').
6
6
 
7
7
  import {
8
- buildProfile, buildHistory, buildGuards, buildSuggestions, buildFeatures, flattenFeature, profileChanges,
8
+ buildTrustRequests, buildProfile, buildHistory, buildGuards, buildSuggestions, buildFeatures, flattenFeature, profileChanges,
9
9
  walkToEnabled, canTurnOff, canUndoOff, needsConsent, facts, applyText, refusalText, PROFILE_LABEL, PROFILE_SENTENCE, STATE_WORD,
10
10
  } from './allowed-model.js';
11
11
  import { buildServices } from './services-model.js';
12
- import { el, setKids, pageHead, section, sheet, closeSheet, story, details, note, cantTell, actionButton, askPin, operatorSession, forgetOperatorSession, firstPaint, arrivalScroll } from './ui.js';
12
+ import { el, setKids, pageHead, section, sheet, closeSheet, story, details, note, cantTell, actionButton, askPin, operatorSession, forgetOperatorSession, firstPaint, arrivalScroll, markNeed } from './ui.js';
13
13
  import { legacyHref } from './nav-model.js';
14
14
 
15
15
  const featureErrors = new Map(); // feature id → the server's last refusal, shown beside the row
@@ -42,8 +42,8 @@ const errWords = (r) => {
42
42
  export async function renderAllowed(main, ctx) {
43
43
  const { get, post } = ctx;
44
44
  firstPaint(main, el('section', { class: 'hero page-hero' }, el('div', { class: 'eyebrow', text: 'Settings · What I’m allowed to do' }), el('h1', { class: 'page-title skeleton', text: 'Loading' })));
45
- const [auto, hist, elev, guardsRes, featRes, servicesRes, poolRes] = await Promise.all([
46
- get('/autonomy'), get('/autonomy/history'), get('/autonomy/elevation'), get('/guards?scope=pool', 8000), get('/features'), get('/recommended-services'), get('/pool'),
45
+ const [auto, hist, elev, guardsRes, featRes, servicesRes, poolRes, trustRes] = await Promise.all([
46
+ get('/autonomy'), get('/autonomy/history'), get('/autonomy/elevation'), get('/guards?scope=pool', 8000), get('/features'), get('/recommended-services'), get('/pool'), get('/trust/requests'),
47
47
  ]);
48
48
  const services = buildServices(servicesRes);
49
49
  const profile = buildProfile(auto);
@@ -51,12 +51,14 @@ export async function renderAllowed(main, ctx) {
51
51
  const suggestions = buildSuggestions(elev);
52
52
  const guards = buildGuards(guardsRes, { pool: poolRes });
53
53
  const features = buildFeatures(featRes);
54
+ const trust = buildTrustRequests(trustRes);
54
55
  const refresh = () => renderAllowed(main, ctx);
55
56
 
56
57
  const eyebrow = `Settings · What I’m allowed to do${guards.ok && guards.multi && guards.selfName ? ` · ${guards.selfName}` : ''}`;
57
58
  setKids(main, el('div', { class: 'allowed-page' },
58
59
  // warning-path: pageHead
59
60
  pageHead({ eyebrow, headline: profile.ok ? profile.sentence : 'What I’m allowed to do', sub: profile.ok ? null : profile.reason, tone: guards.ok && guards.counts.look ? 'attn' : profile.ok ? 'ok' : 'muted', facts: facts({ profile, guards, features, suggestions }) }),
61
+ approvalBlock(trust),
60
62
  el('div', { class: 'page-sections' },
61
63
  profileBlock(profile, post, refresh),
62
64
  guardsBlock(guards, refresh),
@@ -74,6 +76,28 @@ export async function renderAllowed(main, ctx) {
74
76
  }
75
77
  }
76
78
 
79
+ // ── Exact changes waiting for the person ──────────────────────────────────
80
+ function approvalBlock(model) {
81
+ const wrap = el('section', { class: 'list-section', id: 'sec-approvals' },
82
+ el('div', { class: 'list-head' }, el('h2', { class: 'eyebrow', text: 'Changes to approve' })));
83
+ if (!model.ok) { wrap.append(cantTell(model.reason)); return wrap; }
84
+ if (!model.rows.length) { wrap.append(note('There are no open approval requests.')); return wrap; }
85
+ markNeed(wrap, 'trust-requests');
86
+ for (const r of model.rows) {
87
+ const show = () => sheet({ title: r.main },
88
+ ...r.summary.map((text) => el('p', { class: 'confirm-text', text })),
89
+ el('p', { class: 'confirm-text', text: r.sub }),
90
+ el('p', { class: 'confirm-text', text: 'On iPhone, open this agent’s Permissions screen, then Changes to approve. On Mac, open Changes to approve in the agent window.' }),
91
+ note('Review and confirm in the app or the exact private chat card. This console page does not approve the request.'));
92
+ wrap.append(el('div', { class: 'need-card' },
93
+ el('p', { class: 'need-title', text: r.main }),
94
+ el('p', { class: 'need-sub', text: r.sub }),
95
+ el('button', { class: 'btn-primary btn-inline', type: 'button', text: 'How to approve', onclick: show }),
96
+ ...r.summary.map((text) => el('p', { class: 'need-sub approval-summary', text }))));
97
+ }
98
+ return wrap;
99
+ }
100
+
77
101
  // ── Profile ───────────────────────────────────────────────────────────────
78
102
  function profileBlock(profile, post, refresh) {
79
103
  const wrap = el('section', { class: 'list-section', id: 'sec-profile' }, el('div', { class: 'list-head' }, el('h2', { class: 'eyebrow', text: 'How independent I am' })));
@@ -6,6 +6,7 @@
6
6
  import { buildShipping, stoppedLead, operatorTodos, sourceState, agentOwnedStop } from './development-model.js';
7
7
  import { buildAccountsPage } from './accounts-model.js';
8
8
  import { pairingModel, waitingCards } from './agents-model.js';
9
+ import { buildTrustRequests } from './allowed-model.js';
9
10
  import { buildApprovals } from './mandates-model.js';
10
11
  import { buildPlansPage } from './plans-model.js';
11
12
  import { buildRequests } from './secrets-model.js';
@@ -28,6 +29,13 @@ export function documentDecisionNeedRows(res) {
28
29
  d.question ? `${d.question}${d.versionLabel ? ` (version ${d.versionLabel})` : ''}` : 'Open it on your phone to approve or decline.', `/docs/${d.id}`, [d.id]));
29
30
  }
30
31
 
32
+ /** Current approval requests share the Allowed page's exact pending-request model. */
33
+ export function trustRequestNeedRows(trust, now) {
34
+ if (sourceState(trust) === 'off') return [];
35
+ const requests = buildTrustRequests(trust, now);
36
+ return requests.ok ? requests.rows.map((r) => row(r.key, r.main, r.sub, '#/settings/allowed?s=approvals', [r.requestId])) : UNREADABLE;
37
+ }
38
+
31
39
  /** A 200 that does not have the expected shape: it told us nothing, so never read it as "nothing waiting". */
32
40
  const UNREADABLE = null;
33
41
 
@@ -120,6 +128,8 @@ export const NEED_SOURCES = [
120
128
  { id: 'agents', page: 'people/agents', reads: { pairing: '/threadline/pairing', invites: '/threadline/pairing/invites' },
121
129
  rows: ({ pairing, invites }, now) => waitingCards(pairingModel(pairing, invites, undefined, now), now)
122
130
  .map((c, i) => row(`agent:${c.kind}:${c.iid || c.id || i}`, c.title, '', '#/people/agents')) },
131
+ { id: 'trust-requests', page: 'settings/allowed', reads: { trust: '/trust/requests' },
132
+ rows: ({ trust }, now) => trustRequestNeedRows(trust, now) },
123
133
  { id: 'approvals', page: 'people/mandates', reads: { approvals: '/authorization-requests?status=pending' },
124
134
  rows: ({ approvals }) => { const a = buildApprovals(approvals); return a.ok ? a.rows.map((r) => row(r.key, r.headline, r.reason, '#/people/mandates?s=waiting')) : UNREADABLE; } },
125
135
  { id: 'plans', page: 'work/plans', reads: { initiatives: '/initiatives', blockers: '/blockers' },
@@ -26,6 +26,8 @@ export interface DeviceSnapshot {
26
26
  /** The device registry, seen from the trust journey. */
27
27
  export interface DeviceDirectory {
28
28
  get(deviceId: string): DeviceSnapshot | null;
29
+ /** Fresh local native owner devices; pairing permits delivery, not approval. */
30
+ list?(): DeviceSnapshot[];
29
31
  /** A contentless push notice to the paired devices (optional; fixed wording per subject). */
30
32
  notify?(subject: 'trust-request' | 'trust-device-change', dedupeKey: string): void;
31
33
  /** False when approving from a device is switched off (`mobilePairing.trustApproval`): no device approves then. */
@@ -116,6 +118,10 @@ export type ProposeResult = {
116
118
  } | {
117
119
  status: 'no-approver';
118
120
  message: string;
121
+ requestId?: string;
122
+ } | {
123
+ status: 'not-holder';
124
+ message: string;
119
125
  } | {
120
126
  status: 'awaiting-acceptance' | 'sent';
121
127
  requestId: string;
@@ -123,6 +129,7 @@ export type ProposeResult = {
123
129
  expiresAt: string;
124
130
  deduped?: boolean;
125
131
  via?: 'chat' | 'device';
132
+ message?: string;
126
133
  } | {
127
134
  status: 'undelivered';
128
135
  message: string;
@@ -135,6 +142,11 @@ export type ProposeResult = {
135
142
  };
136
143
  /** The card's change lines may not exceed this (the card must fit whole in one message). */
137
144
  export declare const MAX_CARD_SUMMARY = 3000;
145
+ /** Compatibility with the shipped native decoder: 40 lines of 400 Characters.
146
+ * Code points are at least as numerous as Swift grapheme clusters. Never truncate
147
+ * disclosure, including requests persisted by older servers.
148
+ */
149
+ export declare function appApprovalSummaryLines(summary: readonly string[]): string[] | null;
138
150
  /** Open, unexpired requests one person may have at a time. */
139
151
  export declare const MAX_OPEN_REQUESTS = 3;
140
152
  export type ReceiptOutcome = 'duplicate' | 'not-recorded' | 'acceptance-recorded' | 'not-for-us' | 'instruction-sent' | 'refused' | 'approved' | 'apply-failed';
@@ -142,13 +154,21 @@ export declare class AccountPathService {
142
154
  private readonly d;
143
155
  private readonly now;
144
156
  private devices;
157
+ private proposalTail;
158
+ private readonly deliveryReservations;
145
159
  constructor(d: AccountPathDeps);
146
160
  /** The device registry lives in the server, built after this service; the server binds it here. */
147
161
  bindDevices(devices: DeviceDirectory | null): void;
148
162
  private holds;
149
163
  /** Which adapter reaches the owner: Telegram first, then Slack. */
150
164
  private ownerAdapter;
165
+ /** Current app reachability is distinct from historical chat delivery and from approval consent. */
166
+ approvalDelivery(principal?: string): Promise<{
167
+ state: 'accepted' | 'setup' | 'none' | 'unknown';
168
+ message: string;
169
+ }>;
151
170
  propose(change: TrustChange, principal?: string): Promise<ProposeResult>;
171
+ private prepareProposal;
152
172
  /** True when the statement is in the person's chat (sent now, or within the last day). */
153
173
  private sendAcceptanceStatement;
154
174
  private sendCard;
@@ -185,6 +205,8 @@ export declare class AccountPathService {
185
205
  /** The person withdraws their acceptance (a narrowing: stops new consumption, keeps committed grants). */
186
206
  /** A request counts as delivered when its card is in the person's chat, or it is a device request. */
187
207
  private delivered;
208
+ /** In-flight reservations count even before their base request is durable; never count a durable row twice. */
209
+ private deliveryCount;
188
210
  /**
189
211
  * agent-work-cards-default §5 (b): withdraw a request the agent raised and that no person has answered. The stored
190
212
  * request becomes `withdrawn`, its chat card (when delivered) is told so, a reply with its code is refused, and the
@@ -307,6 +329,7 @@ export interface DeviceRequestRow {
307
329
  expiresAt: string;
308
330
  changeKind: string | null;
309
331
  via: 'chat' | 'device';
332
+ delivery: 'app-listed' | 'chat-confirmed' | 'chat-unconfirmed';
310
333
  approvedAt?: string;
311
334
  approvedOn?: 'chat' | 'device';
312
335
  disclosure?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"AccountPathService.d.ts","sourceRoot":"","sources":["../../../src/core/trustJourney/AccountPathService.ts"],"names":[],"mappings":"AAUA,OAAO,EAEL,KAAK,WAAW,EAAE,KAAK,OAAO,EAAsB,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAyD,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAClH,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAErG;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,8DAA8D;IAC9D,MAAM,EAAE,OAAO,CAAC;IAChB,mEAAmE;IACnE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,+EAA+E;IAC/E,eAAe,EAAE,MAAM,GAAG,IAAI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M,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
1
+ {"version":3,"file":"AccountPathService.d.ts","sourceRoot":"","sources":["../../../src/core/trustJourney/AccountPathService.ts"],"names":[],"mappings":"AAUA,OAAO,EAEL,KAAK,WAAW,EAAE,KAAK,OAAO,EAAsB,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAyD,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAClH,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAErG;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,8DAA8D;IAC9D,MAAM,EAAE,OAAO,CAAC;IAChB,mEAAmE;IACnE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,+EAA+E;IAC/E,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC;IACjC,kHAAkH;IAClH,YAAY,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAAC;IAC7C,gFAAgF;IAChF,IAAI,CAAC,IAAI,cAAc,EAAE,CAAC;IAC1B,6FAA6F;IAC7F,MAAM,CAAC,CAAC,OAAO,EAAE,eAAe,GAAG,qBAAqB,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACnF,mHAAmH;IACnH,OAAO,CAAC,IAAI,OAAO,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc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B,CAAC;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -23,12 +23,46 @@ export function proofSubject(change) {
23
23
  }
24
24
  /** The card's change lines may not exceed this (the card must fit whole in one message). */
25
25
  export const MAX_CARD_SUMMARY = 3000;
26
+ /** Compatibility with the shipped native decoder: 40 lines of 400 Characters.
27
+ * Code points are at least as numerous as Swift grapheme clusters. Never truncate
28
+ * disclosure, including requests persisted by older servers.
29
+ */
30
+ export function appApprovalSummaryLines(summary) {
31
+ if (summary.length <= 40 && summary.every((line) => Array.from(line).length <= 400))
32
+ return [...summary];
33
+ const text = summary.join('\n');
34
+ if (Array.from(text).length > 40 * 400)
35
+ return null;
36
+ const lines = [];
37
+ let line = '', count = 0;
38
+ // Native views render each entry separately. Keep flags, combining marks and
39
+ // ZWJ sequences together rather than changing their displayed meaning.
40
+ for (const { segment } of new Intl.Segmenter(undefined, { granularity: 'grapheme' }).segment(text)) {
41
+ const size = Array.from(segment).length;
42
+ if (size > 400)
43
+ return null;
44
+ if (count + size > 400) {
45
+ lines.push(line);
46
+ line = '';
47
+ count = 0;
48
+ }
49
+ line += segment;
50
+ count += size;
51
+ }
52
+ if (line)
53
+ lines.push(line);
54
+ if (lines.length > 40)
55
+ return null;
56
+ return lines;
57
+ }
26
58
  /** Open, unexpired requests one person may have at a time. */
27
59
  export const MAX_OPEN_REQUESTS = 3;
28
60
  export class AccountPathService {
29
61
  d;
30
62
  now;
31
63
  devices;
64
+ proposalTail = Promise.resolve();
65
+ deliveryReservations = new Map();
32
66
  constructor(d) {
33
67
  this.d = d;
34
68
  this.now = d.now ?? (() => new Date());
@@ -44,65 +78,145 @@ export class AccountPathService {
44
78
  return a;
45
79
  return null;
46
80
  }
81
+ /** Current app reachability is distinct from historical chat delivery and from approval consent. */
82
+ async approvalDelivery(principal = 'owner') {
83
+ if (!this.holds())
84
+ return { state: 'unknown', message: HOLDER_MESSAGE };
85
+ try {
86
+ if (!this.devices || this.devices.enabled?.() === false)
87
+ return { state: 'none', message: 'App approvals are unavailable here. A configured private approval chat can still be used.' };
88
+ const accepted = await this.approvingDevices(principal);
89
+ if (!this.holds())
90
+ return { state: 'unknown', message: HOLDER_MESSAGE };
91
+ if (accepted.length > 0)
92
+ return { state: 'accepted', message: 'Review this in the Instar app under Changes to approve. Confirm the exact change with Face ID or Touch ID.' };
93
+ const paired = principal === 'owner' ? (this.devices.list?.() ?? []).filter((d) => d.active && !!d.keyFingerprint) : [];
94
+ if (!paired.length)
95
+ return { state: 'none', message: 'No eligible owner app device is available. Pair an iPhone through the app on the agent’s computer, or use a locally paired Mac with Touch ID. A reconnected remote phone alone does not restore approval consent.' };
96
+ const firstPhone = paired.some((d) => d.deviceKind === 'phone' && (d.firstPairing || d.localInstall));
97
+ return { state: 'setup', message: firstPhone
98
+ ? 'Open Changes to approve in the Instar iPhone app and turn on approvals before approving this request. Telegram is not required.'
99
+ : 'Open Changes to approve on an already accepted device to allow this one. With no accepted device, pair an iPhone through the local Instar app first. A locally paired Mac with Touch ID can set up or replace its approval key; a Mac without Touch ID needs the iPhone.' };
100
+ }
101
+ catch (err) {
102
+ // @silent-fallback-ok: unknown refuses routing, never falls through to chat or grants approval.
103
+ this.d.log?.('trust-device-availability-unknown', { error: err instanceof Error ? err.message : String(err) });
104
+ return { state: 'unknown', message: 'I could not check the paired approval devices. The request has not changed. Try again.' };
105
+ }
106
+ }
47
107
  async propose(change, principal = 'owner') {
108
+ // Reserve fresh-request admission through the durable write, never across an external chat call.
109
+ const before = this.proposalTail;
110
+ let release;
111
+ this.proposalTail = new Promise((done) => { release = done; });
112
+ await before;
113
+ let prepared;
114
+ try {
115
+ prepared = await this.prepareProposal(change, principal);
116
+ }
117
+ finally {
118
+ release();
119
+ }
120
+ return typeof prepared === 'function' ? prepared() : prepared;
121
+ }
122
+ async prepareProposal(change, principal) {
123
+ if (!this.holds())
124
+ return { status: 'not-holder', message: HOLDER_MESSAGE };
48
125
  if (this.d.raisesOf(change).length === 0)
49
126
  return { status: 'not-a-raise' };
127
+ const delivery = await this.approvalDelivery(principal);
128
+ if (delivery.state === 'unknown')
129
+ return { status: 'not-recorded', message: delivery.message };
130
+ const app = delivery.state === 'accepted' || delivery.state === 'setup';
50
131
  const adapter = this.ownerAdapter();
51
- const approvingDevices = await this.approvingDevices(principal);
52
- if (!adapter && approvingDevices.length === 0) {
53
- return { status: 'no-approver', message: `Nothing can approve this yet: no direct chat reaches the owner and no paired device has accepted approvals. ${SET_UP_APPROVALS_TEXT} (A chat also works: set the owner id for Telegram, messaging telegram config ownerUserId, or Slack, mobilePairing.slackOwnerUserId, in the setup conversation.)` };
54
- }
55
132
  const proposalHash = proposalHashOf(proofSubject(change));
56
- const dup = this.d.store.openRequests().find((r) => r.proposalHash === proposalHash && r.principal === principal);
57
- if (dup && new Date(dup.expiresAt) > this.now()) {
133
+ const dup = this.d.store.openRequests().find((r) => r.proposalHash === proposalHash && r.principal === principal && new Date(r.expiresAt) > this.now());
134
+ if (dup) {
135
+ const derived = app ? this.derivedSummary(dup) : null;
136
+ if (app && !derived)
137
+ return { status: 'not-recorded', message: 'This request does not match the change it would make. The existing request is unchanged; ask for a fresh request.' };
138
+ if (app && !appApprovalSummaryLines(derived))
139
+ return { status: 'too-large', message: 'This request cannot be shown whole in this app. The existing request is unchanged; split the change into smaller requests.' };
140
+ if (app) {
141
+ if (dup.adapter !== 'device' && !dup.cardMessageId) {
142
+ if (!this.holds())
143
+ return { status: 'not-holder', message: HOLDER_MESSAGE };
144
+ const w = await this.d.store.write('request-carrier', { requestId: dup.requestId, principal: dup.principal, proposalHash: dup.proposalHash, expiresAt: dup.expiresAt, adapter: 'device' }, `tj:request-carrier:${dup.requestId}:device`);
145
+ if (!w.ok && this.d.store.request(dup.requestId)?.adapter !== 'device')
146
+ return { status: 'not-recorded', message: 'The app delivery update could not be recorded. The original request is unchanged.' };
147
+ if (w.ok && this.holds())
148
+ this.notifyDevices('trust-request', `trust-request:${dup.requestId}`);
149
+ }
150
+ return { status: delivery.state === 'accepted' ? 'sent' : 'awaiting-acceptance', via: 'device', requestId: dup.requestId, code: dup.code, expiresAt: dup.expiresAt, deduped: true, message: delivery.message };
151
+ }
58
152
  if (dup.adapter === 'device')
59
- return { status: 'sent', via: 'device', requestId: dup.requestId, code: dup.code, expiresAt: dup.expiresAt, deduped: true };
60
- return { status: dup.cardMessageId ? 'sent' : 'awaiting-acceptance', requestId: dup.requestId, code: dup.code, expiresAt: dup.expiresAt, deduped: true };
153
+ return { status: 'no-approver', requestId: dup.requestId, message: delivery.message };
154
+ return { status: dup.cardMessageId ? 'sent' : 'awaiting-acceptance', via: 'chat', requestId: dup.requestId, code: dup.code, expiresAt: dup.expiresAt, deduped: true,
155
+ ...(!dup.cardMessageId ? { message: 'Chat delivery is unconfirmed. In your private approval chat, repeat the acceptance statement to resend pending cards. Nothing has been approved.' } : {}) };
61
156
  }
62
- // agent-work-cards-default §5 (b): a withdrawn proposal cannot be re-raised for `cardTtlDays`, so withdraw-and-re-raise mints no fresh cards.
157
+ if (!app && !adapter)
158
+ return { status: 'no-approver', message: `Nothing can approve this yet. ${delivery.message} ${SET_UP_APPROVALS_TEXT}` };
63
159
  const recentlyWithdrawn = this.d.store.allRequests().find((r) => r.proposalHash === proposalHash && r.principal === principal && r.status === 'withdrawn' && new Date(r.expiresAt) > this.now());
64
160
  if (recentlyWithdrawn)
65
161
  return { status: 'withdrawn-recently', message: `This exact change was withdrawn by the agent and cannot be asked again until ${recentlyWithdrawn.expiresAt}.` };
66
- const code = newApprovalCode((c) => this.d.store.codeTaken(c));
67
- const expiresAt = new Date(this.now().getTime() + this.d.cardTtlDays() * 86_400_000).toISOString();
68
- const requestId = `tr-${proposalHash.slice(0, 12)}-${code}`;
69
162
  const summary = this.d.summarize(change);
70
- if (summary.join('\n').length > MAX_CARD_SUMMARY) {
163
+ if (summary.join('\n').length > MAX_CARD_SUMMARY || (app && !appApprovalSummaryLines(summary)))
71
164
  return { status: 'too-large', message: 'This change is too large to show whole on one card, so no card was sent. Split it into smaller changes.' };
72
- }
73
- // At most a few open requests per person, so the person is never flooded toward approving. Only a DELIVERED
74
- // request (a card in the chat, or a device request) counts toward the open cap (agent-work-cards-default §5):
75
- // undelivered chat requests have their own cap of the same size, and the acceptance flush sends what fits.
76
165
  const live = this.d.store.openRequests().filter((r) => r.principal === principal && new Date(r.expiresAt) > this.now());
77
- if (live.filter((r) => this.delivered(r)).length >= MAX_OPEN_REQUESTS) {
166
+ if (this.deliveryCount(principal) >= MAX_OPEN_REQUESTS)
78
167
  return { status: 'too-many-open', message: `There are already ${MAX_OPEN_REQUESTS} requests waiting for the person; no new card is sent until one is answered or expires.` };
168
+ if (live.filter((r) => !this.delivered(r)).length >= MAX_OPEN_REQUESTS)
169
+ return { status: 'too-many-undelivered', message: `There are already ${MAX_OPEN_REQUESTS} requests waiting to be delivered. Answer, deliver or let one expire before creating another.` };
170
+ const code = newApprovalCode((c) => this.d.store.codeTaken(c));
171
+ const expiresAt = new Date(this.now().getTime() + this.d.cardTtlDays() * 86_400_000).toISOString();
172
+ const requestId = `tr-${proposalHash.slice(0, 12)}-${code}`;
173
+ const carrier = app ? 'device' : adapter;
174
+ const ownerId = app ? '' : this.d.ownerPlatformId(adapter);
175
+ const base = { requestId, code, proposalHash, principal, adapter: carrier, approverPlatformId: ownerId, expiresAt, status: 'open', change, summary, cardMessageId: '', cardChatId: '' };
176
+ if (!this.holds())
177
+ return { status: 'not-holder', message: HOLDER_MESSAGE };
178
+ // Reserve before the durability await so an independent acceptance flush cannot take this slot.
179
+ const creatorReserved = !app && !!this.d.store.acceptance(principal, adapter);
180
+ if (app || creatorReserved)
181
+ this.deliveryReservations.set(requestId, principal);
182
+ let w;
183
+ try {
184
+ w = await this.d.store.write('request', base, `tj:request:${requestId}`);
79
185
  }
80
- if (live.filter((r) => !this.delivered(r)).length >= MAX_OPEN_REQUESTS) {
81
- return { status: 'too-many-undelivered', message: `There are already ${MAX_OPEN_REQUESTS} requests waiting to be delivered to the person (their chat has not accepted approvals yet); no new one is recorded until one is sent, answered or expires.` };
186
+ catch (err) {
187
+ // @silent-fallback-ok: a failed durable append refuses publication; no send or approval follows.
188
+ this.deliveryReservations.delete(requestId);
189
+ this.d.log?.('trust-request-not-recorded', { requestId, error: err instanceof Error ? err.message : String(err) });
190
+ return { status: 'not-recorded', message: 'The request could not be recorded durably, so nothing was sent.' };
82
191
  }
83
- if (!adapter) {
84
- // No chat: the request goes to the accepted devices (app-trust-approval §B, When there's no chat).
85
- const w = await this.d.store.write('request', { requestId, code, proposalHash, principal, adapter: 'device', approverPlatformId: '', expiresAt, status: 'open', change, summary, cardMessageId: '', cardChatId: '' }, `tj:request:${requestId}`);
86
- if (!w.ok)
87
- return { status: 'not-recorded', message: 'The request could not be recorded durably, so nothing was sent.' };
88
- this.notifyDevices('trust-request', `trust-request:${requestId}`);
89
- return { status: 'sent', via: 'device', requestId, code, expiresAt };
192
+ if (!w.ok) {
193
+ this.deliveryReservations.delete(requestId);
194
+ return { status: 'not-recorded', message: 'The request could not be recorded durably, so nothing was sent.' };
90
195
  }
91
- const ownerId = this.d.ownerPlatformId(adapter);
92
- const base = { requestId, code, proposalHash, principal, adapter, approverPlatformId: ownerId, expiresAt, status: 'open', change, summary };
93
- // An accepted device can approve a chat request too; the first approval to arrive consumes it.
94
- if (approvingDevices.length > 0)
196
+ if (app) {
197
+ this.deliveryReservations.delete(requestId); // The durable device row now owns the same delivery slot.
198
+ if (!this.holds())
199
+ return { status: 'not-holder', message: HOLDER_MESSAGE };
95
200
  this.notifyDevices('trust-request', `trust-request:${requestId}`);
96
- if (!this.d.store.acceptance(principal, adapter)) {
97
- const w = await this.d.store.write('request', { ...base, cardMessageId: '', cardChatId: '' });
98
- if (!w.ok)
99
- return { status: 'not-recorded', message: 'The request could not be recorded durably, so nothing was sent.' };
100
- if (!(await this.sendAcceptanceStatement(principal, adapter, ownerId))) {
101
- return { status: 'undelivered', message: 'The acceptance message could not be delivered to the owner\'s direct chat (they may not have opened a chat with the bot yet), so no card can follow. Nothing was approved.' };
201
+ return { status: delivery.state === 'accepted' ? 'sent' : 'awaiting-acceptance', via: 'device', requestId, code, expiresAt, message: delivery.message };
202
+ }
203
+ // The creating invocation alone owns this send. A duplicate observes the pending durable row.
204
+ return async () => {
205
+ try {
206
+ if (!this.holds())
207
+ return { status: 'not-holder', message: HOLDER_MESSAGE };
208
+ if (!this.d.store.acceptance(principal, adapter)) {
209
+ if (!(await this.sendAcceptanceStatement(principal, adapter, ownerId)))
210
+ return { status: 'undelivered', message: 'The acceptance message could not be delivered to the owner’s private chat. The request remains visible in Needs-you and in the Instar app. Nothing was approved.' };
211
+ return { status: 'awaiting-acceptance', via: 'chat', requestId, code, expiresAt };
212
+ }
213
+ return await this.sendCard(base, creatorReserved);
102
214
  }
103
- return { status: 'awaiting-acceptance', requestId, code, expiresAt };
104
- }
105
- return this.sendCard(base);
215
+ finally {
216
+ if (creatorReserved)
217
+ this.deliveryReservations.delete(requestId);
218
+ }
219
+ };
106
220
  }
107
221
  /** True when the statement is in the person's chat (sent now, or within the last day). */
108
222
  async sendAcceptanceStatement(principal, adapter, ownerId) {
@@ -124,24 +238,37 @@ export class AccountPathService {
124
238
  this.d.log?.('trust-acceptance-undelivered', { adapter });
125
239
  return false;
126
240
  }
127
- async sendCard(req) {
241
+ async sendCard(req, creatorReserved = false) {
242
+ if (!this.holds())
243
+ return { status: 'not-holder', message: HOLDER_MESSAGE };
128
244
  if (req.adapter === 'device')
129
245
  return { status: 'sent', via: 'device', requestId: req.requestId, code: req.code, expiresAt: req.expiresAt };
130
- const port = this.d.adapters[req.adapter];
131
- // SEC-141: the card shows text rebuilt from the change, never the stored summary (a deferred card
132
- // is re-sent from the stored record when the owner accepts).
133
- const live = this.verified(req);
134
- if (!live.ok)
135
- return { status: 'undelivered', message: 'This request does not match the change it would make, so no card was sent and nothing was approved.' };
136
- const text = renderRequestCard({ summary: { lines: live.summary }, code: req.code, expiresAt: req.expiresAt });
137
- const sent = await port.sendDirect(req.approverPlatformId, text);
138
- if (!sent) {
139
- return { status: 'undelivered', message: 'The request card could not be delivered to the owner\'s direct chat (they may not have opened a chat with the bot yet). Nothing was approved.' };
246
+ if (!creatorReserved && this.deliveryReservations.has(req.requestId))
247
+ return { status: 'awaiting-acceptance', via: 'chat', requestId: req.requestId, code: req.code, expiresAt: req.expiresAt, deduped: true, message: 'Delivery of this existing request is already in progress.' };
248
+ const ownsReservation = !creatorReserved;
249
+ if (ownsReservation) {
250
+ if (this.deliveryCount(req.principal) >= MAX_OPEN_REQUESTS)
251
+ return { status: 'too-many-open', message: 'The existing approval delivery allowance is full. This pending request stays visible until another is answered or expires.' };
252
+ this.deliveryReservations.set(req.requestId, req.principal);
253
+ }
254
+ try {
255
+ const port = this.d.adapters[req.adapter];
256
+ const live = this.verified(req);
257
+ if (!live.ok)
258
+ return { status: 'undelivered', message: 'This request does not match the change it would make, so no card was sent and nothing was approved.' };
259
+ const text = renderRequestCard({ summary: { lines: live.summary }, code: req.code, expiresAt: req.expiresAt });
260
+ const sent = await port.sendDirect(req.approverPlatformId, text);
261
+ if (!sent)
262
+ return { status: 'undelivered', message: 'The request card could not be delivered to the owner’s private chat. The pending request remains visible; nothing was approved.' };
263
+ const w = await this.d.store.write('request', { ...req, cardMessageId: sent.messageId, cardChatId: sent.chatId, status: 'open' }, `tj:request:${req.requestId}:card`);
264
+ if (!w.ok)
265
+ return { status: 'not-recorded', message: 'The chat accepted the card but its delivery record is unconfirmed. The pending request remains visible; a reply to that unrecorded card cannot approve anything.' };
266
+ return { status: 'sent', via: 'chat', requestId: req.requestId, code: req.code, expiresAt: req.expiresAt };
267
+ }
268
+ finally {
269
+ if (ownsReservation)
270
+ this.deliveryReservations.delete(req.requestId);
140
271
  }
141
- const w = await this.d.store.write('request', { ...req, cardMessageId: sent.messageId, cardChatId: sent.chatId, status: 'open' }, `tj:request:${req.requestId}:card`);
142
- if (!w.ok)
143
- return { status: 'not-recorded', message: 'The card was sent but could not be recorded, so a reply to it will not approve anything.' };
144
- return { status: 'sent', requestId: req.requestId, code: req.code, expiresAt: req.expiresAt };
145
272
  }
146
273
  /** A receipt from the adapter's own inbound path. Called on the holder. */
147
274
  /**
@@ -209,8 +336,8 @@ export class AccountPathService {
209
336
  // The flush is bounded (agent-work-cards-default §5): min(cap − delivered open, undelivered), newest first; the
210
337
  // rest stay undelivered and expire at `cardTtlDays`.
211
338
  const open = this.d.store.openRequests().filter((x) => x.principal === principal && new Date(x.expiresAt) > this.now());
212
- const room = Math.max(0, MAX_OPEN_REQUESTS - open.filter((x) => this.delivered(x)).length);
213
- const undelivered = open.filter((x) => x.adapter === adapter && !x.cardMessageId).sort((a, b) => (a.expiresAt < b.expiresAt ? 1 : a.expiresAt > b.expiresAt ? -1 : 0));
339
+ const room = Math.max(0, MAX_OPEN_REQUESTS - this.deliveryCount(principal));
340
+ const undelivered = open.filter((x) => x.adapter === adapter && !x.cardMessageId && !this.deliveryReservations.has(x.requestId)).sort((a, b) => (a.expiresAt < b.expiresAt ? 1 : a.expiresAt > b.expiresAt ? -1 : 0));
214
341
  for (const q of undelivered.slice(0, room)) {
215
342
  await this.sendCard(q);
216
343
  }
@@ -323,6 +450,12 @@ export class AccountPathService {
323
450
  /** The person withdraws their acceptance (a narrowing: stops new consumption, keeps committed grants). */
324
451
  /** A request counts as delivered when its card is in the person's chat, or it is a device request. */
325
452
  delivered(r) { return r.adapter === 'device' || !!r.cardMessageId; }
453
+ /** In-flight reservations count even before their base request is durable; never count a durable row twice. */
454
+ deliveryCount(principal) {
455
+ const delivered = this.d.store.openRequests().filter((r) => r.principal === principal && new Date(r.expiresAt) > this.now() && this.delivered(r));
456
+ const ids = new Set(delivered.map((r) => r.requestId));
457
+ return delivered.length + [...this.deliveryReservations].filter(([id, who]) => who === principal && !ids.has(id)).length;
458
+ }
326
459
  /**
327
460
  * agent-work-cards-default §5 (b): withdraw a request the agent raised and that no person has answered. The stored
328
461
  * request becomes `withdrawn`, its chat card (when delivered) is told so, a reply with its code is refused, and the
@@ -621,6 +754,8 @@ export class AccountPathService {
621
754
  const live = this.verified(req);
622
755
  if (!live.ok)
623
756
  return refuse('request-altered', 'This request does not match the change it would make, so nothing was approved. The agent can send a fresh one.');
757
+ if (!appApprovalSummaryLines(live.summary))
758
+ return refuse('disclosure-too-large', 'This request cannot be shown whole in this app, so nothing was approved. Ask the agent to split it into smaller requests.');
624
759
  const onRecord = this.d.store.deviceAcceptance(auth.deviceId);
625
760
  if (!onRecord) {
626
761
  return this.d.store.deviceAcceptanceWithdrawn(auth.deviceId)
@@ -696,8 +831,9 @@ export class AccountPathService {
696
831
  const outcome = this.d.store.applyOutcome(r.requestId);
697
832
  const byDevice = consumption?.kind === 'accepted-device';
698
833
  out.push({
699
- requestId: r.requestId, status, summary: live.summary, proposalHash: r.proposalHash, expiresAt: r.expiresAt,
834
+ requestId: r.requestId, status, summary: appApprovalSummaryLines(live.summary) ?? ['This request is too large to show whole in this app. It cannot be approved here. Ask the agent to split it into smaller requests.'], proposalHash: r.proposalHash, expiresAt: r.expiresAt,
700
835
  changeKind: r.change?.kind ?? null, via: r.adapter === 'device' ? 'device' : 'chat',
836
+ delivery: r.adapter === 'device' ? 'app-listed' : r.cardMessageId ? 'chat-confirmed' : 'chat-unconfirmed',
701
837
  ...(consumption ? {
702
838
  approvedAt: consumption.at,
703
839
  approvedOn: byDevice ? 'device' : 'chat',