gestalt-mobile 0.49.3 → 0.49.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{index-CE4-9CY1.css → index-BaOoaR1r.css} +1 -1
- package/dist/client/assets/index-Lvl8SUQX.js +112 -0
- package/dist/client/index.html +2 -2
- package/dist/server/client/features/chat/chat-projection.js +10 -1
- package/dist/server/server/composition.contracts.js +12 -1
- package/dist/server/server/features/agent-activity/registry.js +11 -1
- package/dist/server/server/features/sessions/get-history/endpoint.js +11 -2
- package/dist/server/server/features/sessions/refresh-activity/endpoint.js +5 -1
- package/dist/server/server/platform/persistence/sqlite-event-journal.js +7 -4
- package/dist/server/shared/contracts/autopilot-audit.js +16 -0
- package/package.json +1 -1
- package/dist/client/assets/index-D7fHU74R.js +0 -113
package/dist/client/index.html
CHANGED
|
@@ -16,8 +16,8 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
16
16
|
<link rel="icon" href="/icons/gestalt-mobile-192.png" />
|
|
17
17
|
<link rel="apple-touch-icon" href="/icons/gestalt-mobile-180.png" />
|
|
18
18
|
<title>Gestalt Mobile</title>
|
|
19
|
-
<script type="module" crossorigin src="/assets/index-
|
|
20
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
19
|
+
<script type="module" crossorigin src="/assets/index-Lvl8SUQX.js"></script>
|
|
20
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BaOoaR1r.css">
|
|
21
21
|
</head>
|
|
22
22
|
<body>
|
|
23
23
|
<div id="app"></div>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Designed by Denis Roio <jaromil@dyne.org>
|
|
4
4
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
5
|
*/
|
|
6
|
-
import { autopilotAuditLabel } from '../../../shared/contracts/autopilot-audit.js';
|
|
6
|
+
import { autopilotAuditLabel, autopilotAuditAttention, } from '../../../shared/contracts/autopilot-audit.js';
|
|
7
7
|
import { toActivity } from './activity-summary.js';
|
|
8
8
|
const empty = () => ({
|
|
9
9
|
sessionId: null,
|
|
@@ -55,6 +55,7 @@ function auditMessage(item) {
|
|
|
55
55
|
text: item.label,
|
|
56
56
|
occurredAt: item.occurredAt,
|
|
57
57
|
...(item.controlId ? { controlId: item.controlId } : {}),
|
|
58
|
+
...(item.attention ? { attention: item.attention } : {}),
|
|
58
59
|
complete: true,
|
|
59
60
|
};
|
|
60
61
|
}
|
|
@@ -72,6 +73,9 @@ function auditEventMessage(event) {
|
|
|
72
73
|
label,
|
|
73
74
|
occurredAt,
|
|
74
75
|
...(controlId ? { controlId } : {}),
|
|
76
|
+
...(event.type === 'org-plan.attention-required' && autopilotAuditAttention(event.payload)
|
|
77
|
+
? { attention: autopilotAuditAttention(event.payload) }
|
|
78
|
+
: {}),
|
|
75
79
|
})
|
|
76
80
|
: null;
|
|
77
81
|
}
|
|
@@ -295,6 +299,11 @@ export function hydrateCache(sessionId, cached) {
|
|
|
295
299
|
typeof message.id === 'string' &&
|
|
296
300
|
(message.role === 'user' || message.role === 'assistant' || message.role === 'audit') &&
|
|
297
301
|
typeof message.text === 'string' &&
|
|
302
|
+
(message.attention === undefined ||
|
|
303
|
+
Boolean(autopilotAuditAttention({
|
|
304
|
+
...message.attention,
|
|
305
|
+
payload: message.attention.attention,
|
|
306
|
+
}))) &&
|
|
298
307
|
(message.occurredAt === undefined ||
|
|
299
308
|
(typeof message.occurredAt === 'number' && Number.isFinite(message.occurredAt)))))
|
|
300
309
|
.slice(-200),
|
|
@@ -2443,9 +2443,13 @@ describe('production composition', () => {
|
|
|
2443
2443
|
const handles = [];
|
|
2444
2444
|
const launch = liveAppServer(handles);
|
|
2445
2445
|
let unavailable = true;
|
|
2446
|
+
const retries = [];
|
|
2446
2447
|
const timers = [];
|
|
2447
2448
|
const fixture = await createProductionAutopilotFixture({
|
|
2448
|
-
activitySchedule: () =>
|
|
2449
|
+
activitySchedule: (callback) => {
|
|
2450
|
+
retries.push(callback);
|
|
2451
|
+
return () => { };
|
|
2452
|
+
},
|
|
2449
2453
|
autopilotSchedule: (callback) => {
|
|
2450
2454
|
const timer = { callback, cancelled: false, fired: false };
|
|
2451
2455
|
timers.push(timer);
|
|
@@ -2476,6 +2480,13 @@ describe('production composition', () => {
|
|
|
2476
2480
|
},
|
|
2477
2481
|
});
|
|
2478
2482
|
onTestFinished(() => fixture.app.close());
|
|
2483
|
+
// A refresh settles only after its bounded retry sequence, rather than
|
|
2484
|
+
// exposing the first intermediate reconciling snapshot as a failure.
|
|
2485
|
+
for (let retry = 0; retry < 3; retry++) {
|
|
2486
|
+
await vi.waitFor(() => expect(retries.length).toBeGreaterThan(0));
|
|
2487
|
+
retries.shift()();
|
|
2488
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
2489
|
+
}
|
|
2479
2490
|
await vi.waitFor(async () => {
|
|
2480
2491
|
expect((await fixture.app.inject(`/api/sessions/${fixture.sessionId}`)).json()).toMatchObject({ autopilot: { enabled: true, reason: 'reconcileFailed' } });
|
|
2481
2492
|
});
|
|
@@ -203,7 +203,17 @@ export class AgentActivityRegistry {
|
|
|
203
203
|
this.disconnected(sessionId, this.options.now?.() ?? now);
|
|
204
204
|
return;
|
|
205
205
|
}
|
|
206
|
-
|
|
206
|
+
// Keep the shared refresh pending until retry evidence or exhaustion.
|
|
207
|
+
// Otherwise a caller treats the intermediate reconciling projection as
|
|
208
|
+
// failure and can launch a new refresh that supersedes this retry.
|
|
209
|
+
await new Promise((resolve, reject) => {
|
|
210
|
+
const cancel = this.options.schedule(() => void this.#attempt(sessionId, generation, attempt + 1).then(resolve, reject), delays[attempt - 1]);
|
|
211
|
+
this.#timers.set(sessionId, () => {
|
|
212
|
+
cancel();
|
|
213
|
+
// Suspension, disposal, or newer live evidence retires this read.
|
|
214
|
+
resolve();
|
|
215
|
+
});
|
|
216
|
+
});
|
|
207
217
|
}
|
|
208
218
|
}
|
|
209
219
|
#qualify(sessionId, occurredAt, confidence, fact) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Designed by Denis Roio <jaromil@dyne.org>
|
|
4
4
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
5
|
*/
|
|
6
|
-
import { autopilotAuditLabel } from '../../../../shared/contracts/autopilot-audit.js';
|
|
6
|
+
import { autopilotAuditLabel, autopilotAuditAttention, } from '../../../../shared/contracts/autopilot-audit.js';
|
|
7
7
|
import { toChatItems, toChatTurns } from './history-mapper.js';
|
|
8
8
|
/**
|
|
9
9
|
* ChatSnapshot is a lower-bound cut: baseSequence is sampled before the
|
|
@@ -125,13 +125,22 @@ function toAutopilotAudit(events) {
|
|
|
125
125
|
const label = autopilotAuditLabel(event.type, event.payload);
|
|
126
126
|
if (!label)
|
|
127
127
|
return [];
|
|
128
|
+
const attention = event.type === 'org-plan.attention-required'
|
|
129
|
+
? autopilotAuditAttention(event.payload)
|
|
130
|
+
: undefined;
|
|
128
131
|
const controlId = event.payload &&
|
|
129
132
|
typeof event.payload === 'object' &&
|
|
130
133
|
typeof event.payload.controlId === 'string'
|
|
131
134
|
? event.payload.controlId
|
|
132
135
|
: undefined;
|
|
133
136
|
return [
|
|
134
|
-
{
|
|
137
|
+
{
|
|
138
|
+
id: `audit:${event.sequence}`,
|
|
139
|
+
label,
|
|
140
|
+
occurredAt,
|
|
141
|
+
...(controlId ? { controlId } : {}),
|
|
142
|
+
...(attention ? { attention } : {}),
|
|
143
|
+
},
|
|
135
144
|
];
|
|
136
145
|
});
|
|
137
146
|
}
|
|
@@ -8,7 +8,11 @@ export function registerRefreshActivity(app, deps) {
|
|
|
8
8
|
const id = request.params.id;
|
|
9
9
|
if (!deps.exists(id))
|
|
10
10
|
return reply.code(404).send({ code: 'SESSION_NOT_FOUND' });
|
|
11
|
-
|
|
11
|
+
// This is an acceptance boundary. A bounded retry may still be pending;
|
|
12
|
+
// clients receive its authoritative outcome through activity events.
|
|
13
|
+
void deps.refresh(id).catch(() => {
|
|
14
|
+
request.log.warn({ code: 'ACTIVITY_REFRESH_FAILED' }, 'Activity refresh failed');
|
|
15
|
+
});
|
|
12
16
|
return reply.code(202).send({ accepted: true });
|
|
13
17
|
});
|
|
14
18
|
}
|
|
@@ -96,13 +96,16 @@ export class SqliteEventJournal {
|
|
|
96
96
|
.prepare(`
|
|
97
97
|
SELECT substr(json_extract(payload_json, '$.text'), 1, 4001) AS text
|
|
98
98
|
FROM session_events
|
|
99
|
-
WHERE session_id = ? AND type = 'agentMessageCompleted'
|
|
99
|
+
WHERE session_id = ? AND type = 'agentMessageCompleted'
|
|
100
100
|
AND json_extract(payload_json, '$.turnId') = ?
|
|
101
|
-
AND
|
|
101
|
+
AND (
|
|
102
|
+
(json_extract(payload_json, '$.phase') = 'final_answer' AND occurred_at >= ?)
|
|
103
|
+
OR (json_extract(payload_json, '$.phase') = 'commentary' AND occurred_at <= ?)
|
|
104
|
+
)
|
|
102
105
|
AND json_type(payload_json, '$.text') = 'text'
|
|
103
|
-
ORDER BY sequence DESC LIMIT 1
|
|
106
|
+
ORDER BY (json_extract(payload_json, '$.phase') = 'final_answer') DESC, sequence DESC LIMIT 1
|
|
104
107
|
`)
|
|
105
|
-
.get(sessionId, requestedAt,
|
|
108
|
+
.get(sessionId, turnId, requestedAt, requestedAt);
|
|
106
109
|
return boundedAttentionReport(row?.text);
|
|
107
110
|
}
|
|
108
111
|
/** Bounded chronological tail for redacted timeline projections. */
|
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
* Designed by Denis Roio <jaromil@dyne.org>
|
|
4
4
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
5
|
*/
|
|
6
|
+
import { parseOrgPlanAttention } from './org-plan-attention.js';
|
|
7
|
+
/** Only the bounded attention contract belongs in historical dialogue metadata. */
|
|
8
|
+
export function autopilotAuditAttention(payload) {
|
|
9
|
+
const requestId = property(payload, 'requestId');
|
|
10
|
+
const attention = parseOrgPlanAttention(property(payload, 'payload'));
|
|
11
|
+
if (typeof requestId !== 'string' || requestId.length > 256 || !attention)
|
|
12
|
+
return undefined;
|
|
13
|
+
const turnId = property(payload, 'turnId');
|
|
14
|
+
const requestedAt = property(payload, 'requestedAt');
|
|
15
|
+
return {
|
|
16
|
+
requestId,
|
|
17
|
+
turnId: typeof turnId === 'string' ? turnId : null,
|
|
18
|
+
requestedAt: typeof requestedAt === 'string' ? requestedAt : null,
|
|
19
|
+
attention,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
6
22
|
/** Maps durable events to the intentionally small user-visible Autopilot timeline. */
|
|
7
23
|
export function autopilotAuditLabel(type, payload) {
|
|
8
24
|
if (type === 'autopilot.turn-started')
|