Skip to content

Commit b7fd440

Browse files
chore: continue upstream sync through 122d3bf (#177)
Resume the saved six-commit upstream integration, preserving upstream ancestry and fork behavior. Complete fork UI localization and reconcile the existing browser/mobile fixtures. Validated on ea5c3ad by Fork CI 44999633523 (17 successful jobs and one unaffected native skip) and Agent Context Budget 44999633520.
2 parents a04700e + ea5c3ad commit b7fd440

221 files changed

Lines changed: 18869 additions & 3941 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.pnpmfile.cjs‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
const fs = require("node:fs");
22
const path = require("node:path");
33

4-
// Our forks ship as tarballs in apps/mobile/deps. A pnpm patch on one is a second source of
5-
// truth that the next tarball silently drops, so changes go to the fork (apps/mobile/deps/README.md).
4+
// Our forks ship as tarballs in apps/mobile/deps and apps/web/deps. A pnpm patch on one is a
5+
// second source of truth that the next tarball silently drops, so changes go to the fork (see
6+
// the README beside each tarball).
7+
const FORK_APPS = ["apps/mobile", "apps/web"];
8+
69
function forkTarballPatches(patchedDependencies) {
7-
const manifestPath = path.join(__dirname, "apps/mobile/package.json");
8-
// Release staging installs a partial workspace without the mobile app.
9-
if (!patchedDependencies || !fs.existsSync(manifestPath)) return [];
10-
const { dependencies = {} } = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
11-
const forks = Object.keys(dependencies).filter((name) =>
12-
String(dependencies[name]).startsWith("file:deps/"),
13-
);
10+
if (!patchedDependencies) return [];
11+
const forks = FORK_APPS.flatMap((app) => {
12+
const manifestPath = path.join(__dirname, app, "package.json");
13+
// Release staging installs a partial workspace without every app.
14+
if (!fs.existsSync(manifestPath)) return [];
15+
const { dependencies = {} } = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
16+
return Object.keys(dependencies).filter((name) =>
17+
String(dependencies[name]).startsWith("file:deps/"),
18+
);
19+
});
1420
return Object.keys(patchedDependencies).filter((key) =>
1521
forks.some((name) => key === name || key.startsWith(`${name}@`)),
1622
);
@@ -23,7 +29,7 @@ module.exports = {
2329
if (forkPatches.length > 0) {
2430
throw new Error(
2531
`pnpm-workspace.yaml patches ${forkPatches.join(", ")}, which ships as a fork tarball in ` +
26-
"apps/mobile/deps. Change the fork and replace the tarball instead (apps/mobile/deps/README.md).",
32+
"an app's deps directory. Change the fork and replace the tarball instead (deps/README.md).",
2733
);
2834
}
2935
// Windows installs need Linux x64 glibc binaries because WSL shares node_modules.

‎apps/mobile/src/components/ComposerContextSheet.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { T, useGT, Var } from "gt-react-native";
1+
import { T, useGT, useMessages, Var } from "gt-react-native";
22

33
import { Button } from "./ui/Button";
44
import * as Dialog from "./ui/Dialog";
@@ -102,6 +102,7 @@ function DeliveredProjectKnowledge(props: {
102102
readonly sent: { readonly threadId: ThreadId; readonly messageId: MessageId };
103103
}) {
104104
const gt = useGT();
105+
const m = useMessages();
105106
const config = useAtomValue(
106107
serverEnvironment.configValueAtom(props.record.knowledge.environmentId),
107108
);
@@ -141,15 +142,15 @@ function DeliveredProjectKnowledge(props: {
141142
<Text className="text-sm text-foreground-muted">
142143
<T>The copy T3 delivered with this message. It does not show whether the agent used it.</T>
143144
</Text>
144-
{deliveredKnowledgeNotes(snapshot).map((note) => (
145+
{deliveredKnowledgeNotes(snapshot, m).map((note) => (
145146
<Text key={note} className="text-sm text-foreground-muted">
146147
{note}
147148
</Text>
148149
))}
149150
{snapshot.omission ? (
150151
<Text className="text-sm text-foreground">
151152
{gt("Not sent: {reason}", {
152-
reason: KNOWLEDGE_DELIVERY_OMISSION_LABEL[snapshot.omission.reason],
153+
reason: m(KNOWLEDGE_DELIVERY_OMISSION_LABEL[snapshot.omission.reason]),
153154
})}
154155
</Text>
155156
) : snapshot.item.contentRemoved ? null : (

‎apps/mobile/src/components/ProjectKnowledgeDraftFooter.tsx‎

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useState } from "react";
22
import { ScrollView, View } from "react-native";
33
import { useSafeAreaInsets } from "react-native-safe-area-context";
44
import type { KnowledgeSelection } from "@t3tools/contracts";
5+
import { T, useGT } from "gt-react-native";
56

67
import {
78
MAX_KNOWLEDGE_SELECTIONS,
@@ -13,9 +14,6 @@ import { Button } from "./ui/Button";
1314

1415
type SelectionState = ReturnType<typeof knowledgeSelectionState>;
1516

16-
const changedLabel = (selection: KnowledgeSelection) =>
17-
selection.kind === "fact" ? "Fact changed since you selected it" : "Source changed";
18-
1917
/**
2018
* Draft selection, kept apart from inspection: pressing a fact or message reads it, and only this
2119
* control changes what the draft will reference.
@@ -26,21 +24,24 @@ export function SelectForDraftControl(props: {
2624
readonly onToggle: (selection: KnowledgeSelection) => void;
2725
readonly onRefresh: (selection: KnowledgeSelection) => void;
2826
}) {
27+
const gt = useGT();
2928
return (
3029
<View className="flex-row flex-wrap items-center gap-2">
3130
<Button
32-
label={props.state === "unselected" ? "Select for draft" : "Selected for draft"}
31+
label={props.state === "unselected" ? gt("Select for draft") : gt("Selected for draft")}
3332
icon={props.state === "unselected" ? "plus" : "checkmark.circle.fill"}
3433
tone={props.state === "unselected" ? "secondary" : "primary"}
3534
onPress={() => props.onToggle(props.current)}
3635
/>
3736
{props.state === "changed" ? (
3837
<>
3938
<AppText className="text-xs text-warning-foreground">
40-
{changedLabel(props.current)}
39+
{props.current.kind === "fact"
40+
? gt("Fact changed since you selected it")
41+
: gt("Source changed")}
4142
</AppText>
4243
<Button
43-
label="Use current version"
44+
label={gt("Use current version")}
4445
tone="text"
4546
onPress={() => props.onRefresh(props.current)}
4647
/>
@@ -69,6 +70,7 @@ export function ProjectKnowledgeDraftFooter(props: {
6970
readonly onAttach: () => void;
7071
readonly onRemoveAttached: () => void;
7172
}) {
73+
const gt = useGT();
7274
const insets = useSafeAreaInsets();
7375
const [expanded, setExpanded] = useState(false);
7476
const changed = props.selections.filter(
@@ -84,35 +86,43 @@ export function ProjectKnowledgeDraftFooter(props: {
8486
{props.mismatched ? (
8587
<View className="gap-1">
8688
<AppText className="text-sm">
87-
Attached evidence belongs to another project or environment.
89+
<T>Attached evidence belongs to another project or environment.</T>
8890
</AppText>
8991
<Button
90-
label="Remove mismatched reference"
92+
label={gt("Remove mismatched reference")}
9193
tone="secondary"
9294
onPress={props.onRemoveAttached}
9395
/>
9496
</View>
9597
) : props.attachedLabel ? (
9698
<View className="flex-row flex-wrap items-center gap-2">
9799
<AppText className="flex-1 text-sm">
98-
{props.attachedLabel} is attached to this draft.
100+
{gt("{label} is attached to this draft.", { label: props.attachedLabel })}
99101
</AppText>
100-
<Button label="Remove from draft" tone="text" onPress={props.onRemoveAttached} />
102+
<Button label={gt("Remove from draft")} tone="text" onPress={props.onRemoveAttached} />
101103
</View>
102104
) : props.detached ? (
103105
<AppText accessibilityRole="alert" className="text-sm">
104-
The selection changed, so the earlier reference was removed from the draft. Attach to add
105-
the new selection.
106+
<T>
107+
The selection changed, so the earlier reference was removed from the draft. Attach to
108+
add the new selection.
109+
</T>
106110
</AppText>
107111
) : null}
108112
<View className="flex-row flex-wrap items-center gap-2">
109113
<AppText className="flex-1 text-xs text-foreground-muted">
110-
{props.selections.length} selected · up to {MAX_KNOWLEDGE_SELECTIONS}
111-
{changed > 0 ? ` · ${changed} changed since selected` : ""}
114+
{gt(
115+
"{count} selected · up to {maximum}{changed, plural, =0 {} other { · {changed} changed since selected}}",
116+
{
117+
count: props.selections.length,
118+
maximum: MAX_KNOWLEDGE_SELECTIONS,
119+
changed,
120+
},
121+
)}
112122
</AppText>
113123
{props.selections.length > 0 ? (
114124
<Button
115-
label={expanded ? "Hide selection" : "Review selection"}
125+
label={expanded ? gt("Hide selection") : gt("Review selection")}
116126
tone="text"
117127
onPress={() => setExpanded((value) => !value)}
118128
/>
@@ -136,21 +146,28 @@ export function ProjectKnowledgeDraftFooter(props: {
136146
{item.current &&
137147
knowledgeSelectionState([item.selection], item.current) === "changed" ? (
138148
<Button
139-
label="Use current version"
149+
label={gt("Use current version")}
140150
tone="text"
141151
onPress={() => props.onRefresh(item.current!)}
142152
/>
143153
) : null}
144-
<Button label="Remove" tone="text" onPress={() => props.onToggle(item.selection)} />
154+
<Button
155+
label={gt("Remove", { $context: "remove a project knowledge selection" })}
156+
tone="text"
157+
onPress={() => props.onToggle(item.selection)}
158+
/>
145159
</View>
146160
))}
147161
<AppText className="text-xs text-foreground-muted">
148-
The draft keeps references and revision numbers. Current evidence is reloaded when sent.
162+
<T>
163+
The draft keeps references and revision numbers. Current evidence is reloaded when
164+
sent.
165+
</T>
149166
</AppText>
150167
</ScrollView>
151168
) : null}
152169
<Button
153-
label="Attach to draft"
170+
label={gt("Attach to draft")}
154171
tone="primary"
155172
disabled={props.disabled || props.busy || props.selections.length === 0 || props.mismatched}
156173
loading={props.busy}

‎apps/mobile/src/components/ProjectKnowledgeEntry.tsx‎

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { uuidv4 } from "../lib/uuid";
22
import { useCallback, useEffect, useRef, useState } from "react";
3+
import { T, useGT, useMessages } from "gt-react-native";
34
import { useIsFocused } from "@react-navigation/native";
45
import { ScrollView, View } from "react-native";
56
import { useAtomValue } from "@effect/atom-react";
@@ -150,6 +151,8 @@ function ProjectKnowledgeSheet(
150151
readonly onClose: () => void;
151152
},
152153
) {
154+
const gt = useGT();
155+
const m = useMessages();
153156
const scope = { environmentId: props.environmentId, projectId: props.projectId };
154157
const draft = useComposerDraft(props.draftKey);
155158
const attached = draft.context?.records.find(
@@ -258,9 +261,9 @@ function ProjectKnowledgeSheet(
258261
if (busy) return;
259262
if (!editorDirty.current) return leave();
260263
Dialog.confirm({
261-
title: "Discard fact changes?",
262-
message: "Your unsaved fact changes will be lost.",
263-
confirmText: "Discard",
264+
title: gt("Discard fact changes?"),
265+
message: gt("Your unsaved fact changes will be lost."),
266+
confirmText: gt("Discard", { $context: "discard unsaved project fact changes" }),
264267
destructive: true,
265268
onConfirm: leave,
266269
});
@@ -361,7 +364,9 @@ function ProjectKnowledgeSheet(
361364
result.value.context.projectId !== scope.projectId
362365
) {
363366
setError(
364-
"The prepared evidence belongs to a different environment or project. Refresh and try again.",
367+
gt(
368+
"The prepared evidence belongs to a different environment or project. Refresh and try again.",
369+
),
365370
);
366371
return;
367372
}
@@ -374,7 +379,7 @@ function ProjectKnowledgeSheet(
374379
);
375380
}
376381
if (!insertComposerDraftContext(props.draftKey, reference)) {
377-
setError("Remove a context item before attaching project memory.");
382+
setError(gt("Remove a context item before attaching project memory."));
378383
return;
379384
}
380385
props.onClose();
@@ -412,23 +417,26 @@ function ProjectKnowledgeSheet(
412417
label:
413418
known?.label ??
414419
(selection.kind === "fact"
415-
? `Fact ${selection.factId.slice(0, 8)} · revision ${selection.revision}`
416-
: `Message ${selection.messageId.slice(0, 8)}`),
420+
? gt("Fact {factId} · revision {revision}", {
421+
factId: selection.factId.slice(0, 8),
422+
revision: selection.revision,
423+
})
424+
: gt("Message {messageId}", { messageId: selection.messageId.slice(0, 8) })),
417425
};
418426
});
419427
const selectionState = (current: KnowledgeSelection) =>
420428
knowledgeSelectionState(selections, current);
421429

422430
const title =
423431
page.kind === "list"
424-
? "Project memory"
432+
? gt("Project memory")
425433
: page.kind === "fact"
426-
? "Fact"
434+
? gt("Fact", { $context: "project fact" })
427435
: page.kind === "source"
428-
? "Source message"
436+
? gt("Source message")
429437
: page.kind === "remember"
430-
? "New fact"
431-
: factEditorTitle(page.mode);
438+
? gt("New fact")
439+
: factEditorTitle(page.mode, m);
432440

433441
return (
434442
<Sheet
@@ -448,7 +456,12 @@ function ProjectKnowledgeSheet(
448456
>
449457
{stack.length > 1 ? (
450458
<View className="flex-row">
451-
<Button label="Back" icon="chevron.left" tone="text" onPress={pop} />
459+
<Button
460+
label={gt("Back", { $context: "project memory navigation" })}
461+
icon="chevron.left"
462+
tone="text"
463+
onPress={pop}
464+
/>
452465
</View>
453466
) : null}
454467
{error ? (
@@ -508,10 +521,11 @@ function ProjectKnowledgeSheet(
508521
}}
509522
onForget={() =>
510523
Dialog.confirm({
511-
title: "Forget this fact permanently?",
512-
message:
524+
title: gt("Forget this fact permanently?"),
525+
message: gt(
513526
"Its content, history and every copy sent to agents are removed and cannot be restored. If the fact changed rather than became wrong, supersede it instead.",
514-
confirmText: "Forget",
527+
),
528+
confirmText: gt("Forget", { $context: "permanently forget a project fact" }),
515529
destructive: true,
516530
onConfirm: () =>
517531
void apply({ action: "forget", ...factMutation(inspectedFact) }),
@@ -528,7 +542,9 @@ function ProjectKnowledgeSheet(
528542
{detail.error}
529543
</AppText>
530544
) : (
531-
<AppText>Reading fact…</AppText>
545+
<AppText>
546+
<T>Reading fact…</T>
547+
</AppText>
532548
)
533549
) : null}
534550
{page.kind === "source" ? (
@@ -563,7 +579,9 @@ function ProjectKnowledgeSheet(
563579
{sourceQuery.error}
564580
</AppText>
565581
) : (
566-
<AppText>Reading message…</AppText>
582+
<AppText>
583+
<T>Reading message…</T>
584+
</AppText>
567585
)
568586
) : null}
569587
{page.kind === "editor" ? (
@@ -613,6 +631,7 @@ function RememberEditor(props: {
613631
readonly onCancel: () => void;
614632
readonly onDirtyChange: (dirty: boolean) => void;
615633
}) {
634+
const gt = useGT();
616635
const mode: FactEditorMode =
617636
props.source.state === "available"
618637
? {
@@ -624,7 +643,9 @@ function RememberEditor(props: {
624643
kind: "create",
625644
content: "",
626645
sources: [{ kind: "user" }],
627-
note: "That message can no longer be read, so the fact will be saved as your own assertion.",
646+
note: gt(
647+
"That message can no longer be read, so the fact will be saved as your own assertion.",
648+
),
628649
};
629650
return (
630651
<ProjectKnowledgeFactEditor

0 commit comments

Comments
 (0)