feat(contracts): track thread title regeneration

- Add optional title regeneration request and start time to thread shells
- Cover cache serialization on mobile and client runtime
This commit is contained in:
Julius Marminge committed 2026-08-14 11:23:51 +02:00
1 parent 402fde73dd
commit 8dcbdcac52
3 files changed
+26

No files matched your search

@@ -1,5 +1,6 @@
import { ORCHESTRATION_CACHE_SCHEMA_VERSION } from "@t3tools/client-runtime/platform";
import {
CommandId,
EnvironmentId,
ProjectId,
ProviderInstanceId,
@@ -74,6 +75,10 @@ const SHELL_SNAPSHOT: OrchestrationV2ShellSnapshot = {
settledOverride: null,
settledAt: NOW,
lastVisitedAt: null,
titleRegeneration: {
requestId: CommandId.make("title-regeneration-1"),
startedAt: NOW,
},
deletedAt: null,
},
],
@@ -205,6 +210,9 @@ describe("mobile SQLite environment cache store", () => {
expect(DateTime.formatIso(shell.threads[0]!.latestUserMessageAt!)).toBe(
"2026-07-29T12:00:00.000Z",
);
expect(DateTime.formatIso(shell.threads[0]!.titleRegeneration!.startedAt)).toBe(
"2026-07-29T12:00:00.000Z",
);
expect(DateTime.formatIso(thread.projection.thread.updatedAt)).toBe(
"2026-07-29T12:00:00.000Z",
);
@@ -1,5 +1,6 @@
import { describe, expect, it } from "@effect/vitest";
import {
CommandId,
EnvironmentId,
MessageId,
RuntimeRequestId,
@@ -59,6 +60,10 @@ const shellSnapshotWithSummaries: OrchestrationV2ShellSnapshot = {
},
latestUserMessageAt: v2Now,
settledAt: v2Now,
titleRegeneration: {
requestId: CommandId.make("title-regeneration-v2"),
startedAt: v2Now,
},
},
],
};
@@ -98,6 +103,11 @@ describe("orchestration cache envelopes", () => {
? null
: DateTime.formatIso(threadShell.settledAt),
).toBe("2026-06-20T00:00:00.000Z");
expect(
threadShell?.titleRegeneration === null || threadShell?.titleRegeneration === undefined
? null
: DateTime.formatIso(threadShell.titleRegeneration.startedAt),
).toBe("2026-06-20T00:00:00.000Z");
expect(DateTime.formatIso(thread.snapshot.projection.thread.updatedAt)).toBe(
"2026-06-20T00:00:00.000Z",
);
@@ -1780,6 +1780,14 @@ export const OrchestrationV2ThreadShellJson = OrchestrationV2ThreadShell.mapFiel
snoozedAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)),
pinnedAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)),
lastVisitedAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)),
titleRegeneration: Schema.optional(
Schema.NullOr(
Schema.Struct({
requestId: CommandId,
startedAt: Schema.DateTimeUtcFromString,
}),
),
),
deletedAt: Schema.NullOr(Schema.DateTimeUtcFromString),
}));
export type OrchestrationV2ThreadShellJson = typeof OrchestrationV2ThreadShellJson.Type;