Skip to content

Commit 0360b6c

Browse files
Merge remote-tracking branch 'origin/main' into fix/issue-24743
2 parents 441ade6 + 0790e38 commit 0360b6c

17 files changed

Lines changed: 329 additions & 43 deletions

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ We are (mostly) not accepting contributions yet. Small fixes may be considered.
9494

9595
Full docs live in [docs/](./docs). There's no docs site yet.
9696

97+
- [FAQ](./docs/user/faq.md)
9798
- [Install and first run](./docs/user/install.md)
9899
- [Permission modes](./docs/user/permission-modes.md)
99100
- [Keyboard shortcuts](./docs/user/keybindings.md)

‎apps/mobile/src/features/threads/ThreadDetailScreen.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import type { ComposerTextPaste } from "../../native/T3ComposerEditor.types";
2626
import { type EnvironmentConnectionPhase } from "@t3tools/client-runtime/connection";
2727
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
2828
import type { HandoffEndpoints } from "@t3tools/client-runtime/handoff";
29+
import { queuedRunEditBlockedReason } from "@t3tools/client-runtime/queued-run-edit";
2930
import {
3031
childThreadInputsTitle,
3132
type CodexFeedbackSubmission,
@@ -777,6 +778,9 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
777778
const activeUserInputRequestId = props.activePendingUserInput?.requestId ?? null;
778779
const composerSlotHidden =
779780
activeUserInputRequestId !== null || props.creationState?.kind === "failed";
781+
const pendingMessageEditBlocked =
782+
queuedRunEditBlockedReason({ openQuestionCount: activeUserInputRequestId === null ? 0 : 1 }) !==
783+
null;
780784
const [usageLimitsPanel, setUsageLimitsPanel] = useState<{
781785
readonly key: string;
782786
readonly threadKey: string;
@@ -1167,6 +1171,7 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
11671171
};
11681172

11691173
const handleEditPendingMessage = async (message: QueuedThreadMessage) => {
1174+
if (pendingMessageEditBlocked) return;
11701175
const scope = threadScope.current.signal;
11711176
const edited = await settlePromise(() => editPendingThreadMessage(message));
11721177
if (AsyncResult.isFailure(edited)) {
@@ -1296,7 +1301,9 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
12961301
dispatchingMessageId={props.dispatchingMessageId}
12971302
// A native subagent has no composer to edit a pending message in;
12981303
// Cancel on the edit banner would discard it.
1299-
onEditPendingMessage={isProviderSubagent ? null : handleEditPendingMessage}
1304+
onEditPendingMessage={
1305+
isProviderSubagent || pendingMessageEditBlocked ? null : handleEditPendingMessage
1306+
}
13001307
contentPresentation={props.contentPresentation}
13011308
agentLabel={agentLabel}
13021309
threadTitle={props.selectedThread.title}

‎apps/mobile/src/features/threads/ThreadQueueControl.tsx‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { type StaticScreenProps, useNavigation } from "@react-navigation/native";
22
import { useAtomValue } from "@effect/atom-react";
3-
import { makeQueuedRunsAtom } from "@t3tools/client-runtime/queued-run-edit";
3+
import {
4+
makeQueuedRunsAtom,
5+
queuedRunEditBlockedReason,
6+
} from "@t3tools/client-runtime/queued-run-edit";
47
import type { ChatAttachment, EnvironmentId, RunId, ThreadId } from "@t3tools/contracts";
58
import { Atom } from "effect/reactivity";
69
import { Image } from "expo-image";
@@ -75,6 +78,10 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
7578
const workflow = useThreadQueueWorkflow(target);
7679
const threadKey = scopedThreadKey(target.environmentId, target.threadId);
7780
const editing = useQueuedRunEdit(threadKey);
81+
const pendingRequests = useAtomValue(environmentThreadDetails.pendingRequestsAtom(target));
82+
const editBlockedReason = queuedRunEditBlockedReason({
83+
openQuestionCount: pendingRequests?.userInputs.length ?? 0,
84+
});
7885
const reorder = useAtomCommand(threadEnvironment.reorderQueuedRun, "reorder queued message");
7986
const promote = useAtomCommand(threadEnvironment.promoteQueuedRun, "promote queued message");
8087
const cancel = useAtomCommand(threadEnvironment.cancelQueuedRun, "remove queued message");
@@ -127,6 +134,7 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
127134
return;
128135
}
129136
if (action === "edit") {
137+
if (editBlockedReason !== null) return;
130138
const entry = queuedRuns[index]!;
131139
void Haptics.selectionAsync();
132140
beginQueuedRunEdit(
@@ -212,6 +220,9 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
212220
/>
213221
</View>
214222
) : null}
223+
{editBlockedReason !== null && queuedRuns.length > 0 ? (
224+
<Text className="py-3 text-sm text-foreground-muted">{editBlockedReason}</Text>
225+
) : null}
215226
{queuedRuns.length === 0 ? (
216227
<Text className="pt-6 text-center text-sm text-foreground-muted">
217228
No messages waiting in this queue.
@@ -231,6 +242,7 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
231242
canPromoteToSteer: workflow?.canPromoteToSteer ?? false,
232243
canSendNow: workflow?.canSendNow ?? false,
233244
canReorder: workflow?.canReorder ?? false,
245+
editBlocked: editBlockedReason !== null,
234246
index,
235247
isEditing: editing?.runId === run.id,
236248
isGuestMessage: context?.guest !== undefined,
@@ -372,7 +384,7 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
372384
accessibilityHint={
373385
controls.canEdit
374386
? "Opens this message in the composer for editing"
375-
: undefined
387+
: (editBlockedReason ?? undefined)
376388
}
377389
disabled={!controls.canEdit}
378390
onPress={() => void act(run.id, "edit")}

‎apps/mobile/src/features/threads/threadQueueControlPresentation.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export function resolveThreadQueueRowControls(input: {
1919
readonly canPromoteToSteer: boolean;
2020
readonly canSendNow: boolean;
2121
readonly canReorder: boolean;
22+
/** Something else holds the composer, such as an open question. */
23+
readonly editBlocked?: boolean;
2224
readonly index: number;
2325
readonly isEditing?: boolean;
2426
/** A guest's message keeps the guest's words; the owner can cancel it, not rewrite it. */
@@ -33,7 +35,8 @@ export function resolveThreadQueueRowControls(input: {
3335
canDismiss: !input.busy,
3436
// Re-opening the row already in the composer would reload it and throw
3537
// away whatever has been typed since.
36-
canEdit: mutationEnabled && !isEditing && input.isGuestMessage !== true,
38+
canEdit:
39+
mutationEnabled && !isEditing && input.isGuestMessage !== true && input.editBlocked !== true,
3740
canMoveDown: mutationEnabled && input.canReorder && input.index < input.queuedCount - 1,
3841
canMoveUp: mutationEnabled && input.canReorder && input.index > 0,
3942
canSend: mutationEnabled && (input.canPromoteToSteer || input.canSendNow) && !isEditing,

‎apps/server/src/provider/ClaudeModelCatalog.ts‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,21 @@ function tryResolveClaudeModelCatalog(
5959
};
6060
}
6161

62-
const BUNDLED_CLAUDE_PROVIDER_CATALOG =
63-
resolveProviderCatalog(BUNDLED_MODEL_MANIFEST, CLAUDE) ?? undefined;
64-
62+
/** Resolve the fallback on each read so its new-model badges can expire. */
6563
export function resolveClaudeModelCatalog(
6664
catalog: ModelCatalog.ProviderCatalog | undefined,
6765
): ClaudeModelCatalog {
6866
return (
6967
tryResolveClaudeModelCatalog(catalog) ??
70-
tryResolveClaudeModelCatalog(BUNDLED_CLAUDE_PROVIDER_CATALOG) ?? {
68+
tryResolveClaudeModelCatalog(
69+
resolveProviderCatalog(BUNDLED_MODEL_MANIFEST, CLAUDE) ?? undefined,
70+
) ?? {
7171
models: [],
7272
}
7373
);
7474
}
7575

76-
export const BUNDLED_CLAUDE_MODEL_CATALOG = resolveClaudeModelCatalog(
77-
BUNDLED_CLAUDE_PROVIDER_CATALOG,
78-
);
76+
export const BUNDLED_CLAUDE_MODEL_CATALOG = resolveClaudeModelCatalog(undefined);
7977

8078
export function scopeClaudeModelCatalog(
8179
catalog: ClaudeModelCatalog,

‎apps/server/src/provider/ModelManifest.test.ts‎

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { assert, describe, it } from "@effect/vitest";
22
import * as NodeServices from "@effect/platform-node/NodeServices";
33
import { ProviderDriverKind } from "@t3tools/contracts";
4+
import * as ModelCatalog from "@t3tools/provider-core/server/ModelCatalog";
45
import * as Effect from "effect/Effect";
56
import * as FileSystem from "effect/FileSystem";
67
import * as Layer from "effect/Layer";
@@ -13,6 +14,87 @@ import * as ServerSettings from "../serverSettings.ts";
1314
import * as ModelManifest from "./ModelManifest.ts";
1415

1516
describe("resolveProviderCatalog", () => {
17+
it.each([
18+
{ releasedAt: "2026-01-01", now: "2026-01-01T00:00:00Z", badge: "new" },
19+
{ releasedAt: "2026-01-01", now: "2026-01-07T23:59:59.999Z", badge: "new" },
20+
{ releasedAt: "2026-01-01", now: "2026-01-08T00:00:00Z", badge: undefined },
21+
{ releasedAt: "2026-01-01", now: "2026-02-01T00:00:00Z", badge: undefined },
22+
{ releasedAt: "2026-01-02T00:00:00Z", now: "2026-01-01T00:00:00Z", badge: undefined },
23+
{ releasedAt: undefined, now: "2026-01-01T00:00:00Z", badge: undefined },
24+
{ releasedAt: "invalid", now: "2026-01-01T00:00:00Z", badge: undefined },
25+
])("derives the new badge from releasedAt=$releasedAt at $now", ({ releasedAt, now, badge }) => {
26+
const manifest: ModelManifest.ModelManifestData = {
27+
version: 1,
28+
currentModels: {},
29+
providers: {
30+
synthetic: {
31+
profiles: {},
32+
models: [
33+
{
34+
slug: "model-next",
35+
name: "Model Next",
36+
status: "current",
37+
...(releasedAt === undefined ? {} : { releasedAt }),
38+
},
39+
{
40+
slug: "model-legacy",
41+
name: "Model Legacy",
42+
status: "legacy",
43+
releasedAt: now,
44+
},
45+
],
46+
},
47+
},
48+
};
49+
const catalog = ModelManifest.resolveProviderCatalog(
50+
manifest,
51+
ProviderDriverKind.make("synthetic"),
52+
Date.parse(now),
53+
);
54+
assert.strictEqual(catalog?.models[0]?.badge, badge);
55+
assert.strictEqual(catalog?.models[1]?.badge, undefined);
56+
});
57+
58+
it.effect("expires badges when rereading a cached manifest without a refresh", () => {
59+
const manifest: ModelManifest.ModelManifestData = {
60+
version: 1,
61+
currentModels: {},
62+
providers: {
63+
synthetic: {
64+
profiles: {},
65+
models: [
66+
{
67+
slug: "model-next",
68+
name: "Model Next",
69+
status: "current",
70+
releasedAt: "1970-01-01T00:00:00Z",
71+
},
72+
],
73+
},
74+
},
75+
};
76+
return Effect.gen(function* () {
77+
const service = yield* ModelCatalog.ModelCatalog;
78+
const readCatalog = service.current(ProviderDriverKind.make("synthetic"));
79+
assert.strictEqual((yield* readCatalog)?.models[0]?.badge, "new");
80+
yield* TestClock.adjust("7 days");
81+
assert.strictEqual((yield* readCatalog)?.models[0]?.badge, undefined);
82+
}).pipe(
83+
Effect.provide(
84+
ModelManifest.layerModelCatalog.pipe(
85+
Layer.provide(
86+
Layer.succeed(ModelManifest.ModelManifest, {
87+
current: Effect.succeed(manifest),
88+
refresh: Effect.die("Catalog reads must not refresh the manifest"),
89+
forceRefresh: Effect.die("Catalog reads must not refresh the manifest"),
90+
refreshInBackground: Effect.die("Catalog reads must not refresh the manifest"),
91+
}),
92+
),
93+
),
94+
),
95+
);
96+
});
97+
1698
it("rejects invalid catalog references", () => {
1799
const invalidCatalog = (input: {
18100
readonly models: NonNullable<ModelManifest.ModelManifestData["providers"]>[string]["models"];

‎apps/server/src/provider/ModelManifest.ts‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
} from "@t3tools/contracts";
66
import * as Clock from "effect/Clock";
77
import * as Context from "effect/Context";
8+
import * as DateTime from "effect/DateTime";
89
import * as Effect from "effect/Effect";
910
import * as FileSystem from "effect/FileSystem";
1011
import * as Layer from "effect/Layer";
@@ -30,6 +31,7 @@ const MANIFEST_TTL_MS = 60 * 60 * 1000;
3031
const MANIFEST_RETRY_MS = 5 * 60 * 1000;
3132

3233
const FETCH_TIMEOUT_MS = 10_000;
34+
const MODEL_NEW_BADGE_DURATION_MS = 7 * 24 * 60 * 60 * 1000;
3335

3436
const ManifestModelStatus = Schema.Literals(["current", "legacy"]);
3537

@@ -45,7 +47,8 @@ const ManifestProviderModel = Schema.Struct({
4547
subProvider: Schema.optional(TrimmedNonEmptyString),
4648
aliases: Schema.optional(Schema.Array(TrimmedNonEmptyString)),
4749
status: ManifestModelStatus,
48-
badge: Schema.optional(Schema.Literal("new")),
50+
/** ISO date or timestamp of the model's public release, as published by its provider. */
51+
releasedAt: Schema.optional(Schema.String),
4952
profile: Schema.optional(TrimmedNonEmptyString),
5053
adapter: Schema.optional(Schema.Unknown),
5154
});
@@ -110,6 +113,7 @@ function manifestUpdatedAtMs(manifest: ModelManifestData): number {
110113
export function resolveProviderCatalog(
111114
manifest: ModelManifestData,
112115
driverKind: ProviderDriverKind,
116+
nowMs = DateTime.toEpochMillis(DateTime.nowUnsafe()),
113117
): ModelCatalog.ProviderCatalog | null {
114118
const catalog = manifest.providers?.[driverKind];
115119
if (!catalog) return null;
@@ -123,13 +127,19 @@ export function resolveProviderCatalog(
123127
const profile = entry.profile ? catalog.profiles[entry.profile] : undefined;
124128
if (entry.profile && !profile) return null;
125129

130+
const releasedAtMs = entry.releasedAt === undefined ? NaN : Date.parse(entry.releasedAt);
131+
const showNewBadge =
132+
entry.status === "current" &&
133+
nowMs >= releasedAtMs &&
134+
nowMs - releasedAtMs < MODEL_NEW_BADGE_DURATION_MS;
135+
126136
models.push({
127137
slug: entry.slug,
128138
name: entry.name,
129139
...(entry.shortName ? { shortName: entry.shortName } : {}),
130140
...(entry.subProvider ? { subProvider: entry.subProvider } : {}),
131141
...(entry.aliases ? { aliases: entry.aliases } : {}),
132-
...(entry.badge ? { badge: entry.badge } : {}),
142+
...(showNewBadge ? { badge: "new" as const } : {}),
133143
status: entry.status,
134144
capabilities: profile?.capabilities ?? null,
135145
adapter: entry.adapter,
@@ -267,10 +277,10 @@ export const layerModelCatalog = Layer.effect(
267277
Effect.gen(function* () {
268278
const manifest = yield* ModelManifest;
269279
return ModelCatalog.ModelCatalog.of({
270-
current: Effect.fn("ModelCatalog.current")(function (driverKind) {
271-
return manifest.current.pipe(
272-
Effect.map((data) => resolveProviderCatalog(data, driverKind) ?? undefined),
273-
);
280+
current: Effect.fn("ModelCatalog.current")(function* (driverKind: ProviderDriverKind) {
281+
const data = yield* manifest.current;
282+
const nowMs = yield* Clock.currentTimeMillis;
283+
return resolveProviderCatalog(data, driverKind, nowMs) ?? undefined;
274284
}),
275285
bundled: (driverKind) =>
276286
resolveProviderCatalog(BUNDLED_MODEL_MANIFEST, driverKind) ?? undefined,

‎apps/server/src/provider/model-manifest.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"version": 1,
3-
"updatedAt": "2026-10-21T06:20:00Z",
3+
"updatedAt": "2026-10-26T20:00:36Z",
44
"compatibility": [
55
{
66
"driver": "codex",
@@ -773,7 +773,7 @@
773773
"name": "Claude Haiku 5.5",
774774
"aliases": ["haiku", "haiku-5.5", "claude-haiku-5.5"],
775775
"status": "current",
776-
"badge": "new",
776+
"releasedAt": "2026-10-07",
777777
"profile": "haiku-5-5",
778778
"adapter": { "claudeCode": { "minVersion": "2.1.293" } }
779779
},

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients";
2+
import { queuedRunEditBlockedReason } from "@t3tools/client-runtime/queued-run-edit";
23
import { ScrollToEndButton, WorkspaceFileDropOverlay } from "./chat/TimelineOverlays";
34
import { usePasteToFocusComposer } from "./chat/usePasteToFocusComposer";
45
import { announcedRun, isDetailBehindShell } from "./chat/threadActivityAnnouncement";
@@ -2924,6 +2925,9 @@ export default function ChatView(props: ChatViewProps) {
29242925
threadId={activeThread.id}
29252926
optimisticMessages={optimisticUserMessages}
29262927
editingRunId={queuedRunEdit.editingRunId}
2928+
editBlockedReason={queuedRunEditBlockedReason({
2929+
openQuestionCount: pendingUserInputs.length,
2930+
})}
29272931
onEditQueuedRun={queuedRunEdit.beginEdit}
29282932
onCancelEdit={queuedRunEdit.cancelEdit}
29292933
/>

‎apps/web/src/components/chat/QueuedRunsControl.browser.test.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const baseProps = {
4343
optimisticMessages: [],
4444
threadId: "thread:test" as never,
4545
editingRunId: null,
46+
editBlockedReason: null,
4647
onEditQueuedRun: () => undefined,
4748
onCancelEdit: () => undefined,
4849
} satisfies ComponentProps<typeof QueuedRunsControl>;

0 commit comments

Comments
 (0)