GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge pull request #18 from ScriptedAlchemy/codex/merge-upstream-agen… · ScriptedAlchemy/t3code@8c5ef68

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github/workflows
    • mobile-eas-production.yml
  • apps
    • desktop/scripts
      • verify-preload-bundle.mjs
      • verify-preload-bundle.test.mjs
    • mobile
      • app.config.ts
      • eas.json
      • index.ts
      • package.json
      • scripts
        • sourcemap-upload.mts
        • sourcemap-upload.test.ts
        • upload-sourcemaps.mts
      • src
        • components
          • RenderErrorBoundary.tsx
        • features
          • connection
            • LinkedEnvironmentsSection.tsx
          • conversation-summaries
            • ConversationSummariesRouteScreen.test.tsx
          • diagnostics
            • SettingsDiagnosticsRouteScreen.tsx
          • loom
            • ProjectLoomRouteScreen.test.tsx
          • observability
            • observe.ts
          • pull-requests
            • PullRequestRouteScreen.tsx
          • settings
            • SettingsServerControlsRouteScreen.test.tsx
            • ThreadSettingsSections.tsx
            • settings-search.ts
          • threads
            • ThreadComposer.tsx
            • ThreadDetailScreen.tsx
        • lib
          • composerChipPresentation.test.ts
          • filePreview.test.ts
        • persistence
          • mobile-preferences.ts
        • state
          • peerLinks.ts
    • server/src
      • auth
        • McpOAuth.test.ts
        • McpOAuth.ts
      • cli
        • environment.ts
      • mcp
        • McpHttpServer.test.ts
        • McpHttpServer.ts
        • McpInvocationContext.ts
        • McpToolAccess.ts
        • OrchestratorMcpService.test.ts
        • OrchestratorMcpService.ts
        • linkOrigin.test.ts
        • toolkits
          • environment
            • tools.ts
          • orchestrator
            • tools.test.ts
            • tools.ts
          • project
            • handlers.test.ts
            • handlers.ts
            • tools.ts
          • pullRequests
            • tools.ts
          • thread
            • tools.ts
      • orchestration-v2
        • Adapters
          • AcpAdapterV2.test.ts
          • ClaudeAdapterV2.test.ts
          • ClaudeAdapterV2.ts
          • CodexAdapterV2.test.ts
          • CodexAdapterV2.ts
        • Orchestrator.ts
        • ProviderTurnControlService.ts
        • ProviderTurnStartService.ts
        • RemoteDelegatedTask.test.ts
        • SteeringCompletion.integration.test.ts
        • ThreadLaunchService.ts
        • ThreadManagementService.test.ts
        • ThreadManagementService.ts
        • testkit
          • ProviderSwitch.integration.test.ts
      • peer
        • PeerForwarding.test.ts
        • PeerForwarding.ts
        • PeerLinkRequests.test.ts
        • PeerLinkRequests.ts
        • PeerLinks.test.ts
        • PeerLinks.testkit.ts
        • PeerLinks.ts
        • PeerMcpClient.ts
        • RemoteDelegation.test.ts
        • RemoteDelegation.ts
      • project
        • ProjectSetupScriptRunner.test.ts
      • provider
        • AgentContextBudget.test.ts
        • agentContextBudget.json
      • server.ts
      • settingsSecrets.ts
    • web/src
      • components
        • CommandPaletteProjectSearch.browser.test.tsx
        • ComposerPromptEditorTiptap.tsx
        • ContextChip.browser.test.tsx
        • ContextChip.tsx
        • Sidebar.tsx
        • ThreadContextChip.tsx
        • ThreadNotificationCoordinator.tsx
        • chat
          • AssistantCitationChip.tsx
          • LinkRequestCard.tsx
          • MarkdownFileLink.tsx
          • ThreadActivityBanners.tsx
          • TimelineUserMessageRow.tsx
          • UserMessageContextChips.tsx
          • V2LifecycleRow.tsx
          • useComposerMenuItems.ts
          • useOpenRelatedThread.browser.test.tsx
          • useOpenRelatedThread.ts
          • useThreadLifecycle.tsx
        • contextChipParts.tsx
        • files
          • AudioPreview.tsx
        • settings
          • LabsSettingsPanel.tsx
          • TelemetryExportSettings.browser.test.tsx
          • settingsSearch.ts
      • lib
        • contextChipAccents.ts
      • pierre-icons.ts
      • state
        • peerLinks.ts
      • themePalette.browser.test.ts
      • themePalette.test.ts
      • themePalette.ts
  • docs
    • internals
      • remote.md
    • operations
      • relay-observability.md
    • user
      • portable-handoffs.md
      • remote-access.md
      • telemetry.md
  • evals/mcp-tool-use
    • run.ts
  • infra/relay
    • alchemy.run.ts
    • src
      • mobileTelemetry
        • MobileTelemetry.test.ts
        • MobileTelemetry.ts
        • monitoring.ts
        • otlpLogs.ts
        • sourceMap.test.ts
        • sourceMap.ts
      • monitoring.ts
      • observability.ts
      • worker.ts
  • packages
    • client-runtime/src
      • linkRequest.test.ts
      • linkRequest.ts
      • promptLinks.test.ts
      • promptLinks.ts
      • state
        • peerPairingCode.ts
        • threadShell.test.ts
        • threadShell.ts
    • contracts/src
      • orchestrationV2.ts
      • orchestratorMcp.ts
      • peerLink.ts
      • relay.ts
      • settings.ts
    • provider-acp/src/server
      • adapter.ts
    • provider-core/src/server
      • ProviderAdapter.ts
      • failure.test.ts
      • failure.ts
    • provider-fx/src/server
      • skills.test.ts
    • pstack
      • t3-code.md
    • shared
      • package.json
      • src
        • composerContextReferences.ts
        • mobileSourceMaps.ts
  • pnpm-lock.yaml
  • scripts
    • build-npm-launcher.test.ts
  • vite.config.ts

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/mobile-eas-production.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/mobile-eas-production.yml
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ jobs:
275275
--environment production \
276276
--platform ${{ inputs.platform }} \
277277
--message "$OTA_MESSAGE" \
278+
--emit-metadata \
278279
--non-interactive
279280
280281
# Reconcile each version separately because the major is in the fingerprint.
@@ -313,8 +314,11 @@ jobs:
313314
--environment production \
314315
--platform "$platform" \
315316
--message "$message" \
317+
--emit-metadata \
316318
--non-interactive; then
317319
echo ":white_check_mark: $platform/$profile: OTA published to production (fingerprint \`$hash\`)" >> "$GITHUB_STEP_SUMMARY"
320+
# The next target's export replaces dist; keep this one for the map upload.
321+
rm -rf "dist-$platform-$profile" && mv dist "dist-$platform-$profile"
318322
else
319323
failed=1
320324
echo ":x: $platform/$profile: OTA publish failed (fingerprint \`$hash\`)" >> "$GITHUB_STEP_SUMMARY"
@@ -354,3 +358,18 @@ jobs:
354358
fi
355359
done
356360
exit "$failed"
361+
362+
# Lets the relay symbolicate crash stacks from the updates published
363+
# above. A step of its own so the R2 credentials reach only this script,
364+
# not `eas update` and the dependencies it runs. Never fails the job.
365+
- name: Upload OTA source maps
366+
if: ${{ !cancelled() && steps.expo-token.outputs.present == 'true' }}
367+
working-directory: apps/mobile
368+
env:
369+
MOBILE_SOURCEMAPS_R2: ${{ secrets.MOBILE_SOURCEMAPS_R2 }}
370+
run: |
371+
for dir in dist dist-*; do
372+
if [ -f "$dir/eas-update-metadata.json" ]; then
373+
node scripts/upload-sourcemaps.mts ota "$dir"
374+
fi
375+
done
Collapse file

‎apps/desktop/scripts/verify-preload-bundle.mjs‎

Copy file name to clipboardExpand all lines: apps/desktop/scripts/verify-preload-bundle.mjs
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ const executeBundle = (source, sandboxModules) => {
108108
{
109109
process: sandboxProcess,
110110
require: requireSandboxModule,
111+
window: new EventTarget(),
111112
},
112113
{
113114
filename: "desktop-preload.cjs",
Collapse file

‎apps/desktop/scripts/verify-preload-bundle.test.mjs‎

Copy file name to clipboardExpand all lines: apps/desktop/scripts/verify-preload-bundle.test.mjs
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ const validPreload = `
1515
`;
1616

1717
describe("desktop preload bundle verifier", () => {
18+
it("accepts preloads that register window lifecycle listeners", () => {
19+
assert.doesNotThrow(() =>
20+
verifyPreloadBundle(`
21+
${validPreload}
22+
window.addEventListener("DOMContentLoaded", () => {}, { once: true });
23+
window.addEventListener("resize", () => {});
24+
`),
25+
);
26+
});
27+
1828
it("rejects required API names that only appear in strings", () => {
1929
assert.throws(
2030
() =>
Collapse file

‎apps/mobile/app.config.ts‎

Copy file name to clipboardExpand all lines: apps/mobile/app.config.ts
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ const runtimeVersionPolicy =
1717
const personalTeamBundleIdentifier = repoEnv.T3CODE_IOS_PERSONAL_TEAM_BUNDLE_ID?.trim();
1818
const IOS_BUNDLE_IDENTIFIER_PATTERN = /^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/;
1919

20+
// Compiled into the native project. Without a relay, Observe's native side could dispatch to
21+
// Expo's own ingest before observe.ts turns it off; `.invalid` never resolves (RFC 6761).
22+
const observeEndpointUrl = repoEnv.T3CODE_RELAY_URL?.trim()
23+
? new URL("/v1/mobile/observe", repoEnv.T3CODE_RELAY_URL.trim()).toString()
24+
: "https://observe.invalid";
25+
2026
const fromRepoRoot = (relativePath: string) => `../../${relativePath}`;
2127
const androidAdaptiveForeground = "./assets/android-icon-foreground.png";
2228

@@ -450,6 +456,7 @@ const config: ExpoConfig = {
450456
},
451457
eas: {
452458
projectId: "d763fcb8-d37c-41ea-a773-b54a0ab4a454",
459+
observe: { endpointUrl: observeEndpointUrl },
453460
},
454461
},
455462
owner: "pingdotgg",
Collapse file

‎apps/mobile/eas.json‎

Copy file name to clipboardExpand all lines: apps/mobile/eas.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@
6666
"corepack": true,
6767
"env": {
6868
"APP_VARIANT": "production",
69-
"NODE_OPTIONS": "--max-old-space-size=4096"
69+
"NODE_OPTIONS": "--max-old-space-size=4096",
70+
"SOURCEMAP_FILE": "/tmp/t3code-ios-main.jsbundle.map"
7071
},
7172
"channel": "production",
7273
"environment": "production",
Collapse file

‎apps/mobile/index.ts‎

Copy file name to clipboardExpand all lines: apps/mobile/index.ts
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Must stay first: the render counter wraps the DevTools hook before any React commit.
22
import "./src/features/development/render-counter-entry";
3+
// Next, so errors thrown while the rest of the app loads are recorded too.
4+
import "./src/features/observability/observe";
35
import { registerRootComponent } from "expo";
46
import "react-native-gesture-handler";
57
import { LogBox } from "react-native";
Collapse file

‎apps/mobile/package.json‎

Copy file name to clipboardExpand all lines: apps/mobile/package.json
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"measure-renders": "node scripts/measure-renders.mts",
4747
"generate": "node --disable-warning=MODULE_TYPELESS_PACKAGE_JSON scripts/generate-uniwind-themes.mts",
4848
"generate:highlights": "node scripts/generate-highlights.mts",
49+
"eas-build-on-success": "node scripts/upload-sourcemaps.mts build",
4950
"test": "vp test run --project unit --project react",
5051
"typecheck": "tsc --noEmit"
5152
},
@@ -103,6 +104,7 @@
103104
"expo-linking": "~58.0.13",
104105
"expo-network": "~58.0.3",
105106
"expo-notifications": "~58.1.5",
107+
"expo-observe": "~58.0.15",
106108
"expo-paste-input": "^0.1.15",
107109
"expo-quick-actions": "^6.0.2",
108110
"expo-secure-store": "~58.0.2",
@@ -145,6 +147,7 @@
145147
"@types/mdast": "^4.0.4",
146148
"@types/react": "catalog:",
147149
"@types/react-dom": "catalog:",
150+
"aws4fetch": "1.0.20",
148151
"babel-preset-expo": "~58.0.17",
149152
"jsdom": "^30.0.1",
150153
"tailwindcss": "^4.0.0",
Collapse file

‎apps/mobile/scripts/sourcemap-upload.mts‎

Copy file name to clipboard
+165Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
import * as NodeFS from "node:fs";
2+
import * as NodePath from "node:path";
3+
import { mobileSourceMapKey, type MobilePlatform } from "@t3tools/shared/mobileSourceMaps";
4+
import { AwsClient } from "aws4fetch";
5+
6+
export interface SourceMapUpload {
7+
readonly key: string;
8+
readonly path: string;
9+
}
10+
11+
/** The `MOBILE_SOURCEMAPS_R2` secret: the relay stack's `mobileSourceMapsUploadCredentials`. */
12+
interface UploadCredentials {
13+
readonly endpoint: string;
14+
readonly bucketName: string;
15+
readonly accessKeyId: string;
16+
readonly secretAccessKey: string;
17+
}
18+
19+
const isPlatform = (value: unknown): value is MobilePlatform =>
20+
value === "ios" || value === "android";
21+
22+
const readJson = (path: string): unknown => JSON.parse(NodeFS.readFileSync(path, "utf8"));
23+
24+
const isRecord = (value: unknown): value is Record<string, unknown> =>
25+
typeof value === "object" && value !== null && !Array.isArray(value);
26+
27+
export function parseCredentials(value: string | undefined): UploadCredentials | undefined {
28+
if (!value?.trim()) return undefined;
29+
let parsed: unknown;
30+
try {
31+
parsed = JSON.parse(value);
32+
} catch {
33+
// JSON.parse's message quotes the input, which here is the secret.
34+
throw new Error("MOBILE_SOURCEMAPS_R2 is not valid JSON.");
35+
}
36+
if (!isRecord(parsed)) throw new Error("MOBILE_SOURCEMAPS_R2 is not a JSON object.");
37+
const { endpoint, bucketName, accessKeyId, secretAccessKey } = parsed;
38+
if (
39+
typeof endpoint !== "string" ||
40+
typeof bucketName !== "string" ||
41+
typeof accessKeyId !== "string" ||
42+
typeof secretAccessKey !== "string"
43+
) {
44+
throw new Error(
45+
"MOBILE_SOURCEMAPS_R2 needs endpoint, bucketName, accessKeyId and secretAccessKey.",
46+
);
47+
}
48+
return { endpoint, bucketName, accessKeyId, secretAccessKey };
49+
}
50+
51+
/** One map per update `eas update --emit-metadata` published, next to the bundle `metadata.json` names. */
52+
export function otaSourceMapUploads(distDir: string): ReadonlyArray<SourceMapUpload> {
53+
const metadata = readJson(NodePath.join(distDir, "metadata.json"));
54+
const easMetadata = readJson(NodePath.join(distDir, "eas-update-metadata.json"));
55+
const fileMetadata = isRecord(metadata) ? metadata.fileMetadata : undefined;
56+
const updates = isRecord(easMetadata) ? easMetadata.updates : undefined;
57+
if (!isRecord(fileMetadata) || !Array.isArray(updates)) {
58+
throw new Error(`${distDir} is missing Expo export or EAS update metadata.`);
59+
}
60+
return updates.flatMap((update): Array<SourceMapUpload> => {
61+
if (!isRecord(update) || !isPlatform(update.platform) || typeof update.id !== "string") {
62+
return [];
63+
}
64+
const platformFiles = fileMetadata[update.platform];
65+
const bundle = isRecord(platformFiles) ? platformFiles.bundle : undefined;
66+
if (typeof bundle !== "string") return [];
67+
return [
68+
{
69+
key: mobileSourceMapKey(update.platform, "ota", update.id),
70+
path: NodePath.join(distDir, `${bundle}.map`),
71+
},
72+
];
73+
});
74+
}
75+
76+
/** Android's Gradle plugin writes the map under the release variant; iOS to `SOURCEMAP_FILE` (eas.json). */
77+
export function buildSourceMapUpload(
78+
env: Readonly<Record<string, string | undefined>>,
79+
projectDir: string,
80+
): SourceMapUpload {
81+
const platform = env.EAS_BUILD_PLATFORM;
82+
const buildId = env.EAS_BUILD_ID;
83+
if (!isPlatform(platform) || !buildId) {
84+
throw new Error("EAS_BUILD_PLATFORM and EAS_BUILD_ID are only set on EAS Build.");
85+
}
86+
if (platform === "ios") {
87+
if (!env.SOURCEMAP_FILE) throw new Error("SOURCEMAP_FILE is not set for this iOS build.");
88+
return { key: mobileSourceMapKey("ios", "build", buildId), path: env.SOURCEMAP_FILE };
89+
}
90+
const variantsDir = NodePath.join(projectDir, "android/app/build/generated/sourcemaps/react");
91+
const variant = NodeFS.existsSync(variantsDir)
92+
? NodeFS.readdirSync(variantsDir).find((name) => /release$/iu.test(name))
93+
: undefined;
94+
if (!variant) throw new Error(`No release source map under ${variantsDir}.`);
95+
return {
96+
key: mobileSourceMapKey("android", "build", buildId),
97+
path: NodePath.join(variantsDir, variant, "index.android.bundle.map"),
98+
};
99+
}
100+
101+
/**
102+
* EAS writes the app's debug symbols next to the `.ipa`, so native frames in iOS crash
103+
* reports can be read with `atos`. Undefined when the build left none.
104+
*/
105+
export function buildDsymUpload(
106+
env: Readonly<Record<string, string | undefined>>,
107+
projectDir: string,
108+
): SourceMapUpload | undefined {
109+
if (env.EAS_BUILD_PLATFORM !== "ios" || !env.EAS_BUILD_ID) return undefined;
110+
const buildDir = NodePath.join(projectDir, "ios/build");
111+
const dsym = NodeFS.existsSync(buildDir)
112+
? NodeFS.readdirSync(buildDir).find((name) => name.endsWith(".app.dSYM.zip"))
113+
: undefined;
114+
if (!dsym) return undefined;
115+
return { key: `ios/dsym/${env.EAS_BUILD_ID}.zip`, path: NodePath.join(buildDir, dsym) };
116+
}
117+
118+
/** Only what the relay reads: source text stays out of the bucket, and the rest is dead weight. */
119+
function stripToMappings(text: string): string {
120+
const map: unknown = JSON.parse(text);
121+
if (!isRecord(map)) throw new Error("Source map is not a JSON object.");
122+
const { version, sources, sourceRoot, mappings } = map;
123+
return JSON.stringify({ version, sources, sourceRoot, mappings });
124+
}
125+
126+
export function uploadSourceMap(
127+
credentials: UploadCredentials,
128+
upload: SourceMapUpload,
129+
): Promise<number> {
130+
return putObject(
131+
credentials,
132+
upload.key,
133+
stripToMappings(NodeFS.readFileSync(upload.path, "utf8")),
134+
"application/json",
135+
);
136+
}
137+
138+
export function uploadDsym(credentials: UploadCredentials, upload: SourceMapUpload) {
139+
const body = new Uint8Array(NodeFS.readFileSync(upload.path));
140+
return putObject(credentials, upload.key, body, "application/zip");
141+
}
142+
143+
async function putObject(
144+
credentials: UploadCredentials,
145+
key: string,
146+
body: string | Uint8Array<ArrayBuffer>,
147+
contentType: string,
148+
): Promise<number> {
149+
const client = new AwsClient({
150+
accessKeyId: credentials.accessKeyId,
151+
secretAccessKey: credentials.secretAccessKey,
152+
service: "s3",
153+
region: "auto",
154+
});
155+
const url = `${credentials.endpoint.replace(/\/$/u, "")}/${credentials.bucketName}/${key}`;
156+
const response = await client.fetch(url, {
157+
method: "PUT",
158+
body,
159+
headers: { "content-type": contentType },
160+
});
161+
if (!response.ok) {
162+
throw new Error(`R2 answered ${response.status}: ${(await response.text()).slice(0, 500)}`);
163+
}
164+
return body.length;
165+
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.