Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb6fa9c8ea | ||
|
|
d1e85c4e8f | ||
|
|
ea20e80021 | ||
|
|
9e632f5cec | ||
|
|
4120e94598 | ||
|
|
34bb18c8cf | ||
|
|
90eea047a9 | ||
|
|
f92e1e1b06 | ||
|
|
556c42452c | ||
|
|
7e20b23e7e | ||
|
|
b83e9c95e4 | ||
|
|
a41f4895ce | ||
|
|
d15909af15 | ||
|
|
447236d51f | ||
|
|
5165b8c333 | ||
|
|
8fc317939f | ||
|
|
16c69ba7ff | ||
|
|
e64c19f1af | ||
|
|
6ab8f93a23 | ||
|
|
b793401aee | ||
|
|
3c32bc8fd1 | ||
|
|
6efdf67e15 | ||
|
|
39371c6012 | ||
|
|
99efaa0faa | ||
|
|
6b9feb1bd3 | ||
|
|
e0f3abd1a4 | ||
|
|
34ec8a86fb | ||
|
|
932df4ed17 | ||
|
|
63859aa072 | ||
|
|
7bfacd55d8 | ||
|
|
271d65e047 | ||
|
|
aa8b9f2286 | ||
|
|
073eb389d3 | ||
|
|
825263b6f9 | ||
|
|
25b02f4ba2 |
No files matched your search
@@ -124,6 +124,9 @@ jobs:
|
|||||||
group: pr-size-${{ github.event.pull_request.number }}
|
group: pr-size-${{ github.event.pull_request.number }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
steps:
|
steps:
|
||||||
|
# This pull_request_target job may fetch untrusted PR commits only as passive
|
||||||
|
# git data. Do not add dependency installs, build/test scripts, or cache
|
||||||
|
# actions here; use pull_request plus workflow_run for that pattern instead.
|
||||||
- name: Checkout base repository
|
- name: Checkout base repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
id-token: write
|
id-token: none
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check_changes:
|
check_changes:
|
||||||
@@ -244,6 +244,68 @@ jobs:
|
|||||||
exit $code
|
exit $code
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- name: Prepare Azure Trusted Signing
|
||||||
|
if: matrix.platform == 'win'
|
||||||
|
shell: pwsh
|
||||||
|
env:
|
||||||
|
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
|
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
|
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
|
||||||
|
AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
|
||||||
|
AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
|
||||||
|
AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}
|
||||||
|
AZURE_TRUSTED_SIGNING_PUBLISHER_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_PUBLISHER_NAME }}
|
||||||
|
run: |
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
|
$requiredSecrets = @(
|
||||||
|
$env:AZURE_TENANT_ID,
|
||||||
|
$env:AZURE_CLIENT_ID,
|
||||||
|
$env:AZURE_CLIENT_SECRET,
|
||||||
|
$env:AZURE_TRUSTED_SIGNING_ENDPOINT,
|
||||||
|
$env:AZURE_TRUSTED_SIGNING_ACCOUNT_NAME,
|
||||||
|
$env:AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME,
|
||||||
|
$env:AZURE_TRUSTED_SIGNING_PUBLISHER_NAME
|
||||||
|
)
|
||||||
|
if ($requiredSecrets | Where-Object { [string]::IsNullOrWhiteSpace($_) }) {
|
||||||
|
Write-Host "Azure Trusted Signing disabled; skipping TrustedSigning module preparation."
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Install-PackageProvider `
|
||||||
|
-Name NuGet `
|
||||||
|
-MinimumVersion 2.8.5.201 `
|
||||||
|
-Force `
|
||||||
|
-Scope CurrentUser `
|
||||||
|
-ErrorAction Stop
|
||||||
|
} catch {
|
||||||
|
Write-Warning "Could not bootstrap NuGet package provider. Continuing because the runner may already have a usable provider. $($_.Exception.Message)"
|
||||||
|
}
|
||||||
|
|
||||||
|
Install-Module `
|
||||||
|
-Name TrustedSigning `
|
||||||
|
-MinimumVersion 0.5.0 `
|
||||||
|
-Force `
|
||||||
|
-AllowClobber `
|
||||||
|
-Repository PSGallery `
|
||||||
|
-Scope CurrentUser `
|
||||||
|
-ErrorAction Stop
|
||||||
|
|
||||||
|
Import-Module TrustedSigning -MinimumVersion 0.5.0 -Force
|
||||||
|
Get-Command Invoke-TrustedSigning -ErrorAction Stop
|
||||||
|
|
||||||
|
$moduleRoots = @(
|
||||||
|
[System.IO.Path]::Combine([Environment]::GetFolderPath("MyDocuments"), "PowerShell", "Modules"),
|
||||||
|
[System.IO.Path]::Combine([Environment]::GetFolderPath("MyDocuments"), "WindowsPowerShell", "Modules"),
|
||||||
|
[System.IO.Path]::Combine($env:ProgramFiles, "PowerShell", "Modules"),
|
||||||
|
[System.IO.Path]::Combine($env:ProgramFiles, "WindowsPowerShell", "Modules")
|
||||||
|
)
|
||||||
|
$modulePathEntries = @($moduleRoots + ($env:PSModulePath -split ";")) |
|
||||||
|
Where-Object { $_ -and (Test-Path $_) } |
|
||||||
|
Select-Object -Unique
|
||||||
|
"PSModulePath=$($modulePathEntries -join ';')" >> $env:GITHUB_ENV
|
||||||
|
|
||||||
- name: Build desktop artifact
|
- name: Build desktop artifact
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
@@ -358,6 +420,9 @@ jobs:
|
|||||||
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.build.result == 'success' }}
|
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.build.result == 'success' }}
|
||||||
runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
|
runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -511,6 +576,98 @@ jobs:
|
|||||||
fail_on_unmatched_files: true
|
fail_on_unmatched_files: true
|
||||||
token: ${{ steps.app_token.outputs.token }}
|
token: ${{ steps.app_token.outputs.token }}
|
||||||
|
|
||||||
|
deploy_web:
|
||||||
|
name: Deploy hosted web app
|
||||||
|
needs: [preflight, release]
|
||||||
|
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' }}
|
||||||
|
runs-on: blacksmith-8vcpu-ubuntu-2404
|
||||||
|
timeout-minutes: 10
|
||||||
|
env:
|
||||||
|
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
|
||||||
|
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||||
|
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||||
|
T3CODE_WEB_ROUTER_URL: ${{ vars.T3CODE_WEB_ROUTER_URL }}
|
||||||
|
T3CODE_WEB_LATEST_DOMAIN: ${{ vars.T3CODE_WEB_LATEST_DOMAIN }}
|
||||||
|
T3CODE_WEB_NIGHTLY_DOMAIN: ${{ vars.T3CODE_WEB_NIGHTLY_DOMAIN }}
|
||||||
|
VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
ref: ${{ needs.preflight.outputs.ref }}
|
||||||
|
|
||||||
|
- name: Setup Bun
|
||||||
|
uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version-file: package.json
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version-file: package.json
|
||||||
|
|
||||||
|
- name: Install release tooling dependencies
|
||||||
|
run: bun install --frozen-lockfile --filter=@t3tools/scripts --filter=@t3tools/web
|
||||||
|
|
||||||
|
- name: Align package versions to release version
|
||||||
|
run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
|
||||||
|
|
||||||
|
- name: Refresh release lockfile
|
||||||
|
run: bun install --lockfile-only --ignore-scripts
|
||||||
|
|
||||||
|
- name: Deploy and alias channel
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [[ -z "${VERCEL_TOKEN:-}" || -z "${VERCEL_ORG_ID:-}" || -z "${VERCEL_PROJECT_ID:-}" ]]; then
|
||||||
|
echo "Missing one or more required Vercel secrets: VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
router_url="${T3CODE_WEB_ROUTER_URL:-https://app.t3.codes}"
|
||||||
|
latest_domain="${T3CODE_WEB_LATEST_DOMAIN:-latest.app.t3.codes}"
|
||||||
|
nightly_domain="${T3CODE_WEB_NIGHTLY_DOMAIN:-nightly.app.t3.codes}"
|
||||||
|
router_domain="${router_url#http://}"
|
||||||
|
router_domain="${router_domain#https://}"
|
||||||
|
router_domain="${router_domain%%/*}"
|
||||||
|
|
||||||
|
if [[ "${{ needs.preflight.outputs.release_channel }}" == "stable" ]]; then
|
||||||
|
channel_domain="$latest_domain"
|
||||||
|
channel_name="latest"
|
||||||
|
else
|
||||||
|
channel_domain="$nightly_domain"
|
||||||
|
channel_name="nightly"
|
||||||
|
fi
|
||||||
|
|
||||||
|
vercel_scope="${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
|
||||||
|
vercel_scope_args=(--scope "$vercel_scope")
|
||||||
|
|
||||||
|
echo "Deploying hosted web app for $channel_name channel."
|
||||||
|
deployment_url="$(
|
||||||
|
bunx [email protected] deploy \
|
||||||
|
--prod \
|
||||||
|
--skip-domain \
|
||||||
|
--yes \
|
||||||
|
--token "$VERCEL_TOKEN" \
|
||||||
|
"${vercel_scope_args[@]}" \
|
||||||
|
--build-env "APP_VERSION=${{ needs.preflight.outputs.version }}" \
|
||||||
|
--build-env "VITE_HOSTED_APP_URL=$router_url" \
|
||||||
|
--build-env "VITE_HOSTED_APP_CHANNEL=$channel_name"
|
||||||
|
)"
|
||||||
|
|
||||||
|
echo "Aliasing $deployment_url to $channel_domain."
|
||||||
|
bunx [email protected] alias set "$deployment_url" "$channel_domain" \
|
||||||
|
--token "$VERCEL_TOKEN" \
|
||||||
|
"${vercel_scope_args[@]}"
|
||||||
|
|
||||||
|
if [[ "$channel_name" == "latest" && -n "$router_domain" && "$router_domain" != "$channel_domain" ]]; then
|
||||||
|
echo "Aliasing $deployment_url to router domain $router_domain."
|
||||||
|
bunx [email protected] alias set "$deployment_url" "$router_domain" \
|
||||||
|
--token "$VERCEL_TOKEN" \
|
||||||
|
"${vercel_scope_args[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
finalize:
|
finalize:
|
||||||
name: Finalize release
|
name: Finalize release
|
||||||
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'stable' }}
|
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'stable' }}
|
||||||
@@ -595,8 +752,9 @@ jobs:
|
|||||||
always() && !cancelled() &&
|
always() && !cancelled() &&
|
||||||
needs.preflight.result == 'success' &&
|
needs.preflight.result == 'success' &&
|
||||||
needs.release.result == 'success' &&
|
needs.release.result == 'success' &&
|
||||||
|
needs.deploy_web.result == 'success' &&
|
||||||
(needs.finalize.result == 'success' || needs.finalize.result == 'skipped')
|
(needs.finalize.result == 'success' || needs.finalize.result == 'skipped')
|
||||||
needs: [preflight, release, finalize]
|
needs: [preflight, release, deploy_web, finalize]
|
||||||
runs-on: blacksmith-8vcpu-ubuntu-2404
|
runs-on: blacksmith-8vcpu-ubuntu-2404
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -23,5 +23,6 @@ __screenshots__/
|
|||||||
.tanstack
|
.tanstack
|
||||||
squashfs-root/
|
squashfs-root/
|
||||||
.vercel
|
.vercel
|
||||||
|
.gstack/
|
||||||
dist-electron/
|
dist-electron/
|
||||||
.electron-runtime/
|
.electron-runtime/
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
"**/routeTree.gen.ts"
|
"**/routeTree.gen.ts"
|
||||||
],
|
],
|
||||||
"plugins": ["eslint", "oxc", "react", "unicorn", "typescript"],
|
"plugins": ["eslint", "oxc", "react", "unicorn", "typescript"],
|
||||||
|
"jsPlugins": ["./oxlint-plugin-t3code/index.ts"],
|
||||||
"categories": {
|
"categories": {
|
||||||
"correctness": "warn",
|
"correctness": "warn",
|
||||||
"suspicious": "warn",
|
"suspicious": "warn",
|
||||||
@@ -17,6 +18,8 @@
|
|||||||
"rules": {
|
"rules": {
|
||||||
"react-in-jsx-scope": "off",
|
"react-in-jsx-scope": "off",
|
||||||
"eslint/no-shadow": "off",
|
"eslint/no-shadow": "off",
|
||||||
"eslint/no-await-in-loop": "off"
|
"eslint/no-await-in-loop": "off",
|
||||||
|
"eslint/no-underscore-dangle": "off",
|
||||||
|
"t3code/no-inline-schema-compile": "warn"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,6 +115,43 @@ After setup, the renderer connects to a local forwarded HTTP/WebSocket endpoint.
|
|||||||
|
|
||||||
SSH launch is a desktop feature because it needs local process and SSH access. Once the environment is paired and saved, it uses the same environment list and connection model as direct LAN, Tailscale, HTTPS, or future tunnel-backed environments.
|
SSH launch is a desktop feature because it needs local process and SSH access. Once the environment is paired and saved, it uses the same environment list and connection model as direct LAN, Tailscale, HTTPS, or future tunnel-backed environments.
|
||||||
|
|
||||||
|
#### SSH Launch Troubleshooting
|
||||||
|
|
||||||
|
The desktop SSH launcher connects with a non-interactive `sh` session, writes a small launcher script under `~/.t3/ssh-launch/<host-key>/`, starts or reuses a remote T3 server, and forwards the remote loopback port back to your desktop.
|
||||||
|
|
||||||
|
The remote host must have a compatible Node.js runtime. T3 Code uses the server package's `engines.node` requirement:
|
||||||
|
|
||||||
|
```text
|
||||||
|
^22.16 || ^23.11 || >=24.10
|
||||||
|
```
|
||||||
|
|
||||||
|
During SSH launch, T3 Code first checks whether `node` is already available on `PATH`. If it is missing, the launcher tries common non-interactive shell locations and version-manager shims/activation hooks:
|
||||||
|
|
||||||
|
- `~/.local/bin`, `~/bin`, `/opt/homebrew/bin`, `/usr/local/bin`, `/usr/bin`, `/bin`
|
||||||
|
- Volta via `~/.volta/bin`
|
||||||
|
- asdf via `~/.asdf/shims`, `~/.asdf/bin`, or `~/.asdf/asdf.sh`
|
||||||
|
- mise via `~/.local/share/mise/shims`, `~/.mise/shims`, or `mise activate sh`
|
||||||
|
- fnm via `fnm env --use-on-cd --shell sh` or `fnm env --shell sh`
|
||||||
|
- nodenv via `~/.nodenv/bin`, `~/.nodenv/shims`, or `nodenv init -`
|
||||||
|
- nvm via `$NVM_DIR/nvm.sh`, then `nvm use default`, `nvm use node`, or `nvm use --lts`
|
||||||
|
- installed nvm versions under `$NVM_DIR/versions/node/*/bin`
|
||||||
|
|
||||||
|
If launch fails with `node: command not found`, a port-scan failure, or a message that the remote Node version does not satisfy the required range, SSH into the host and check the same non-interactive shell path T3 Code uses:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh [email protected] 'sh -lc "command -v node && node --version"'
|
||||||
|
```
|
||||||
|
|
||||||
|
If that does not print a compatible Node version, configure your version manager for non-interactive shells or install a compatible Node binary in one of the searched locations. For example, with nvm you may need a default alias:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nvm alias default 24
|
||||||
|
```
|
||||||
|
|
||||||
|
With mise/asdf/fnm/nodenv, make sure the tool's shim directory is installed and points at a Node version satisfying the range above.
|
||||||
|
|
||||||
|
If reconnecting after an app update fails, retry the SSH launch once. The launcher now compares its generated runner script, stops stale launcher-managed remote servers, clears the SSH launch PID/port state, and starts a fresh remote server. You should not normally need to delete `~/.t3/ssh-launch` or kill `t3` processes manually.
|
||||||
|
|
||||||
## How Pairing Works
|
## How Pairing Works
|
||||||
|
|
||||||
The remote device does not need a long-lived secret up front.
|
The remote device does not need a long-lived secret up front.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@t3tools/desktop",
|
"name": "@t3tools/desktop",
|
||||||
"version": "0.0.22",
|
"version": "0.0.24",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist-electron/main.cjs",
|
"main": "dist-electron/main.cjs",
|
||||||
@@ -16,6 +16,10 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@effect/platform-node": "catalog:",
|
"@effect/platform-node": "catalog:",
|
||||||
|
"@t3tools/contracts": "workspace:*",
|
||||||
|
"@t3tools/shared": "workspace:*",
|
||||||
|
"@t3tools/ssh": "workspace:*",
|
||||||
|
"@t3tools/tailscale": "workspace:*",
|
||||||
"effect": "catalog:",
|
"effect": "catalog:",
|
||||||
"electron": "41.5.0",
|
"electron": "41.5.0",
|
||||||
"electron-updater": "^6.6.2"
|
"electron-updater": "^6.6.2"
|
||||||
@@ -23,13 +27,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@effect/language-service": "catalog:",
|
"@effect/language-service": "catalog:",
|
||||||
"@effect/vitest": "catalog:",
|
"@effect/vitest": "catalog:",
|
||||||
"@t3tools/client-runtime": "workspace:*",
|
|
||||||
"@t3tools/contracts": "workspace:*",
|
|
||||||
"@t3tools/shared": "workspace:*",
|
|
||||||
"@t3tools/ssh": "workspace:*",
|
|
||||||
"@t3tools/tailscale": "workspace:*",
|
|
||||||
"@types/node": "catalog:",
|
"@types/node": "catalog:",
|
||||||
"effect-acp": "workspace:*",
|
|
||||||
"tsdown": "catalog:",
|
"tsdown": "catalog:",
|
||||||
"typescript": "catalog:",
|
"typescript": "catalog:",
|
||||||
"vitest": "catalog:"
|
"vitest": "catalog:"
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ const COMMIT_HASH_DISPLAY_LENGTH = 12;
|
|||||||
const AppPackageMetadata = Schema.Struct({
|
const AppPackageMetadata = Schema.Struct({
|
||||||
t3codeCommitHash: Schema.optional(Schema.String),
|
t3codeCommitHash: Schema.optional(Schema.String),
|
||||||
});
|
});
|
||||||
|
const decodeAppPackageMetadata = Schema.decodeEffect(Schema.fromJsonString(AppPackageMetadata));
|
||||||
|
|
||||||
export interface DesktopAppIdentityShape {
|
export interface DesktopAppIdentityShape {
|
||||||
readonly resolveUserDataPath: Effect.Effect<string>;
|
readonly resolveUserDataPath: Effect.Effect<string>;
|
||||||
@@ -47,7 +48,7 @@ const make = Effect.gen(function* () {
|
|||||||
return yield* Option.match(raw, {
|
return yield* Option.match(raw, {
|
||||||
onNone: () => Effect.succeed(Option.none<string>()),
|
onNone: () => Effect.succeed(Option.none<string>()),
|
||||||
onSome: (value) =>
|
onSome: (value) =>
|
||||||
Schema.decodeEffect(Schema.fromJsonString(AppPackageMetadata))(value).pipe(
|
decodeAppPackageMetadata(value).pipe(
|
||||||
Effect.map((parsed) =>
|
Effect.map((parsed) =>
|
||||||
Option.fromNullishOr(parsed.t3codeCommitHash).pipe(Option.flatMap(normalizeCommitHash)),
|
Option.fromNullishOr(parsed.t3codeCommitHash).pipe(Option.flatMap(normalizeCommitHash)),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import * as Schema from "effect/Schema";
|
|||||||
import * as Sink from "effect/Sink";
|
import * as Sink from "effect/Sink";
|
||||||
import * as Scope from "effect/Scope";
|
import * as Scope from "effect/Scope";
|
||||||
import * as Stream from "effect/Stream";
|
import * as Stream from "effect/Stream";
|
||||||
import { TestClock } from "effect/testing";
|
import * as TestClock from "effect/testing/TestClock";
|
||||||
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/unstable/http";
|
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/unstable/http";
|
||||||
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
|
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
|
||||||
|
|
||||||
@@ -25,6 +25,10 @@ import * as DesktopObservability from "../app/DesktopObservability.ts";
|
|||||||
import * as DesktopState from "../app/DesktopState.ts";
|
import * as DesktopState from "../app/DesktopState.ts";
|
||||||
import * as DesktopWindow from "../window/DesktopWindow.ts";
|
import * as DesktopWindow from "../window/DesktopWindow.ts";
|
||||||
|
|
||||||
|
const decodeDesktopBackendBootstrap = Schema.decodeEffect(
|
||||||
|
Schema.fromJsonString(DesktopBackendBootstrap),
|
||||||
|
);
|
||||||
|
|
||||||
const baseConfig: DesktopBackendManager.DesktopBackendStartConfig = {
|
const baseConfig: DesktopBackendManager.DesktopBackendStartConfig = {
|
||||||
executablePath: "/electron",
|
executablePath: "/electron",
|
||||||
entryPath: "/server/bin.mjs",
|
entryPath: "/server/bin.mjs",
|
||||||
@@ -94,7 +98,7 @@ const healthyHttpClientLayer = httpClientLayer((request) =>
|
|||||||
);
|
);
|
||||||
|
|
||||||
function decodeBootstrap(raw: string) {
|
function decodeBootstrap(raw: string) {
|
||||||
return Schema.decodeEffect(Schema.fromJsonString(DesktopBackendBootstrap))(raw);
|
return decodeDesktopBackendBootstrap(raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeManagerLayer(input: {
|
function makeManagerLayer(input: {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import * as NodeOS from "node:os";
|
|||||||
import {
|
import {
|
||||||
createAdvertisedEndpoint,
|
createAdvertisedEndpoint,
|
||||||
type CreateAdvertisedEndpointInput,
|
type CreateAdvertisedEndpointInput,
|
||||||
} from "@t3tools/client-runtime";
|
} from "@t3tools/shared/advertisedEndpoint";
|
||||||
import type {
|
import type {
|
||||||
AdvertisedEndpoint,
|
AdvertisedEndpoint,
|
||||||
AdvertisedEndpointProvider,
|
AdvertisedEndpointProvider,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createAdvertisedEndpoint } from "@t3tools/client-runtime";
|
import { createAdvertisedEndpoint } from "@t3tools/shared/advertisedEndpoint";
|
||||||
import type { AdvertisedEndpoint, AdvertisedEndpointProvider } from "@t3tools/contracts";
|
import type { AdvertisedEndpoint, AdvertisedEndpointProvider } from "@t3tools/contracts";
|
||||||
import {
|
import {
|
||||||
buildTailscaleHttpsBaseUrl,
|
buildTailscaleHttpsBaseUrl,
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import * as Electron from "electron";
|
|||||||
import * as NetService from "@t3tools/shared/Net";
|
import * as NetService from "@t3tools/shared/Net";
|
||||||
import { resolveRemoteT3CliPackageSpec } from "@t3tools/ssh/command";
|
import { resolveRemoteT3CliPackageSpec } from "@t3tools/ssh/command";
|
||||||
import type { RemoteT3RunnerOptions } from "@t3tools/ssh/tunnel";
|
import type { RemoteT3RunnerOptions } from "@t3tools/ssh/tunnel";
|
||||||
|
import serverPackageJson from "../../server/package.json" with { type: "json" };
|
||||||
|
|
||||||
import type { DesktopSettings as DesktopSettingsValue } from "./settings/DesktopAppSettings.ts";
|
import type { DesktopSettings as DesktopSettingsValue } from "./settings/DesktopAppSettings.ts";
|
||||||
import * as DesktopIpc from "./ipc/DesktopIpc.ts";
|
import * as DesktopIpc from "./ipc/DesktopIpc.ts";
|
||||||
@@ -65,7 +66,10 @@ const resolveDesktopSshCliRunner = (
|
|||||||
): RemoteT3RunnerOptions => {
|
): RemoteT3RunnerOptions => {
|
||||||
const devRemoteEntryPath = Option.getOrUndefined(environment.devRemoteT3ServerEntryPath);
|
const devRemoteEntryPath = Option.getOrUndefined(environment.devRemoteT3ServerEntryPath);
|
||||||
if (environment.isDevelopment && devRemoteEntryPath !== undefined) {
|
if (environment.isDevelopment && devRemoteEntryPath !== undefined) {
|
||||||
return { nodeScriptPath: devRemoteEntryPath };
|
return {
|
||||||
|
nodeScriptPath: devRemoteEntryPath,
|
||||||
|
nodeEngineRange: serverPackageJson.engines.node,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
packageSpec: resolveRemoteT3CliPackageSpec({
|
packageSpec: resolveRemoteT3CliPackageSpec({
|
||||||
@@ -73,6 +77,7 @@ const resolveDesktopSshCliRunner = (
|
|||||||
updateChannel: settings.updateChannel,
|
updateChannel: settings.updateChannel,
|
||||||
isDevelopment: environment.isDevelopment,
|
isDevelopment: environment.isDevelopment,
|
||||||
}),
|
}),
|
||||||
|
nodeEngineRange: serverPackageJson.engines.node,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,14 @@ const ClientSettingsDocumentSchema = Schema.Struct({
|
|||||||
|
|
||||||
const ClientSettingsJson = fromLenientJson(ClientSettingsSchema);
|
const ClientSettingsJson = fromLenientJson(ClientSettingsSchema);
|
||||||
const LegacyClientSettingsDocumentJson = fromLenientJson(ClientSettingsDocumentSchema);
|
const LegacyClientSettingsDocumentJson = fromLenientJson(ClientSettingsDocumentSchema);
|
||||||
|
const decodeLegacyClientSettingsDocumentJson = Schema.decodeEffect(
|
||||||
|
LegacyClientSettingsDocumentJson,
|
||||||
|
);
|
||||||
|
const decodeClientSettingsJsonValue = Schema.decodeEffect(ClientSettingsJson);
|
||||||
const decodeClientSettingsJson = (raw: string): Effect.Effect<ClientSettings, Schema.SchemaError> =>
|
const decodeClientSettingsJson = (raw: string): Effect.Effect<ClientSettings, Schema.SchemaError> =>
|
||||||
Schema.decodeEffect(LegacyClientSettingsDocumentJson)(raw).pipe(
|
decodeLegacyClientSettingsDocumentJson(raw).pipe(
|
||||||
Effect.map((document) => document.settings),
|
Effect.map((document) => document.settings),
|
||||||
Effect.catch(() => Schema.decodeEffect(ClientSettingsJson)(raw)),
|
Effect.catch(() => decodeClientSettingsJsonValue(raw)),
|
||||||
);
|
);
|
||||||
const encodeClientSettingsJson = Schema.encodeEffect(ClientSettingsJson);
|
const encodeClientSettingsJson = Schema.encodeEffect(ClientSettingsJson);
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type {
|
|||||||
DesktopSshEnvironmentBootstrap,
|
DesktopSshEnvironmentBootstrap,
|
||||||
DesktopSshEnvironmentTarget,
|
DesktopSshEnvironmentTarget,
|
||||||
} from "@t3tools/contracts";
|
} from "@t3tools/contracts";
|
||||||
import { type NetError, NetService } from "@t3tools/shared/Net";
|
import * as NetService from "@t3tools/shared/Net";
|
||||||
import {
|
import {
|
||||||
SshPasswordPrompt,
|
SshPasswordPrompt,
|
||||||
type SshPasswordPromptShape,
|
type SshPasswordPromptShape,
|
||||||
@@ -35,7 +35,7 @@ export type DesktopSshEnvironmentRuntimeServices =
|
|||||||
| FileSystem.FileSystem
|
| FileSystem.FileSystem
|
||||||
| Path.Path
|
| Path.Path
|
||||||
| HttpClient.HttpClient
|
| HttpClient.HttpClient
|
||||||
| NetService;
|
| NetService.NetService;
|
||||||
|
|
||||||
export type DesktopSshEnvironmentOperationError =
|
export type DesktopSshEnvironmentOperationError =
|
||||||
| SshCommandError
|
| SshCommandError
|
||||||
@@ -44,7 +44,7 @@ export type DesktopSshEnvironmentOperationError =
|
|||||||
| SshPairingError
|
| SshPairingError
|
||||||
| SshReadinessError
|
| SshReadinessError
|
||||||
| SshPasswordPromptError
|
| SshPasswordPromptError
|
||||||
| NetError;
|
| NetService.NetError;
|
||||||
|
|
||||||
export type DesktopSshEnvironmentDiscoverError = SshHostDiscoveryError;
|
export type DesktopSshEnvironmentDiscoverError = SshHostDiscoveryError;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import * as Effect from "effect/Effect";
|
|||||||
import * as Fiber from "effect/Fiber";
|
import * as Fiber from "effect/Fiber";
|
||||||
import * as Layer from "effect/Layer";
|
import * as Layer from "effect/Layer";
|
||||||
import * as Option from "effect/Option";
|
import * as Option from "effect/Option";
|
||||||
import { TestClock } from "effect/testing";
|
import * as TestClock from "effect/testing/TestClock";
|
||||||
import type * as Electron from "electron";
|
import type * as Electron from "electron";
|
||||||
|
|
||||||
import * as ElectronWindow from "../electron/ElectronWindow.ts";
|
import * as ElectronWindow from "../electron/ElectronWindow.ts";
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import * as Effect from "effect/Effect";
|
|||||||
import * as Fiber from "effect/Fiber";
|
import * as Fiber from "effect/Fiber";
|
||||||
import * as Layer from "effect/Layer";
|
import * as Layer from "effect/Layer";
|
||||||
import * as Option from "effect/Option";
|
import * as Option from "effect/Option";
|
||||||
import { TestClock } from "effect/testing";
|
import * as TestClock from "effect/testing/TestClock";
|
||||||
|
|
||||||
import * as DesktopBackendManager from "../backend/DesktopBackendManager.ts";
|
import * as DesktopBackendManager from "../backend/DesktopBackendManager.ts";
|
||||||
import * as DesktopConfig from "../app/DesktopConfig.ts";
|
import * as DesktopConfig from "../app/DesktopConfig.ts";
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ const UpdateInfo = Schema.Struct({
|
|||||||
const DownloadProgressInfo = Schema.Struct({
|
const DownloadProgressInfo = Schema.Struct({
|
||||||
percent: Schema.Number,
|
percent: Schema.Number,
|
||||||
});
|
});
|
||||||
|
const decodeAppUpdateYmlConfig = Schema.decodeUnknownEffect(AppUpdateYmlConfig);
|
||||||
|
const decodeUpdateInfo = Schema.decodeUnknownEffect(UpdateInfo);
|
||||||
|
const decodeDownloadProgressInfo = Schema.decodeUnknownEffect(DownloadProgressInfo);
|
||||||
|
|
||||||
const currentIsoTimestamp = DateTime.now.pipe(Effect.map(DateTime.formatIso));
|
const currentIsoTimestamp = DateTime.now.pipe(Effect.map(DateTime.formatIso));
|
||||||
|
|
||||||
@@ -115,7 +118,7 @@ function parseAppUpdateYml(raw: string): Effect.Effect<Option.Option<AppUpdateYm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Schema.decodeUnknownEffect(AppUpdateYmlConfig)(entries).pipe(
|
return decodeAppUpdateYmlConfig(entries).pipe(
|
||||||
Effect.map((config) => (config.provider ? Option.some(config) : Option.none())),
|
Effect.map((config) => (config.provider ? Option.some(config) : Option.none())),
|
||||||
Effect.catch(() => Effect.succeed(Option.none<AppUpdateYmlConfig>())),
|
Effect.catch(() => Effect.succeed(Option.none<AppUpdateYmlConfig>())),
|
||||||
);
|
);
|
||||||
@@ -408,7 +411,7 @@ const make = Effect.gen(function* () {
|
|||||||
const handleUpdateAvailable = Effect.fn("desktop.updates.handleUpdateAvailable")(function* (
|
const handleUpdateAvailable = Effect.fn("desktop.updates.handleUpdateAvailable")(function* (
|
||||||
raw: unknown,
|
raw: unknown,
|
||||||
) {
|
) {
|
||||||
yield* Schema.decodeUnknownEffect(UpdateInfo)(raw).pipe(
|
yield* decodeUpdateInfo(raw).pipe(
|
||||||
Effect.flatMap(
|
Effect.flatMap(
|
||||||
Effect.fn("desktop.updates.applyUpdateAvailable")(function* (info) {
|
Effect.fn("desktop.updates.applyUpdateAvailable")(function* (info) {
|
||||||
const state = yield* Ref.get(updateStateRef);
|
const state = yield* Ref.get(updateStateRef);
|
||||||
@@ -479,7 +482,7 @@ const make = Effect.gen(function* () {
|
|||||||
const handleDownloadProgress = Effect.fn("desktop.updates.handleDownloadProgress")(function* (
|
const handleDownloadProgress = Effect.fn("desktop.updates.handleDownloadProgress")(function* (
|
||||||
raw: unknown,
|
raw: unknown,
|
||||||
) {
|
) {
|
||||||
yield* Schema.decodeUnknownEffect(DownloadProgressInfo)(raw).pipe(
|
yield* decodeDownloadProgressInfo(raw).pipe(
|
||||||
Effect.flatMap(
|
Effect.flatMap(
|
||||||
Effect.fn("desktop.updates.applyDownloadProgress")(function* (progress) {
|
Effect.fn("desktop.updates.applyDownloadProgress")(function* (progress) {
|
||||||
const state = yield* Ref.get(updateStateRef);
|
const state = yield* Ref.get(updateStateRef);
|
||||||
@@ -506,7 +509,7 @@ const make = Effect.gen(function* () {
|
|||||||
const handleUpdateDownloaded = Effect.fn("desktop.updates.handleUpdateDownloaded")(function* (
|
const handleUpdateDownloaded = Effect.fn("desktop.updates.handleUpdateDownloaded")(function* (
|
||||||
raw: unknown,
|
raw: unknown,
|
||||||
) {
|
) {
|
||||||
yield* Schema.decodeUnknownEffect(UpdateInfo)(raw).pipe(
|
yield* decodeUpdateInfo(raw).pipe(
|
||||||
Effect.flatMap(
|
Effect.flatMap(
|
||||||
Effect.fn("desktop.updates.applyUpdateDownloaded")(function* (info) {
|
Effect.fn("desktop.updates.applyUpdateDownloaded")(function* (info) {
|
||||||
const state = yield* Ref.get(updateStateRef);
|
const state = yield* Ref.get(updateStateRef);
|
||||||
|
|||||||
@@ -3,19 +3,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"composite": true,
|
"composite": true,
|
||||||
"types": ["node", "electron"],
|
"types": ["node", "electron"],
|
||||||
"lib": ["ESNext", "DOM", "esnext.disposable"],
|
"lib": ["ESNext", "DOM", "esnext.disposable"]
|
||||||
"plugins": [
|
|
||||||
{
|
|
||||||
"name": "@effect/language-service",
|
|
||||||
"namespaceImportPackages": ["@effect/platform-node", "effect"],
|
|
||||||
"diagnosticSeverity": {
|
|
||||||
"importFromBarrel": "error",
|
|
||||||
"anyUnknownInErrorContext": "error",
|
|
||||||
"instanceOfSchema": "warning",
|
|
||||||
"deterministicKeys": "warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"include": ["src", "tsdown.config.ts"]
|
"include": ["src", "tsdown.config.ts"]
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ export default defineConfig([
|
|||||||
...shared,
|
...shared,
|
||||||
entry: ["src/main.ts"],
|
entry: ["src/main.ts"],
|
||||||
clean: true,
|
clean: true,
|
||||||
noExternal: (id) => id.startsWith("@t3tools/") || id.startsWith("effect-acp"),
|
noExternal: (id) => id.startsWith("@t3tools/"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
...shared,
|
...shared,
|
||||||
|
|||||||
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 244 B |
|
After Width: | Height: | Size: 358 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="257" preserveAspectRatio="xMidYMid" viewBox="0 0 256 257"><path fill="#D97757" d="m50.228 170.321 50.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0 125.796l.583-3.759 5.12-3.434 7.324.648 16.202 1.101 24.304 1.685 17.629 1.037 26.118 2.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758 7-7.713 9.397.649 2.398.648 9.527 7.323 20.35 15.75L94.817 91.9l3.889 3.24 1.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0 82.05 1.426l4.472 3.888 6.61 15.101 10.694 23.786 16.591 32.34 4.861 9.592 2.592 8.879.973 2.722h1.685v-1.556l1.36-18.211 2.528-22.36 2.463-28.776.843-8.1 4.018-9.722 7.971-5.25 6.222 2.981 5.12 7.324-.713 4.73-3.046 19.768-5.962 30.98-3.889 20.739h2.268l2.593-2.593 10.499-13.934 17.628-22.036 7.778-8.749 9.073-9.657 5.833-4.601h11.018l8.1 12.055-3.628 12.443-11.342 14.388-9.398 12.184-13.48 18.147-8.426 14.518.778 1.166 2.01-.194 30.46-6.481 16.462-2.982 19.637-3.37 8.88 4.148.971 4.213-3.5 8.62-20.998 5.184-24.628 4.926-36.682 8.685-.454.324.519.648 16.526 1.555 7.065.389h17.304l32.21 2.398 8.426 5.574 5.055 6.805-.843 5.184-12.962 6.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666 11.406 21.387 19.314 26.767 24.887 1.36 6.157-3.434 4.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73 6.935 25.017 37.59 1.296 11.536-1.814 3.76-6.481 2.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194 77.448-3.37 3.953-7.778 2.981-6.48-4.925-3.436-7.972 3.435-15.749 4.148-20.544 3.37-16.333 3.046-20.285 1.815-6.74-.13-.454-1.49.194-15.295 20.999-23.267 31.433-18.406 19.702-4.407 1.75-7.648-3.954.713-7.064 4.277-6.286 25.47-32.405 15.36-20.092 9.917-11.6-.065-1.686h-.583L44.07 198.125l-12.055 1.555-5.185-4.86.648-7.972 2.463-2.593 20.35-13.999-.064.065Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 2.0 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><svg id="cursor_light__Ebene_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 466.73 532.09"><defs></defs><path class="cursor_light__st0" d="M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 649 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="260" preserveAspectRatio="xMidYMid" viewBox="0 0 256 260"><path fill="#fff" d="M239.184 106.203a64.716 64.716 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.716 64.716 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.665 64.665 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.767 64.767 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483Zm-97.56 136.338a48.397 48.397 0 0 1-31.105-11.255l1.535-.87 51.67-29.825a8.595 8.595 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601Zm-104.466-44.61a48.345 48.345 0 0 1-5.781-32.589l1.534.921 51.722 29.826a8.339 8.339 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803ZM23.549 85.38a48.499 48.499 0 0 1 25.58-21.333v61.39a8.288 8.288 0 0 0 4.195 7.316l62.874 36.272-21.845 12.636a.819.819 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466 41.695-63.08-36.63L161.73 77.86a.819.819 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.544 8.544 0 0 0-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.716.716 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391v.205ZM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87-51.67 29.825a8.595 8.595 0 0 0-4.246 7.367l-.051 72.697Zm11.868-25.58 28.138-16.217 28.188 16.218v32.434l-28.086 16.218-28.188-16.218-.052-32.434Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512"><svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="512" height="512" fill="#131010"></rect><path d="M320 224V352H192V224H320Z" fill="#5A5858"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M384 416H128V96H384V416ZM320 160H192V352H320V160Z" fill="white"></path></svg></svg>
|
||||||
|
After Width: | Height: | Size: 464 B |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 138 B |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 7.4 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 652 KiB |
|
After Width: | Height: | Size: 123 KiB |
|
After Width: | Height: | Size: 110 KiB |
@@ -0,0 +1,53 @@
|
|||||||
|
---
|
||||||
|
interface Props {
|
||||||
|
class?: string;
|
||||||
|
idPrefix: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { class: className, idPrefix } = Astro.props;
|
||||||
|
---
|
||||||
|
|
||||||
|
<svg
|
||||||
|
class={className}
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 256 295"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<defs>
|
||||||
|
<linearGradient id={`${idPrefix}0`} x1="48.548%" x2="51.047%" y1="115.276%" y2="41.364%">
|
||||||
|
<stop offset="0%" stop-color="#FFEED7" />
|
||||||
|
<stop offset="100%" stop-color="#BDBFC2" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id={`${idPrefix}6`} x1="49.984%" x2="49.984%" y1="89.845%" y2="40.632%">
|
||||||
|
<stop offset="0%" stop-color="#FFEED7" />
|
||||||
|
<stop offset="100%" stop-color="#BDBFC2" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id={`${idPrefix}8`} x1="49.841%" x2="50.241%" y1="13.229%" y2="94.673%">
|
||||||
|
<stop offset="0%" stop-color="#FFF" stop-opacity=".8" />
|
||||||
|
<stop offset="100%" stop-color="#FFF" stop-opacity="0" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id={`${idPrefix}c`} x1="53.467%" x2="38.949%" y1="48.921%" y2="98.1%">
|
||||||
|
<stop offset="0%" stop-color="#FFA63F" />
|
||||||
|
<stop offset="100%" stop-color="#FF0" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id={`${idPrefix}e`} x1="30.581%" x2="65.887%" y1="34.024%" y2="89.175%">
|
||||||
|
<stop offset="0%" stop-color="#FFA63F" />
|
||||||
|
<stop offset="100%" stop-color="#FF0" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id={`${idPrefix}i`} x1="49.733%" x2="50.558%" y1="17.609%" y2="99.385%">
|
||||||
|
<stop offset="0%" stop-color="#FFA63F" />
|
||||||
|
<stop offset="100%" stop-color="#FF0" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<g fill="none">
|
||||||
|
<path fill="#000" d="M63.213 215.474c-11.387-16.346-13.591-69.606 12.947-102.39C89.292 97.383 92.69 86.455 93.7 71.67c.734-16.805-11.846-66.851 35.537-70.616 48.027-3.857 45.364 43.526 45.088 68.596-.183 21.12 15.52 33.15 26.355 49.68 19.927 30.303 18.274 82.461-3.765 110.745-27.916 35.354-51.791 20.018-67.678 21.304-29.752 1.745-30.762 17.54-66.024-35.905" />
|
||||||
|
<path fill={`url(#${idPrefix}6)`} d="M81.027 145.684c6.52-14.785 20.386-40.772 20.662-60.883 0-15.978 47.843-19.835 51.7-3.856 3.856 15.978 13.59 39.853 19.834 51.424 6.245 11.478 24.335 48.118 5.051 80.074-17.356 28.284-69.973 50.69-98.073-3.856-9.55-18.917-7.806-42.333.826-62.903" />
|
||||||
|
<path fill={`url(#${idPrefix}8)`} d="M166.428 151.285c0 16.162-15.519 37.1-42.15 36.916-27.456.183-39.118-20.754-39.118-36.916 0-16.161 18.182-29.293 40.588-29.293 22.498.092 40.68 13.132 40.68 29.293" />
|
||||||
|
<path fill="#000" stroke="#000" stroke-width=".977" d="M176.805 117.86c13.59 11.02 38.292 49.587 2.204 74.748-11.846 7.806 10.468 32.508 23.049 19.927 43.618-43.894-1.102-94.308-16.53-111.664-13.774-15.151-25.987 3.49-8.723 16.989z" />
|
||||||
|
<path fill="#000" stroke="#000" stroke-width="1.25" d="M79.925 122.727c-8.907 14.509-30.211 48.669-1.652 66.484 38.384 23.6 27.548 47.108-7.53 25.895-49.404-29.568-5.97-89.257 13.774-112.03 22.59-25.529 4.316 4.683-4.592 19.65z" />
|
||||||
|
<path fill={`url(#${idPrefix}c)`} stroke="#E68C3F" stroke-width="6.25" d="M51.835 258.542c-20.57-10.928-50.414 2.112-39.578-27.457 2.204-6.704-3.214-16.805.275-23.325 4.133-7.989 13.04-6.244 18.366-11.57 5.234-5.51 8.54-15.06 18.366-13.59 9.734 1.468 16.254 13.406 23.049 28.099 5.05 10.468 22.865 25.253 21.672 37.007-1.47 17.998-21.948 21.396-42.15 10.836z" transform="translate(10)" />
|
||||||
|
<path fill={`url(#${idPrefix}e)`} stroke="#E68C3F" stroke-width="6.251" d="M194.445 253.49c15.06-18.273 48.578-14.508 25.988-39.577-4.775-5.418-3.306-16.989-9.183-21.947-6.887-6.061-14.509-1.102-21.488-4.224-6.979-3.398-14.325-9.918-22.865-5.327-8.54 4.684-9.459 16.805-10.285 32.783-.735 11.479-11.203 30.671-5.602 41.231 8.081 16.346 29.11 14.142 43.435-2.938z" transform="translate(10)" />
|
||||||
|
<path fill={`url(#${idPrefix}i)`} stroke="#E68C3F" stroke-width="3.75" d="M97.107 66.344c3.673-3.398 12.58-13.774 29.477-2.939 3.122 2.02 5.693 2.204 11.662 4.775 12.03 4.96 6.336 16.897-6.52 20.937-5.51 1.745-10.468 8.449-20.386 7.806-8.54-.46-10.744-6.06-15.978-9.091-9.275-5.234-10.652-12.305-5.602-16.07 5.051-3.765 6.98-5.143 7.347-5.418z" transform="translate(10)" />
|
||||||
|
<path fill="#000" d="M133.186 57.712c-.092 5.234 2.48 9.458 5.877 9.458 3.306 0 6.153-4.224 6.245-9.366.091-5.234-2.48-9.459-5.878-9.459-3.397 0-6.152 4.225-6.244 9.367m-21.212.092c.459 4.316-1.194 7.989-3.582 8.356-2.387.276-4.683-2.938-5.142-7.254-.46-4.316 1.194-7.99 3.581-8.357 2.388-.275 4.684 2.939 5.143 7.255" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
@@ -6,7 +6,7 @@ interface Props {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
title = "T3 Code",
|
title = "T3 Code",
|
||||||
description = "T3 Code — The best way to code with AI.",
|
description = "T3 Code — The open-source control plane for coding agents.",
|
||||||
} = Astro.props;
|
} = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ const {
|
|||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
<link
|
<link
|
||||||
href="https://fonts.googleapis.com/css2?family=DM+Sans:opsz,[email protected],400;9..40,500;9..40,600&display=swap"
|
href="https://fonts.googleapis.com/css2?family=DM+Sans:opsz,[email protected],400;9..40,500;9..40,600&family=JetBrains+Mono:wght@400;500&display=swap"
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
/>
|
/>
|
||||||
<link rel="icon" href="/favicon.ico" sizes="48x48" />
|
<link rel="icon" href="/favicon.ico" sizes="48x48" />
|
||||||
@@ -30,18 +30,25 @@ const {
|
|||||||
<body>
|
<body>
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<nav class="nav">
|
<nav class="nav">
|
||||||
<a href="/" class="nav-brand">
|
<div class="nav-inner">
|
||||||
<img src="/icon.png" alt="T3" class="nav-icon" />
|
<a href="/" class="nav-brand" aria-label="T3 Code home">
|
||||||
</a>
|
<span class="nav-brand-name">T3 Code</span>
|
||||||
<a
|
</a>
|
||||||
href="https://github.com/pingdotgg/t3code"
|
<div class="nav-right">
|
||||||
target="_blank"
|
<a
|
||||||
rel="noopener noreferrer"
|
class="nav-gh"
|
||||||
class="nav-github"
|
href="https://github.com/pingdotgg/t3code"
|
||||||
>
|
target="_blank"
|
||||||
GitHub
|
rel="noopener noreferrer"
|
||||||
<span class="nav-github-arrow" aria-hidden="true">↗</span>
|
>
|
||||||
</a>
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
||||||
|
<path d="M12 .5C5.65.5.5 5.65.5 12a11.5 11.5 0 007.86 10.93c.58.1.79-.25.79-.56v-2c-3.2.69-3.88-1.37-3.88-1.37-.52-1.33-1.27-1.69-1.27-1.69-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.18 1.76 1.18 1.02 1.76 2.68 1.25 3.33.96.1-.75.4-1.25.72-1.54-2.55-.29-5.24-1.27-5.24-5.67 0-1.25.45-2.28 1.18-3.08-.12-.29-.51-1.45.11-3.02 0 0 .96-.31 3.15 1.18a10.96 10.96 0 015.74 0c2.19-1.49 3.15-1.18 3.15-1.18.62 1.57.23 2.73.11 3.02.74.8 1.18 1.83 1.18 3.08 0 4.41-2.7 5.38-5.27 5.66.41.36.78 1.06.78 2.13v3.16c0 .31.21.67.8.56A11.5 11.5 0 0023.5 12C23.5 5.65 18.35.5 12 .5z"/>
|
||||||
|
</svg>
|
||||||
|
<span>GitHub</span>
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-primary" href="/#download">Download</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<main class="main">
|
<main class="main">
|
||||||
@@ -49,23 +56,54 @@ const {
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<span class="footer-copy">© {new Date().getFullYear()} T3 Tools Inc</span>
|
<div class="footer-inner">
|
||||||
<div class="footer-links">
|
<div class="footer-brand">
|
||||||
<a href="https://github.com/pingdotgg/t3code" target="_blank" rel="noopener noreferrer">GitHub</a>
|
<img src="/icon.webp" alt="" />
|
||||||
<a href="https://discord.gg/jn4EGJjrvv" target="_blank" rel="noopener noreferrer">Discord</a>
|
<span>© {new Date().getFullYear()} T3 Tools Inc · MIT licensed</span>
|
||||||
|
</div>
|
||||||
|
<div class="footer-links">
|
||||||
|
<a href="https://github.com/pingdotgg/t3code" target="_blank" rel="noopener noreferrer">GitHub</a>
|
||||||
|
<a href="https://discord.gg/jn4EGJjrvv" target="_blank" rel="noopener noreferrer">Discord</a>
|
||||||
|
<a href="/download">Download</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const nav = document.querySelector(".nav");
|
||||||
|
const onScroll = () => {
|
||||||
|
if (!nav) return;
|
||||||
|
if (window.scrollY > 12) nav.classList.add("is-scrolled");
|
||||||
|
else nav.classList.remove("is-scrolled");
|
||||||
|
};
|
||||||
|
window.addEventListener("scroll", onScroll, { passive: true });
|
||||||
|
onScroll();
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
<style is:global>
|
<style is:global>
|
||||||
:root {
|
:root {
|
||||||
--bg: #09090b;
|
--bg: #09090b;
|
||||||
|
--bg-elev: #0c0c0e;
|
||||||
|
--bg-card: #111113;
|
||||||
--fg: #fafafa;
|
--fg: #fafafa;
|
||||||
--fg-muted: #a1a1aa;
|
--fg-muted: #a1a1aa;
|
||||||
--fg-dim: #71717a;
|
--fg-dim: #71717a;
|
||||||
|
--fg-faint: #52525b;
|
||||||
--border: rgba(255, 255, 255, 0.08);
|
--border: rgba(255, 255, 255, 0.08);
|
||||||
|
--border-strong: rgba(255, 255, 255, 0.14);
|
||||||
|
--accent-h: 250;
|
||||||
|
--accent: oklch(0.68 0.17 var(--accent-h));
|
||||||
|
--accent-dim: oklch(0.68 0.17 var(--accent-h) / 0.15);
|
||||||
|
--ok: oklch(0.72 0.16 150);
|
||||||
|
--warn: oklch(0.76 0.15 75);
|
||||||
|
--font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
|
||||||
|
--font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
|
||||||
|
--radius: 12px;
|
||||||
|
--radius-sm: 8px;
|
||||||
|
--radius-lg: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
@@ -76,16 +114,19 @@ const {
|
|||||||
|
|
||||||
html {
|
html {
|
||||||
color-scheme: dark;
|
color-scheme: dark;
|
||||||
|
scroll-behavior: smooth;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
font-family: "DM Sans", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
|
font-family: var(--font-sans);
|
||||||
|
font-feature-settings: "ss01", "ss02";
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
body::after {
|
body::after {
|
||||||
@@ -105,11 +146,103 @@ const {
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
button {
|
||||||
|
font-family: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 0;
|
||||||
|
background: none;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
img,
|
||||||
|
svg {
|
||||||
display: block;
|
display: block;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.eyebrow {
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
font-size: 11px;
|
||||||
|
letter-spacing: 0.14em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: var(--fg-dim);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.display {
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: -0.035em;
|
||||||
|
line-height: 1.05;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 1240px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 0 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 10px 18px;
|
||||||
|
border-radius: 8px;
|
||||||
|
transition: transform 0.18s ease, background 0.18s ease,
|
||||||
|
border-color 0.18s ease, color 0.18s ease;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background: var(--fg);
|
||||||
|
color: #09090b;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
transform: translateY(-1px);
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:active {
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-ghost {
|
||||||
|
color: var(--fg-muted);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-ghost:hover {
|
||||||
|
color: var(--fg);
|
||||||
|
border-color: var(--border-strong);
|
||||||
|
background: rgba(255, 255, 255, 0.02);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-lg {
|
||||||
|
padding: 14px 22px;
|
||||||
|
font-size: 15px;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tile {
|
||||||
|
position: relative;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0));
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
:focus-visible {
|
||||||
|
outline: 2px solid var(--accent);
|
||||||
|
outline-offset: 2px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes fade-in {
|
@keyframes fade-in {
|
||||||
from {
|
from {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@@ -120,11 +253,26 @@ const {
|
|||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes pulse {
|
||||||
|
50% { opacity: 0.4; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
to { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes floatDrift {
|
||||||
|
0%, 100% { translate: 0 0; }
|
||||||
|
50% { translate: 0 -10px; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes blink {
|
||||||
|
50% { opacity: 0; }
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* ── Page ── */
|
|
||||||
|
|
||||||
.page {
|
.page {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -132,97 +280,131 @@ const {
|
|||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Navbar ── */
|
|
||||||
|
|
||||||
.nav {
|
.nav {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 50;
|
||||||
|
backdrop-filter: blur(18px);
|
||||||
|
-webkit-backdrop-filter: blur(18px);
|
||||||
|
background: color-mix(in srgb, var(--bg) 75%, transparent);
|
||||||
|
border-bottom: 1px solid transparent;
|
||||||
|
transition: border-color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav.is-scrolled {
|
||||||
|
border-bottom-color: var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-inner {
|
||||||
|
max-width: 1240px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 12px 32px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 1.5rem 2.5rem;
|
gap: 24px;
|
||||||
opacity: 0.5;
|
|
||||||
transition: opacity 0.4s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav:hover {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-brand {
|
.nav-brand {
|
||||||
display: flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
|
||||||
|
|
||||||
.nav-icon {
|
|
||||||
width: 28px;
|
|
||||||
height: 28px;
|
|
||||||
border-radius: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-github {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.35rem;
|
|
||||||
color: var(--fg-muted);
|
|
||||||
font-size: 0.875rem;
|
|
||||||
transition: color 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-github:hover {
|
|
||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
|
transition: color 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-github-arrow {
|
.nav-brand:hover {
|
||||||
display: inline-block;
|
color: #fff;
|
||||||
transition: transform 0.3s ease;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-github:hover .nav-github-arrow {
|
.nav-brand-name {
|
||||||
transform: translateX(2px) translateY(-1px);
|
font-size: 16px;
|
||||||
|
font-weight: 650;
|
||||||
|
letter-spacing: -0.025em;
|
||||||
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Main content ── */
|
.nav-right {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-gh {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 7px 12px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 8px;
|
||||||
|
color: var(--fg-muted);
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
font-size: 12px;
|
||||||
|
transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-gh:hover {
|
||||||
|
color: var(--fg);
|
||||||
|
background: rgba(255, 255, 255, 0.04);
|
||||||
|
border-color: var(--border-strong);
|
||||||
|
}
|
||||||
|
|
||||||
.main {
|
.main {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Footer ── */
|
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
|
margin-top: auto;
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
padding: 40px 0 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-inner {
|
||||||
|
max-width: 1240px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 0 32px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 24px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 1.5rem 2.5rem;
|
}
|
||||||
font-size: 0.8rem;
|
|
||||||
|
.footer-brand {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
font-size: 13px;
|
||||||
color: var(--fg-dim);
|
color: var(--fg-dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.footer-brand img {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
.footer-links {
|
.footer-links {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 1.25rem;
|
gap: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer-links a {
|
.footer-links a {
|
||||||
|
font-size: 13px;
|
||||||
color: var(--fg-dim);
|
color: var(--fg-dim);
|
||||||
transition: color 0.3s ease;
|
transition: color 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer-links a:hover {
|
.footer-links a:hover {
|
||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Mobile ── */
|
@media (max-width: 820px) {
|
||||||
|
.nav-inner,
|
||||||
@media (max-width: 640px) {
|
.footer-inner {
|
||||||
.nav {
|
padding-left: 20px;
|
||||||
padding: 1.25rem;
|
padding-right: 20px;
|
||||||
}
|
|
||||||
|
|
||||||
.footer {
|
|
||||||
padding: 1.25rem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
export type Tweet = {
|
||||||
|
handle: string;
|
||||||
|
content: string;
|
||||||
|
excerpt?: string;
|
||||||
|
link: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const tweets = [
|
||||||
|
{
|
||||||
|
handle: "Shay_Benshabtay",
|
||||||
|
content:
|
||||||
|
"T3 code is not perfect, but it's damn good. Open and fun , I can make my own fork for my uses and use the great tooling with my own needs.",
|
||||||
|
link: "https://x.com/Shay_Benshabtay/status/2054668503857156326",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "teja2495",
|
||||||
|
content:
|
||||||
|
"I’ve completely switched to T3 Code for all my workflows. I just switch between different subscriptions and harnesses depending on what I need.",
|
||||||
|
excerpt: "I’ve completely switched to T3 Code for all my workflows.",
|
||||||
|
link: "https://x.com/teja2495/status/2052420254991581623",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "developedbyed",
|
||||||
|
content: "might say alpha but T3 code is pretty awesome, really fast too",
|
||||||
|
link: "https://x.com/developedbyed/status/2030627970532921605",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "tannerlinsley",
|
||||||
|
content:
|
||||||
|
"The minute T3 Code supports Claude Code, it could potentially become my daily driver. There's something special there.",
|
||||||
|
link: "https://x.com/tannerlinsley/status/2031102771529920966",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "aronprins",
|
||||||
|
content:
|
||||||
|
"I already loved T3 Code by @theo and @jullerino, but their Connections implementation is next level epic and for this they should both earn maximum repect 🔥🫡",
|
||||||
|
excerpt: "I already loved T3 Code, but their Connections implementation is next level epic.",
|
||||||
|
link: "https://x.com/aronprins/status/2045102518196183109",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "BennettBuhner",
|
||||||
|
content:
|
||||||
|
"T3 Code is literally Codex but better; all your favorite models and harnesses, accessible anywhere! The app is great but the website is even greater, so instead of needing to SSH into a machine, T3 IS my SSH!",
|
||||||
|
excerpt:
|
||||||
|
"T3 Code is literally Codex but better; all your favorite models and harnesses, accessible anywhere.",
|
||||||
|
link: "https://x.com/BennettBuhner/status/2054667115697754387",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "ex0t1clol",
|
||||||
|
content: "T3 Code is proof electron apps don't have to suck",
|
||||||
|
link: "https://x.com/ex0t1clol/status/2054666870008021197",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "Josikinz",
|
||||||
|
content:
|
||||||
|
"T3 code is better because it’s like if the codex Mac app didn’t make my computer run like shit 😋",
|
||||||
|
link: "https://x.com/Josikinz/status/2030367951694745870",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "jetpackjoe_",
|
||||||
|
content: "T3 code is pretty alright I guess",
|
||||||
|
link: "https://x.com/jetpackjoe_/status/2054666792933404959",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "mil000",
|
||||||
|
content: "T3 code saved my relationship!",
|
||||||
|
link: "https://x.com/mil000/status/2030120041451246071",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "_winter_wonders",
|
||||||
|
content: "Heartbreaking: AI-hater has to admit T3 Code is really good.",
|
||||||
|
link: "https://x.com/_winter_wonders/status/2052350198764970434",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "kostyniuk00",
|
||||||
|
content:
|
||||||
|
"I was not expecting a year ago, that my anti-AI colleagues would thank me a year later, for persuading them to try T3 Code Beta, that really helped them with organizing their workflows. \n\nFantastic product by @jullerino and @theo. Go try it out if you haven’t yet!",
|
||||||
|
excerpt:
|
||||||
|
"My anti-AI colleagues thanked me for persuading them to try T3 Code Beta. Fantastic product.",
|
||||||
|
link: "https://x.com/kostyniuk00/status/2052041388179468521",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "gnukeith",
|
||||||
|
content:
|
||||||
|
"I tried T3 Code it actually fixed issues that Opus couldn’t solve in Claude Code + Theo has replied with “UwU” under my post. Dario has not.",
|
||||||
|
link: "https://x.com/gnukeith/status/2054670073579630730",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "peculiarnewbie",
|
||||||
|
content: "T3 Code is iOS and other harnesses are androids",
|
||||||
|
link: "https://x.com/peculiarnewbie/status/2054671685027233827",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "leodev",
|
||||||
|
content:
|
||||||
|
"T3 Code is probably the first coding gui that didn't suck performance wise and had a smart team behind it.",
|
||||||
|
link: "https://x.com/leodev/status/2054679746353537042",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "pocarles",
|
||||||
|
content:
|
||||||
|
"Only using Codex and T3 now.\n\nI thought all AI coding harnesses had roughly the same impact. Using T3 Code taught me how wrong I was. The interface between you and the model changes everything.",
|
||||||
|
excerpt:
|
||||||
|
"Using T3 Code taught me how wrong I was. The interface between you and the model changes everything.",
|
||||||
|
link: "https://x.com/pocarles/status/2054673964274758046",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "DavidKPiano",
|
||||||
|
content: "It's like Claude Code if they didn't vibe-code the entire thing",
|
||||||
|
link: "https://x.com/DavidKPiano/status/2054682983504719930",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "iamkaffe",
|
||||||
|
content: "T3Code was the first one to truly care about Linux users.",
|
||||||
|
link: "https://x.com/iamkaffe/status/2054675539311411280",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: "uwunetes",
|
||||||
|
content:
|
||||||
|
"claude code make me go *whine whine whine* and t3 code make me go woof woof awooooo!!!",
|
||||||
|
link: "https://x.com/uwunetes/status/2054683356022120640",
|
||||||
|
},
|
||||||
|
] satisfies Tweet[];
|
||||||
@@ -4,6 +4,7 @@ import { RELEASES_URL } from "../lib/releases";
|
|||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Download — T3 Code" description="Download T3 Code for macOS, Windows, or Linux.">
|
<Layout title="Download — T3 Code" description="Download T3 Code for macOS, Windows, or Linux.">
|
||||||
|
<div class="download-page">
|
||||||
<h1 class="heading">Download T3 Code</h1>
|
<h1 class="heading">Download T3 Code</h1>
|
||||||
<p class="subheading">
|
<p class="subheading">
|
||||||
<span id="version-label">Loading latest release…</span>
|
<span id="version-label">Loading latest release…</span>
|
||||||
@@ -64,6 +65,7 @@ import { RELEASES_URL } from "../lib/releases";
|
|||||||
GitHub releases page<span aria-hidden="true"> ↗</span>
|
GitHub releases page<span aria-hidden="true"> ↗</span>
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -111,7 +113,11 @@ import { RELEASES_URL } from "../lib/releases";
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.main {
|
.download-page {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
padding: 8vh 1.5rem 4rem;
|
padding: 8vh 1.5rem 4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,7 +263,7 @@ import { RELEASES_URL } from "../lib/releases";
|
|||||||
/* ── Mobile ── */
|
/* ── Mobile ── */
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
.main {
|
.download-page {
|
||||||
padding: 5vh 1.25rem 4rem;
|
padding: 5vh 1.25rem 4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
https://x.com/Shay_Benshabtay/status/2054668503857156326
|
||||||
|
https://x.com/teja2495/status/2052420254991581623
|
||||||
|
https://x.com/developedbyed/status/2030627970532921605
|
||||||
|
https://x.com/tannerlinsley/status/2031102771529920966
|
||||||
|
https://x.com/aronprins/status/2045102518196183109
|
||||||
|
https://x.com/BennettBuhner/status/2054667115697754387
|
||||||
|
https://x.com/ex0t1clol/status/2054666870008021197
|
||||||
|
https://x.com/Josikinz/status/2030367951694745870
|
||||||
|
https://x.com/jetpackjoe_/status/2054666792933404959
|
||||||
|
https://x.com/mil000/status/2030120041451246071
|
||||||
|
https://x.com/_winter_wonders/status/2052350198764970434
|
||||||
|
https://x.com/kostyniuk00/status/2052041388179468521
|
||||||
|
https://x.com/gnukeith/status/2054670073579630730
|
||||||
|
https://x.com/peculiarnewbie/status/2054671685027233827
|
||||||
|
https://x.com/leodev/status/2054679746353537042
|
||||||
|
https://x.com/pocarles/status/2054673964274758046
|
||||||
|
https://x.com/DavidKPiano/status/2054682983504719930
|
||||||
|
https://x.com/iamkaffe/status/2054675539311411280
|
||||||
|
https://x.com/uwunetes/status/2054683356022120640
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// @effect-diagnostics nodeBuiltinImport:off
|
||||||
import { execFileSync } from "node:child_process";
|
import { execFileSync } from "node:child_process";
|
||||||
|
|
||||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||||
@@ -8,20 +9,18 @@ import {
|
|||||||
type OrchestrationEvent,
|
type OrchestrationEvent,
|
||||||
type OrchestrationThread,
|
type OrchestrationThread,
|
||||||
} from "@t3tools/contracts";
|
} from "@t3tools/contracts";
|
||||||
import {
|
import * as Effect from "effect/Effect";
|
||||||
Effect,
|
import * as Exit from "effect/Exit";
|
||||||
Exit,
|
import * as FileSystem from "effect/FileSystem";
|
||||||
FileSystem,
|
import * as Layer from "effect/Layer";
|
||||||
Layer,
|
import * as ManagedRuntime from "effect/ManagedRuntime";
|
||||||
ManagedRuntime,
|
import * as Option from "effect/Option";
|
||||||
Option,
|
import * as Path from "effect/Path";
|
||||||
Path,
|
import * as Ref from "effect/Ref";
|
||||||
Ref,
|
import * as Schedule from "effect/Schedule";
|
||||||
Schedule,
|
import * as Schema from "effect/Schema";
|
||||||
Schema,
|
import * as Scope from "effect/Scope";
|
||||||
Scope,
|
import * as Stream from "effect/Stream";
|
||||||
Stream,
|
|
||||||
} from "effect";
|
|
||||||
|
|
||||||
import { CheckpointStoreLive } from "../src/checkpointing/Layers/CheckpointStore.ts";
|
import { CheckpointStoreLive } from "../src/checkpointing/Layers/CheckpointStore.ts";
|
||||||
import { CheckpointStore } from "../src/checkpointing/Services/CheckpointStore.ts";
|
import { CheckpointStore } from "../src/checkpointing/Services/CheckpointStore.ts";
|
||||||
@@ -74,12 +73,13 @@ import {
|
|||||||
import { deriveServerPaths, ServerConfig } from "../src/config.ts";
|
import { deriveServerPaths, ServerConfig } from "../src/config.ts";
|
||||||
import { WorkspaceEntriesLive } from "../src/workspace/Layers/WorkspaceEntries.ts";
|
import { WorkspaceEntriesLive } from "../src/workspace/Layers/WorkspaceEntries.ts";
|
||||||
import { WorkspacePathsLive } from "../src/workspace/Layers/WorkspacePaths.ts";
|
import { WorkspacePathsLive } from "../src/workspace/Layers/WorkspacePaths.ts";
|
||||||
import * as GitVcsDriver from "../src/vcs/GitVcsDriver.ts";
|
|
||||||
import * as VcsDriverRegistry from "../src/vcs/VcsDriverRegistry.ts";
|
import * as VcsDriverRegistry from "../src/vcs/VcsDriverRegistry.ts";
|
||||||
import { VcsStatusBroadcaster } from "../src/vcs/VcsStatusBroadcaster.ts";
|
import { VcsStatusBroadcaster } from "../src/vcs/VcsStatusBroadcaster.ts";
|
||||||
import { GitWorkflowService } from "../src/git/GitWorkflowService.ts";
|
import { GitWorkflowService } from "../src/git/GitWorkflowService.ts";
|
||||||
import * as VcsProcess from "../src/vcs/VcsProcess.ts";
|
import * as VcsProcess from "../src/vcs/VcsProcess.ts";
|
||||||
|
|
||||||
|
const decodeCodexSettings = Schema.decodeEffect(CodexSettings);
|
||||||
|
|
||||||
function runGit(cwd: string, args: ReadonlyArray<string>) {
|
function runGit(cwd: string, args: ReadonlyArray<string>) {
|
||||||
return execFileSync("git", args, {
|
return execFileSync("git", args, {
|
||||||
cwd,
|
cwd,
|
||||||
@@ -267,7 +267,7 @@ export const makeOrchestrationIntegrationHarness = (
|
|||||||
const realCodexRegistry = Layer.effect(
|
const realCodexRegistry = Layer.effect(
|
||||||
ProviderAdapterRegistry,
|
ProviderAdapterRegistry,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const codexSettings = Schema.decodeSync(CodexSettings)({});
|
const codexSettings = yield* decodeCodexSettings({});
|
||||||
const codexAdapter = yield* makeCodexAdapter(codexSettings);
|
const codexAdapter = yield* makeCodexAdapter(codexSettings);
|
||||||
return makeAdapterRegistryMock({
|
return makeAdapterRegistryMock({
|
||||||
[ProviderDriverKind.make("codex")]: codexAdapter,
|
[ProviderDriverKind.make("codex")]: codexAdapter,
|
||||||
@@ -310,8 +310,11 @@ export const makeOrchestrationIntegrationHarness = (
|
|||||||
Layer.provideMerge(serverSettingsLayer),
|
Layer.provideMerge(serverSettingsLayer),
|
||||||
);
|
);
|
||||||
const gitWorkflowLayer = Layer.mock(GitWorkflowService)({
|
const gitWorkflowLayer = Layer.mock(GitWorkflowService)({
|
||||||
renameBranch: (input: Parameters<GitVcsDriver.GitVcsDriverShape["renameBranch"]>[0]) =>
|
renameBranch: (input: {
|
||||||
Effect.succeed({ branch: input.newBranch }),
|
readonly cwd: string;
|
||||||
|
readonly oldBranch: string;
|
||||||
|
readonly newBranch: string;
|
||||||
|
}) => Effect.succeed({ branch: input.newBranch }),
|
||||||
});
|
});
|
||||||
const textGenerationLayer = Layer.succeed(TextGeneration, {
|
const textGenerationLayer = Layer.succeed(TextGeneration, {
|
||||||
generateBranchName: () => Effect.succeed({ branch: "update" }),
|
generateBranchName: () => Effect.succeed({ branch: "update" }),
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import { randomUUID } from "node:crypto";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ApprovalRequestId,
|
ApprovalRequestId,
|
||||||
EventId,
|
EventId,
|
||||||
@@ -12,7 +10,10 @@ import {
|
|||||||
TurnId,
|
TurnId,
|
||||||
ProviderDriverKind,
|
ProviderDriverKind,
|
||||||
} from "@t3tools/contracts";
|
} from "@t3tools/contracts";
|
||||||
import { Effect, Queue, Stream } from "effect";
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Queue from "effect/Queue";
|
||||||
|
import * as Random from "effect/Random";
|
||||||
|
import * as Stream from "effect/Stream";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ProviderAdapterSessionNotFoundError,
|
ProviderAdapterSessionNotFoundError,
|
||||||
@@ -202,7 +203,7 @@ interface MakeTestProviderAdapterHarnessOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function nowIso(): string {
|
function nowIso(): string {
|
||||||
return new Date().toISOString();
|
return "2026-01-01T00:00:00.000Z";
|
||||||
}
|
}
|
||||||
|
|
||||||
function sessionNotFound(
|
function sessionNotFound(
|
||||||
@@ -308,10 +309,9 @@ export const makeTestProviderAdapterHarness = (options?: MakeTestProviderAdapter
|
|||||||
for (const fixtureEvent of response.events) {
|
for (const fixtureEvent of response.events) {
|
||||||
const rawEvent: Record<string, unknown> = {
|
const rawEvent: Record<string, unknown> = {
|
||||||
...(fixtureEvent as Record<string, unknown>),
|
...(fixtureEvent as Record<string, unknown>),
|
||||||
eventId: randomUUID(),
|
eventId: yield* Random.nextUUIDv4,
|
||||||
provider,
|
provider,
|
||||||
sessionId: RuntimeSessionId.make(String(input.threadId)),
|
sessionId: RuntimeSessionId.make(String(input.threadId)),
|
||||||
createdAt: nowIso(),
|
|
||||||
};
|
};
|
||||||
rawEvent.threadId = state.snapshot.threadId;
|
rawEvent.threadId = state.snapshot.threadId;
|
||||||
if (Object.hasOwn(rawEvent, "turnId")) {
|
if (Object.hasOwn(rawEvent, "turnId")) {
|
||||||
@@ -366,7 +366,7 @@ export const makeTestProviderAdapterHarness = (options?: MakeTestProviderAdapter
|
|||||||
if (deferredTurnCompletedEvents.length === 0) {
|
if (deferredTurnCompletedEvents.length === 0) {
|
||||||
yield* emit({
|
yield* emit({
|
||||||
type: "turn.completed",
|
type: "turn.completed",
|
||||||
eventId: EventId.make(randomUUID()),
|
eventId: EventId.make(yield* Random.nextUUIDv4),
|
||||||
provider,
|
provider,
|
||||||
createdAt: nowIso(),
|
createdAt: nowIso(),
|
||||||
threadId: state.snapshot.threadId,
|
threadId: state.snapshot.threadId,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// @effect-diagnostics nodeBuiltinImport:off
|
||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
|
||||||
@@ -17,7 +18,10 @@ import {
|
|||||||
ProviderInstanceId,
|
ProviderInstanceId,
|
||||||
} from "@t3tools/contracts";
|
} from "@t3tools/contracts";
|
||||||
import { assert, it } from "@effect/vitest";
|
import { assert, it } from "@effect/vitest";
|
||||||
import { Effect, Option, Schema } from "effect";
|
import * as Clock from "effect/Clock";
|
||||||
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Option from "effect/Option";
|
||||||
|
import * as Schema from "effect/Schema";
|
||||||
|
|
||||||
import type { TestTurnResponse } from "./TestProviderAdapter.integration.ts";
|
import type { TestTurnResponse } from "./TestProviderAdapter.integration.ts";
|
||||||
import {
|
import {
|
||||||
@@ -47,7 +51,7 @@ const CODEX_PROVIDER = ProviderDriverKind.make("codex");
|
|||||||
const CLAUDE_AGENT_PROVIDER = ProviderDriverKind.make("claudeAgent");
|
const CLAUDE_AGENT_PROVIDER = ProviderDriverKind.make("claudeAgent");
|
||||||
|
|
||||||
function nowIso() {
|
function nowIso() {
|
||||||
return new Date().toISOString();
|
return "2026-05-01T00:00:00.000Z";
|
||||||
}
|
}
|
||||||
|
|
||||||
class IntegrationWaitTimeoutError extends Schema.TaggedErrorClass<IntegrationWaitTimeoutError>()(
|
class IntegrationWaitTimeoutError extends Schema.TaggedErrorClass<IntegrationWaitTimeoutError>()(
|
||||||
@@ -64,14 +68,14 @@ function waitForSync<A>(
|
|||||||
timeoutMs = 10_000,
|
timeoutMs = 10_000,
|
||||||
): Effect.Effect<A, never> {
|
): Effect.Effect<A, never> {
|
||||||
return Effect.gen(function* () {
|
return Effect.gen(function* () {
|
||||||
const deadline = Date.now() + timeoutMs;
|
const deadline = (yield* Clock.currentTimeMillis) + timeoutMs;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const value = read();
|
const value = read();
|
||||||
if (predicate(value)) {
|
if (predicate(value)) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
if (Date.now() >= deadline) {
|
if ((yield* Clock.currentTimeMillis) >= deadline) {
|
||||||
return yield* Effect.die(new IntegrationWaitTimeoutError({ description }));
|
return yield* Effect.die(new IntegrationWaitTimeoutError({ description }));
|
||||||
}
|
}
|
||||||
yield* Effect.sleep(10);
|
yield* Effect.sleep(10);
|
||||||
@@ -156,6 +160,7 @@ const startTurn = (input: {
|
|||||||
readonly messageId: string;
|
readonly messageId: string;
|
||||||
readonly text: string;
|
readonly text: string;
|
||||||
readonly modelSelection?: ModelSelection;
|
readonly modelSelection?: ModelSelection;
|
||||||
|
readonly createdAt?: string;
|
||||||
}) =>
|
}) =>
|
||||||
input.harness.engine.dispatch({
|
input.harness.engine.dispatch({
|
||||||
type: "thread.turn.start",
|
type: "thread.turn.start",
|
||||||
@@ -174,7 +179,7 @@ const startTurn = (input: {
|
|||||||
: {}),
|
: {}),
|
||||||
interactionMode: DEFAULT_PROVIDER_INTERACTION_MODE,
|
interactionMode: DEFAULT_PROVIDER_INTERACTION_MODE,
|
||||||
runtimeMode: "approval-required",
|
runtimeMode: "approval-required",
|
||||||
createdAt: nowIso(),
|
createdAt: input.createdAt ?? nowIso(),
|
||||||
});
|
});
|
||||||
|
|
||||||
it.live("runs a single turn end-to-end and persists checkpoint state in sqlite + git", () =>
|
it.live("runs a single turn end-to-end and persists checkpoint state in sqlite + git", () =>
|
||||||
@@ -755,6 +760,7 @@ it.live("reverts to an earlier checkpoint and trims checkpoint projections + git
|
|||||||
commandId: "cmd-turn-start-revert-1",
|
commandId: "cmd-turn-start-revert-1",
|
||||||
messageId: "msg-user-revert-1",
|
messageId: "msg-user-revert-1",
|
||||||
text: "First edit",
|
text: "First edit",
|
||||||
|
createdAt: "2026-02-24T10:04:59.900Z",
|
||||||
});
|
});
|
||||||
|
|
||||||
yield* harness.waitForThread(
|
yield* harness.waitForThread(
|
||||||
@@ -813,6 +819,7 @@ it.live("reverts to an earlier checkpoint and trims checkpoint projections + git
|
|||||||
commandId: "cmd-turn-start-revert-2",
|
commandId: "cmd-turn-start-revert-2",
|
||||||
messageId: "msg-user-revert-2",
|
messageId: "msg-user-revert-2",
|
||||||
text: "Second edit",
|
text: "Second edit",
|
||||||
|
createdAt: "2026-02-24T10:05:00.900Z",
|
||||||
});
|
});
|
||||||
|
|
||||||
yield* harness.waitForThread(
|
yield* harness.waitForThread(
|
||||||
|
|||||||
@@ -3,7 +3,12 @@ import { ProviderDriverKind, ProviderInstanceId, ThreadId } from "@t3tools/contr
|
|||||||
import { DEFAULT_SERVER_SETTINGS } from "@t3tools/contracts/settings";
|
import { DEFAULT_SERVER_SETTINGS } from "@t3tools/contracts/settings";
|
||||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||||
import { it, assert } from "@effect/vitest";
|
import { it, assert } from "@effect/vitest";
|
||||||
import { Effect, FileSystem, Layer, Path, Queue, Stream } from "effect";
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as FileSystem from "effect/FileSystem";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
import * as Path from "effect/Path";
|
||||||
|
import * as Queue from "effect/Queue";
|
||||||
|
import * as Stream from "effect/Stream";
|
||||||
|
|
||||||
import { ProviderAdapterRegistry } from "../src/provider/Services/ProviderAdapterRegistry.ts";
|
import { ProviderAdapterRegistry } from "../src/provider/Services/ProviderAdapterRegistry.ts";
|
||||||
import { makeAdapterRegistryMock } from "../src/provider/testUtils/providerAdapterRegistryMock.ts";
|
import { makeAdapterRegistryMock } from "../src/provider/testUtils/providerAdapterRegistryMock.ts";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "t3",
|
"name": "t3",
|
||||||
"version": "0.0.22",
|
"version": "0.0.24",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -20,19 +20,18 @@
|
|||||||
"build:bundle": "tsdown",
|
"build:bundle": "tsdown",
|
||||||
"start": "node dist/bin.mjs",
|
"start": "node dist/bin.mjs",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"test": "vitest run",
|
"test": "vitest run"
|
||||||
"test:process-reaper": "vitest run src/server.test.ts src/provider/Layers/ClaudeAdapter.test.ts src/provider/Layers/ProviderSessionDirectory.test.ts src/provider/Layers/ProviderSessionReaper.test.ts src/provider/Layers/CodexAdapter.test.ts"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@anthropic-ai/claude-agent-sdk": "^0.2.111",
|
"@anthropic-ai/claude-agent-sdk": "^0.2.111",
|
||||||
"@effect/platform-bun": "catalog:",
|
"@effect/platform-bun": "catalog:",
|
||||||
"@effect/platform-node": "catalog:",
|
"@effect/platform-node": "catalog:",
|
||||||
|
"@effect/platform-node-shared": "catalog:",
|
||||||
"@effect/sql-sqlite-bun": "catalog:",
|
"@effect/sql-sqlite-bun": "catalog:",
|
||||||
"@opencode-ai/sdk": "^1.3.15",
|
"@opencode-ai/sdk": "^1.3.15",
|
||||||
"@pierre/diffs": "catalog:",
|
"@pierre/diffs": "catalog:",
|
||||||
"effect": "catalog:",
|
"effect": "catalog:",
|
||||||
"node-pty": "^1.1.0",
|
"node-pty": "^1.1.0"
|
||||||
"open": "^10.1.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@effect/language-service": "catalog:",
|
"@effect/language-service": "catalog:",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env bun
|
#!/usr/bin/env bun
|
||||||
|
// @effect-diagnostics nodeBuiltinImport:off
|
||||||
import { appendFileSync } from "node:fs";
|
import { appendFileSync } from "node:fs";
|
||||||
|
|
||||||
import * as Effect from "effect/Effect";
|
import * as Effect from "effect/Effect";
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
|
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
|
||||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||||
import { Data, Effect, FileSystem, Logger, Option, Path } from "effect";
|
import * as Data from "effect/Data";
|
||||||
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as FileSystem from "effect/FileSystem";
|
||||||
|
import * as Logger from "effect/Logger";
|
||||||
|
import * as Option from "effect/Option";
|
||||||
|
import * as Path from "effect/Path";
|
||||||
|
import * as Schema from "effect/Schema";
|
||||||
import { Command, Flag } from "effect/unstable/cli";
|
import { Command, Flag } from "effect/unstable/cli";
|
||||||
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
|
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
|
||||||
|
|
||||||
@@ -11,6 +16,7 @@ import {
|
|||||||
PUBLISH_ICON_OVERRIDES,
|
PUBLISH_ICON_OVERRIDES,
|
||||||
} from "../../../scripts/lib/brand-assets.ts";
|
} from "../../../scripts/lib/brand-assets.ts";
|
||||||
import { resolveCatalogDependencies } from "../../../scripts/lib/resolve-catalog.ts";
|
import { resolveCatalogDependencies } from "../../../scripts/lib/resolve-catalog.ts";
|
||||||
|
import { fromJsonStringPretty } from "@t3tools/shared/schemaJson";
|
||||||
import rootPackageJson from "../../../package.json" with { type: "json" };
|
import rootPackageJson from "../../../package.json" with { type: "json" };
|
||||||
import serverPackageJson from "../package.json" with { type: "json" };
|
import serverPackageJson from "../package.json" with { type: "json" };
|
||||||
|
|
||||||
@@ -30,6 +36,9 @@ interface PackageJson {
|
|||||||
overrides: Record<string, string>;
|
overrides: Record<string, string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const PackageJsonPrettyJson = fromJsonStringPretty(Schema.Unknown);
|
||||||
|
const encodePackageJson = Schema.encodeEffect(PackageJsonPrettyJson);
|
||||||
|
|
||||||
class CliError extends Data.TaggedError("CliError")<{
|
class CliError extends Data.TaggedError("CliError")<{
|
||||||
readonly message: string;
|
readonly message: string;
|
||||||
readonly cause?: unknown;
|
readonly cause?: unknown;
|
||||||
@@ -227,8 +236,9 @@ const publishCmd = Command.make(
|
|||||||
};
|
};
|
||||||
|
|
||||||
const original = yield* fs.readFileString(packageJsonPath);
|
const original = yield* fs.readFileString(packageJsonPath);
|
||||||
|
const packageJsonString = yield* encodePackageJson(pkg);
|
||||||
yield* fs.writeFileString(backupPath, original);
|
yield* fs.writeFileString(backupPath, original);
|
||||||
yield* fs.writeFileString(packageJsonPath, `${JSON.stringify(pkg, null, 2)}\n`);
|
yield* fs.writeFileString(packageJsonPath, `${packageJsonString}\n`);
|
||||||
yield* Effect.log("[cli] Prepared package.json for publish");
|
yield* Effect.log("[cli] Prepared package.json for publish");
|
||||||
|
|
||||||
const iconBackups = yield* applyPublishIconOverrides(repoRoot, serverDir);
|
const iconBackups = yield* applyPublishIconOverrides(repoRoot, serverDir);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
// @effect-diagnostics nodeBuiltinImport:off
|
||||||
import { spawn, type ChildProcessWithoutNullStreams } from "node:child_process";
|
import { spawn, type ChildProcessWithoutNullStreams } from "node:child_process";
|
||||||
import process from "node:process";
|
import process from "node:process";
|
||||||
import readline from "node:readline";
|
import readline from "node:readline";
|
||||||
|
import * as NodeTimers from "node:timers";
|
||||||
|
|
||||||
type JsonPrimitive = null | boolean | number | string;
|
type JsonPrimitive = null | boolean | number | string;
|
||||||
type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };
|
type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };
|
||||||
@@ -114,7 +116,8 @@ function matchesKeyword(option: SessionConfigOption, keyword: string): boolean {
|
|||||||
|
|
||||||
function sleep(ms: number) {
|
function sleep(ms: number) {
|
||||||
return new Promise<void>((resolve) => {
|
return new Promise<void>((resolve) => {
|
||||||
setTimeout(resolve, ms);
|
// @effect-diagnostics-next-line globalTimers:off - Standalone Node probe script, not an Effect runtime test.
|
||||||
|
NodeTimers.setTimeout(resolve, ms);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +180,8 @@ class JsonRpcChild {
|
|||||||
const id = this.nextId++;
|
const id = this.nextId++;
|
||||||
|
|
||||||
const responsePromise = new Promise<JsonValue | undefined>((resolve, reject) => {
|
const responsePromise = new Promise<JsonValue | undefined>((resolve, reject) => {
|
||||||
const timeout = setTimeout(() => {
|
// @effect-diagnostics-next-line globalTimers:off - Standalone Node probe script request timeout.
|
||||||
|
const timeout = NodeTimers.setTimeout(() => {
|
||||||
this.pending.delete(id);
|
this.pending.delete(id);
|
||||||
reject(new Error(`Timed out waiting for ${method} response after ${timeoutMs}ms.`));
|
reject(new Error(`Timed out waiting for ${method} response after ${timeoutMs}ms.`));
|
||||||
}, timeoutMs);
|
}, timeoutMs);
|
||||||
@@ -185,11 +189,11 @@ class JsonRpcChild {
|
|||||||
this.pending.set(id, {
|
this.pending.set(id, {
|
||||||
method,
|
method,
|
||||||
resolve: (value) => {
|
resolve: (value) => {
|
||||||
clearTimeout(timeout);
|
NodeTimers.clearTimeout(timeout);
|
||||||
resolve(value);
|
resolve(value);
|
||||||
},
|
},
|
||||||
reject: (error) => {
|
reject: (error) => {
|
||||||
clearTimeout(timeout);
|
NodeTimers.clearTimeout(timeout);
|
||||||
reject(error);
|
reject(error);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { Effect, FileSystem, Path } from "effect";
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as FileSystem from "effect/FileSystem";
|
||||||
|
import * as Path from "effect/Path";
|
||||||
import * as Random from "effect/Random";
|
import * as Random from "effect/Random";
|
||||||
|
|
||||||
export const writeFileStringAtomically = (input: {
|
export const writeFileStringAtomically = (input: {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import path from "node:path";
|
// @effect-diagnostics nodeBuiltinImport:off
|
||||||
|
import NodePath from "node:path";
|
||||||
|
|
||||||
export const ATTACHMENTS_ROUTE_PREFIX = "/attachments";
|
export const ATTACHMENTS_ROUTE_PREFIX = "/attachments";
|
||||||
|
|
||||||
export function normalizeAttachmentRelativePath(rawRelativePath: string): string | null {
|
export function normalizeAttachmentRelativePath(rawRelativePath: string): string | null {
|
||||||
const normalized = path.normalize(rawRelativePath).replace(/^[/\\]+/, "");
|
const normalized = NodePath.normalize(rawRelativePath).replace(/^[/\\]+/, "");
|
||||||
if (normalized.length === 0 || normalized.startsWith("..") || normalized.includes("\0")) {
|
if (normalized.length === 0 || normalized.startsWith("..") || normalized.includes("\0")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -19,9 +20,9 @@ export function resolveAttachmentRelativePath(input: {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const attachmentsRoot = path.resolve(input.attachmentsDir);
|
const attachmentsRoot = NodePath.resolve(input.attachmentsDir);
|
||||||
const filePath = path.resolve(path.join(attachmentsRoot, normalizedRelativePath));
|
const filePath = NodePath.resolve(NodePath.join(attachmentsRoot, normalizedRelativePath));
|
||||||
if (!filePath.startsWith(`${attachmentsRoot}${path.sep}`)) {
|
if (!filePath.startsWith(`${attachmentsRoot}${NodePath.sep}`)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return filePath;
|
return filePath;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// @effect-diagnostics nodeBuiltinImport:off
|
||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import os from "node:os";
|
import os from "node:os";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// @effect-diagnostics nodeBuiltinImport:off
|
||||||
import { randomUUID } from "node:crypto";
|
import { randomUUID } from "node:crypto";
|
||||||
import { existsSync } from "node:fs";
|
import { existsSync } from "node:fs";
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||||
import { expect, it } from "@effect/vitest";
|
import { expect, it } from "@effect/vitest";
|
||||||
import { Effect, Layer } from "effect";
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
|
||||||
import type { ServerConfigShape } from "../../config.ts";
|
import type { ServerConfigShape } from "../../config.ts";
|
||||||
import { ServerConfig } from "../../config.ts";
|
import { ServerConfig } from "../../config.ts";
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import type { AuthClientSession, AuthPairingLink } from "@t3tools/contracts";
|
import type { AuthClientSession, AuthPairingLink } from "@t3tools/contracts";
|
||||||
import { DateTime, Effect, Layer } from "effect";
|
import * as DateTime from "effect/DateTime";
|
||||||
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
|
||||||
import { BootstrapCredentialServiceLive } from "./BootstrapCredentialService.ts";
|
import { BootstrapCredentialServiceLive } from "./BootstrapCredentialService.ts";
|
||||||
import { ServerSecretStoreLive } from "./ServerSecretStore.ts";
|
import { ServerSecretStoreLive } from "./ServerSecretStore.ts";
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||||
import { expect, it } from "@effect/vitest";
|
import { expect, it } from "@effect/vitest";
|
||||||
import { Duration, Effect, Layer } from "effect";
|
import * as Duration from "effect/Duration";
|
||||||
import { TestClock } from "effect/testing";
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
import * as TestClock from "effect/testing/TestClock";
|
||||||
|
|
||||||
import type { ServerConfigShape } from "../../config.ts";
|
import type { ServerConfigShape } from "../../config.ts";
|
||||||
import { ServerConfig } from "../../config.ts";
|
import { ServerConfig } from "../../config.ts";
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
import type { AuthPairingLink } from "@t3tools/contracts";
|
import type { AuthPairingLink } from "@t3tools/contracts";
|
||||||
import { DateTime, Duration, Effect, Layer, PubSub, Ref, Stream } from "effect";
|
import * as DateTime from "effect/DateTime";
|
||||||
import { Option } from "effect";
|
import * as Duration from "effect/Duration";
|
||||||
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
import * as PubSub from "effect/PubSub";
|
||||||
|
import * as Ref from "effect/Ref";
|
||||||
|
import * as Stream from "effect/Stream";
|
||||||
|
import * as Option from "effect/Option";
|
||||||
|
|
||||||
import { ServerConfig } from "../../config.ts";
|
import { ServerConfig } from "../../config.ts";
|
||||||
import { AuthPairingLinkRepositoryLive } from "../../persistence/Layers/AuthPairingLinks.ts";
|
import { AuthPairingLinkRepositoryLive } from "../../persistence/Layers/AuthPairingLinks.ts";
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||||
import { expect, it } from "@effect/vitest";
|
import { expect, it } from "@effect/vitest";
|
||||||
import { Effect, Layer } from "effect";
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
|
||||||
import type { ServerConfigShape } from "../../config.ts";
|
import type { ServerConfigShape } from "../../config.ts";
|
||||||
import { ServerConfig } from "../../config.ts";
|
import { ServerConfig } from "../../config.ts";
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ import {
|
|||||||
type AuthSessionState,
|
type AuthSessionState,
|
||||||
type AuthWebSocketTokenResult,
|
type AuthWebSocketTokenResult,
|
||||||
} from "@t3tools/contracts";
|
} from "@t3tools/contracts";
|
||||||
import { DateTime, Effect, Layer, Option } from "effect";
|
import * as DateTime from "effect/DateTime";
|
||||||
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
import * as Option from "effect/Option";
|
||||||
import * as HttpServerRequest from "effect/unstable/http/HttpServerRequest";
|
import * as HttpServerRequest from "effect/unstable/http/HttpServerRequest";
|
||||||
|
|
||||||
import { AuthControlPlane } from "../Services/AuthControlPlane.ts";
|
import { AuthControlPlane } from "../Services/AuthControlPlane.ts";
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||||
import { expect, it } from "@effect/vitest";
|
import { expect, it } from "@effect/vitest";
|
||||||
import { Effect, Layer } from "effect";
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
|
||||||
import type { ServerConfigShape } from "../../config.ts";
|
import type { ServerConfigShape } from "../../config.ts";
|
||||||
import { ServerConfig } from "../../config.ts";
|
import { ServerConfig } from "../../config.ts";
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import type { ServerAuthDescriptor } from "@t3tools/contracts";
|
import type { ServerAuthDescriptor } from "@t3tools/contracts";
|
||||||
import { Effect, Layer } from "effect";
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
|
||||||
import { ServerConfig } from "../../config.ts";
|
import { ServerConfig } from "../../config.ts";
|
||||||
import { ServerAuthPolicy, type ServerAuthPolicyShape } from "../Services/ServerAuthPolicy.ts";
|
import { ServerAuthPolicy, type ServerAuthPolicyShape } from "../Services/ServerAuthPolicy.ts";
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||||
import { expect, it } from "@effect/vitest";
|
import { expect, it } from "@effect/vitest";
|
||||||
import { Cause, Deferred, Effect, FileSystem, Layer, Ref } from "effect";
|
import * as Cause from "effect/Cause";
|
||||||
|
import * as Deferred from "effect/Deferred";
|
||||||
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as FileSystem from "effect/FileSystem";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
import * as Ref from "effect/Ref";
|
||||||
import * as PlatformError from "effect/PlatformError";
|
import * as PlatformError from "effect/PlatformError";
|
||||||
|
|
||||||
import { ServerConfig } from "../../config.ts";
|
import { ServerConfig } from "../../config.ts";
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
import * as Crypto from "node:crypto";
|
import * as Crypto from "node:crypto";
|
||||||
|
|
||||||
import { Effect, FileSystem, Layer, Path, Predicate } from "effect";
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as FileSystem from "effect/FileSystem";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
import * as Path from "effect/Path";
|
||||||
|
import * as Predicate from "effect/Predicate";
|
||||||
import * as PlatformError from "effect/PlatformError";
|
import * as PlatformError from "effect/PlatformError";
|
||||||
|
|
||||||
import { ServerConfig } from "../../config.ts";
|
import { ServerConfig } from "../../config.ts";
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||||
import { expect, it } from "@effect/vitest";
|
import { expect, it } from "@effect/vitest";
|
||||||
import { Duration, Effect, Layer } from "effect";
|
import * as Duration from "effect/Duration";
|
||||||
import { TestClock } from "effect/testing";
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
import * as TestClock from "effect/testing/TestClock";
|
||||||
|
|
||||||
import type { ServerConfigShape } from "../../config.ts";
|
import type { ServerConfigShape } from "../../config.ts";
|
||||||
import { ServerConfig } from "../../config.ts";
|
import { ServerConfig } from "../../config.ts";
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
import { AuthSessionId, type AuthClientMetadata, type AuthClientSession } from "@t3tools/contracts";
|
import { AuthSessionId, type AuthClientMetadata, type AuthClientSession } from "@t3tools/contracts";
|
||||||
import { Clock, DateTime, Duration, Effect, Layer, PubSub, Ref, Schema, Stream } from "effect";
|
import * as Clock from "effect/Clock";
|
||||||
import { Option } from "effect";
|
import * as DateTime from "effect/DateTime";
|
||||||
|
import * as Duration from "effect/Duration";
|
||||||
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
import * as PubSub from "effect/PubSub";
|
||||||
|
import * as Ref from "effect/Ref";
|
||||||
|
import * as Schema from "effect/Schema";
|
||||||
|
import * as Stream from "effect/Stream";
|
||||||
|
import * as Option from "effect/Option";
|
||||||
|
|
||||||
import { ServerConfig } from "../../config.ts";
|
import { ServerConfig } from "../../config.ts";
|
||||||
import { AuthSessionRepositoryLive } from "../../persistence/Layers/AuthSessions.ts";
|
import { AuthSessionRepositoryLive } from "../../persistence/Layers/AuthSessions.ts";
|
||||||
@@ -192,6 +200,7 @@ export const makeSessionCredentialService = Effect.gen(function* () {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const encodeClaims = Schema.encodeEffect(Schema.fromJsonString(SessionClaims));
|
||||||
const issue: SessionCredentialServiceShape["issue"] = (input) =>
|
const issue: SessionCredentialServiceShape["issue"] = (input) =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const sessionId = AuthSessionId.make(crypto.randomUUID());
|
const sessionId = AuthSessionId.make(crypto.randomUUID());
|
||||||
@@ -209,7 +218,13 @@ export const makeSessionCredentialService = Effect.gen(function* () {
|
|||||||
iat: issuedAt.epochMilliseconds,
|
iat: issuedAt.epochMilliseconds,
|
||||||
exp: expiresAt.epochMilliseconds,
|
exp: expiresAt.epochMilliseconds,
|
||||||
};
|
};
|
||||||
const encodedPayload = base64UrlEncode(JSON.stringify(claims));
|
|
||||||
|
const encodedPayload = yield* encodeClaims(claims).pipe(
|
||||||
|
Effect.map(base64UrlEncode),
|
||||||
|
Effect.mapError(
|
||||||
|
(cause) => new SessionCredentialError({ message: "Failed to encode claims", cause }),
|
||||||
|
),
|
||||||
|
);
|
||||||
const signature = signPayload(encodedPayload, signingSecret);
|
const signature = signPayload(encodedPayload, signingSecret);
|
||||||
const client = input?.client ?? createDefaultClientMetadata();
|
const client = input?.client ?? createDefaultClientMetadata();
|
||||||
yield* authSessions.create({
|
yield* authSessions.create({
|
||||||
@@ -297,12 +312,19 @@ export const makeSessionCredentialService = Effect.gen(function* () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const expiresAt = DateTime.make(claims.exp);
|
||||||
|
if (Option.isNone(expiresAt)) {
|
||||||
|
return yield* new SessionCredentialError({
|
||||||
|
message: "Invalid `exp` claim",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sessionId: claims.sid,
|
sessionId: claims.sid,
|
||||||
token,
|
token,
|
||||||
method: claims.method,
|
method: claims.method,
|
||||||
client: toClientMetadata(row.value.client),
|
client: toClientMetadata(row.value.client),
|
||||||
expiresAt: DateTime.makeUnsafe(claims.exp),
|
expiresAt: expiresAt.value,
|
||||||
subject: claims.sub,
|
subject: claims.sub,
|
||||||
role: claims.role,
|
role: claims.role,
|
||||||
} satisfies VerifiedSession;
|
} satisfies VerifiedSession;
|
||||||
@@ -317,6 +339,7 @@ export const makeSessionCredentialService = Effect.gen(function* () {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const encodeWsClaims = Schema.encodeEffect(Schema.fromJsonString(WebSocketClaims));
|
||||||
const issueWebSocketToken: SessionCredentialServiceShape["issueWebSocketToken"] = (
|
const issueWebSocketToken: SessionCredentialServiceShape["issueWebSocketToken"] = (
|
||||||
sessionId,
|
sessionId,
|
||||||
input,
|
input,
|
||||||
@@ -333,7 +356,12 @@ export const makeSessionCredentialService = Effect.gen(function* () {
|
|||||||
iat: issuedAt.epochMilliseconds,
|
iat: issuedAt.epochMilliseconds,
|
||||||
exp: expiresAt.epochMilliseconds,
|
exp: expiresAt.epochMilliseconds,
|
||||||
};
|
};
|
||||||
const encodedPayload = base64UrlEncode(JSON.stringify(claims));
|
const encodedPayload = yield* encodeWsClaims(claims).pipe(
|
||||||
|
Effect.map(base64UrlEncode),
|
||||||
|
Effect.mapError(
|
||||||
|
(cause) => new SessionCredentialError({ message: "Failed to encode claims", cause }),
|
||||||
|
),
|
||||||
|
);
|
||||||
const signature = signPayload(encodedPayload, signingSecret);
|
const signature = signPayload(encodedPayload, signingSecret);
|
||||||
return {
|
return {
|
||||||
token: `${encodedPayload}.${signature}`,
|
token: `${encodedPayload}.${signature}`,
|
||||||
|
|||||||
@@ -4,7 +4,11 @@ import type {
|
|||||||
AuthPairingLink,
|
AuthPairingLink,
|
||||||
AuthSessionId,
|
AuthSessionId,
|
||||||
} from "@t3tools/contracts";
|
} from "@t3tools/contracts";
|
||||||
import { Data, DateTime, Duration, Effect, Context } from "effect";
|
import * as Data from "effect/Data";
|
||||||
|
import * as DateTime from "effect/DateTime";
|
||||||
|
import * as Duration from "effect/Duration";
|
||||||
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Context from "effect/Context";
|
||||||
import type { SessionRole } from "./SessionCredentialService.ts";
|
import type { SessionRole } from "./SessionCredentialService.ts";
|
||||||
|
|
||||||
export const DEFAULT_SESSION_SUBJECT = "cli-issued-session";
|
export const DEFAULT_SESSION_SUBJECT = "cli-issued-session";
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
import type { AuthPairingLink, ServerAuthBootstrapMethod } from "@t3tools/contracts";
|
import type { AuthPairingLink, ServerAuthBootstrapMethod } from "@t3tools/contracts";
|
||||||
import { Data, DateTime, Duration, Context } from "effect";
|
import * as Data from "effect/Data";
|
||||||
import type { Effect, Stream } from "effect";
|
import * as DateTime from "effect/DateTime";
|
||||||
|
import * as Duration from "effect/Duration";
|
||||||
|
import * as Context from "effect/Context";
|
||||||
|
import type * as Effect from "effect/Effect";
|
||||||
|
import type * as Stream from "effect/Stream";
|
||||||
|
|
||||||
export type BootstrapCredentialRole = "owner" | "client";
|
export type BootstrapCredentialRole = "owner" | "client";
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,10 @@ import type {
|
|||||||
ServerAuthSessionMethod,
|
ServerAuthSessionMethod,
|
||||||
AuthWebSocketTokenResult,
|
AuthWebSocketTokenResult,
|
||||||
} from "@t3tools/contracts";
|
} from "@t3tools/contracts";
|
||||||
import { Data, DateTime, Context } from "effect";
|
import * as Data from "effect/Data";
|
||||||
import type { Effect } from "effect";
|
import * as DateTime from "effect/DateTime";
|
||||||
|
import * as Context from "effect/Context";
|
||||||
|
import type * as Effect from "effect/Effect";
|
||||||
import type * as HttpServerRequest from "effect/unstable/http/HttpServerRequest";
|
import type * as HttpServerRequest from "effect/unstable/http/HttpServerRequest";
|
||||||
import type { SessionRole } from "./SessionCredentialService.ts";
|
import type { SessionRole } from "./SessionCredentialService.ts";
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { ServerAuthDescriptor } from "@t3tools/contracts";
|
import type { ServerAuthDescriptor } from "@t3tools/contracts";
|
||||||
import { Context } from "effect";
|
import * as Context from "effect/Context";
|
||||||
import type { Effect } from "effect";
|
import type * as Effect from "effect/Effect";
|
||||||
|
|
||||||
export interface ServerAuthPolicyShape {
|
export interface ServerAuthPolicyShape {
|
||||||
readonly getDescriptor: () => Effect.Effect<ServerAuthDescriptor>;
|
readonly getDescriptor: () => Effect.Effect<ServerAuthDescriptor>;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Data, Context } from "effect";
|
import * as Data from "effect/Data";
|
||||||
import type { Effect } from "effect";
|
import * as Context from "effect/Context";
|
||||||
|
import type * as Effect from "effect/Effect";
|
||||||
|
|
||||||
export class SecretStoreError extends Data.TaggedError("SecretStoreError")<{
|
export class SecretStoreError extends Data.TaggedError("SecretStoreError")<{
|
||||||
readonly message: string;
|
readonly message: string;
|
||||||
|
|||||||
@@ -4,8 +4,12 @@ import type {
|
|||||||
AuthSessionId,
|
AuthSessionId,
|
||||||
ServerAuthSessionMethod,
|
ServerAuthSessionMethod,
|
||||||
} from "@t3tools/contracts";
|
} from "@t3tools/contracts";
|
||||||
import { Data, DateTime, Duration, Context } from "effect";
|
import * as Data from "effect/Data";
|
||||||
import type { Effect, Stream } from "effect";
|
import * as DateTime from "effect/DateTime";
|
||||||
|
import * as Duration from "effect/Duration";
|
||||||
|
import * as Context from "effect/Context";
|
||||||
|
import type * as Effect from "effect/Effect";
|
||||||
|
import type * as Stream from "effect/Stream";
|
||||||
|
|
||||||
export type SessionRole = "owner" | "client";
|
export type SessionRole = "owner" | "client";
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,15 @@ import {
|
|||||||
AuthRevokePairingLinkInput,
|
AuthRevokePairingLinkInput,
|
||||||
type AuthWebSocketTokenResult,
|
type AuthWebSocketTokenResult,
|
||||||
} from "@t3tools/contracts";
|
} from "@t3tools/contracts";
|
||||||
import { DateTime, Effect, Schema } from "effect";
|
import * as DateTime from "effect/DateTime";
|
||||||
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Schema from "effect/Schema";
|
||||||
import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
|
import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
|
||||||
|
|
||||||
import { AuthError, ServerAuth } from "./Services/ServerAuth.ts";
|
import { AuthError, ServerAuth } from "./Services/ServerAuth.ts";
|
||||||
import { SessionCredentialService } from "./Services/SessionCredentialService.ts";
|
import { SessionCredentialService } from "./Services/SessionCredentialService.ts";
|
||||||
import { deriveAuthClientMetadata } from "./utils.ts";
|
import { deriveAuthClientMetadata } from "./utils.ts";
|
||||||
|
import { browserApiCorsHeaders } from "../httpCors.ts";
|
||||||
|
|
||||||
export const respondToAuthError = (error: AuthError) =>
|
export const respondToAuthError = (error: AuthError) =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
@@ -25,7 +28,7 @@ export const respondToAuthError = (error: AuthError) =>
|
|||||||
{
|
{
|
||||||
error: error.message,
|
error: error.message,
|
||||||
},
|
},
|
||||||
{ status: error.status ?? 500 },
|
{ status: error.status ?? 500, headers: browserApiCorsHeaders },
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -36,7 +39,10 @@ export const authSessionRouteLayer = HttpRouter.add(
|
|||||||
const request = yield* HttpServerRequest.HttpServerRequest;
|
const request = yield* HttpServerRequest.HttpServerRequest;
|
||||||
const serverAuth = yield* ServerAuth;
|
const serverAuth = yield* ServerAuth;
|
||||||
const session = yield* serverAuth.getSessionState(request);
|
const session = yield* serverAuth.getSessionState(request);
|
||||||
return HttpServerResponse.jsonUnsafe(session, { status: 200 });
|
return HttpServerResponse.jsonUnsafe(session, {
|
||||||
|
status: 200,
|
||||||
|
headers: browserApiCorsHeaders,
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -79,7 +85,10 @@ export const authBootstrapRouteLayer = HttpRouter.add(
|
|||||||
deriveAuthClientMetadata({ request }),
|
deriveAuthClientMetadata({ request }),
|
||||||
);
|
);
|
||||||
|
|
||||||
return yield* HttpServerResponse.jsonUnsafe(result.response, { status: 200 }).pipe(
|
return yield* HttpServerResponse.jsonUnsafe(result.response, {
|
||||||
|
status: 200,
|
||||||
|
headers: browserApiCorsHeaders,
|
||||||
|
}).pipe(
|
||||||
HttpServerResponse.setCookie(sessions.cookieName, result.sessionToken, {
|
HttpServerResponse.setCookie(sessions.cookieName, result.sessionToken, {
|
||||||
expires: DateTime.toDate(result.response.expiresAt),
|
expires: DateTime.toDate(result.response.expiresAt),
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
@@ -112,6 +121,7 @@ export const authBearerBootstrapRouteLayer = HttpRouter.add(
|
|||||||
);
|
);
|
||||||
return HttpServerResponse.jsonUnsafe(result satisfies AuthBearerBootstrapResult, {
|
return HttpServerResponse.jsonUnsafe(result satisfies AuthBearerBootstrapResult, {
|
||||||
status: 200,
|
status: 200,
|
||||||
|
headers: browserApiCorsHeaders,
|
||||||
});
|
});
|
||||||
}).pipe(Effect.catchTag("AuthError", (error) => respondToAuthError(error))),
|
}).pipe(Effect.catchTag("AuthError", (error) => respondToAuthError(error))),
|
||||||
);
|
);
|
||||||
@@ -126,6 +136,7 @@ export const authWebSocketTokenRouteLayer = HttpRouter.add(
|
|||||||
const result = yield* serverAuth.issueWebSocketToken(session);
|
const result = yield* serverAuth.issueWebSocketToken(session);
|
||||||
return HttpServerResponse.jsonUnsafe(result satisfies AuthWebSocketTokenResult, {
|
return HttpServerResponse.jsonUnsafe(result satisfies AuthWebSocketTokenResult, {
|
||||||
status: 200,
|
status: 200,
|
||||||
|
headers: browserApiCorsHeaders,
|
||||||
});
|
});
|
||||||
}).pipe(Effect.catchTag("AuthError", (error) => respondToAuthError(error))),
|
}).pipe(Effect.catchTag("AuthError", (error) => respondToAuthError(error))),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// @effect-diagnostics-next-line nodeBuiltinImport:off - NodeHttpServer.layer takes `NodeHttp.createServer` as arg
|
||||||
import * as NodeHttp from "node:http";
|
import * as NodeHttp from "node:http";
|
||||||
import { mkdtempSync } from "node:fs";
|
import { mkdtempSync } from "node:fs";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
@@ -5,7 +6,7 @@ import { join } from "node:path";
|
|||||||
|
|
||||||
import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
|
import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
|
||||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||||
import { NetService } from "@t3tools/shared/Net";
|
import * as NetService from "@t3tools/shared/Net";
|
||||||
import { assert, it } from "@effect/vitest";
|
import { assert, it } from "@effect/vitest";
|
||||||
import * as Effect from "effect/Effect";
|
import * as Effect from "effect/Effect";
|
||||||
import * as Layer from "effect/Layer";
|
import * as Layer from "effect/Layer";
|
||||||
@@ -138,7 +139,7 @@ const withLiveProjectCliServer = <A, E, R>(baseDir: string, run: () => Effect.Ef
|
|||||||
}
|
}
|
||||||
yield* persistServerRuntimeState({
|
yield* persistServerRuntimeState({
|
||||||
path: config.serverRuntimeStatePath,
|
path: config.serverRuntimeStatePath,
|
||||||
state: makePersistedServerRuntimeState({
|
state: yield* makePersistedServerRuntimeState({
|
||||||
config,
|
config,
|
||||||
port: address.port,
|
port: address.port,
|
||||||
}),
|
}),
|
||||||
@@ -179,6 +180,7 @@ it.layer(NodeServices.layer)("bin cli parsing", (it) => {
|
|||||||
const createdOutput = yield* captureStdout(
|
const createdOutput = yield* captureStdout(
|
||||||
runCli(["auth", "pairing", "create", "--base-dir", baseDir, "--json"]),
|
runCli(["auth", "pairing", "create", "--base-dir", baseDir, "--json"]),
|
||||||
);
|
);
|
||||||
|
// @effect-diagnostics-next-line preferSchemaOverJson:off
|
||||||
const created = JSON.parse(createdOutput.output) as {
|
const created = JSON.parse(createdOutput.output) as {
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly credential: string;
|
readonly credential: string;
|
||||||
@@ -186,6 +188,7 @@ it.layer(NodeServices.layer)("bin cli parsing", (it) => {
|
|||||||
const listedOutput = yield* captureStdout(
|
const listedOutput = yield* captureStdout(
|
||||||
runCli(["auth", "pairing", "list", "--base-dir", baseDir, "--json"]),
|
runCli(["auth", "pairing", "list", "--base-dir", baseDir, "--json"]),
|
||||||
);
|
);
|
||||||
|
// @effect-diagnostics-next-line preferSchemaOverJson:off
|
||||||
const listed = JSON.parse(listedOutput.output) as ReadonlyArray<{
|
const listed = JSON.parse(listedOutput.output) as ReadonlyArray<{
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly credential?: string;
|
readonly credential?: string;
|
||||||
@@ -207,6 +210,7 @@ it.layer(NodeServices.layer)("bin cli parsing", (it) => {
|
|||||||
const issuedOutput = yield* captureStdout(
|
const issuedOutput = yield* captureStdout(
|
||||||
runCli(["auth", "session", "issue", "--base-dir", baseDir, "--json"]),
|
runCli(["auth", "session", "issue", "--base-dir", baseDir, "--json"]),
|
||||||
);
|
);
|
||||||
|
// @effect-diagnostics-next-line preferSchemaOverJson:off
|
||||||
const issued = JSON.parse(issuedOutput.output) as {
|
const issued = JSON.parse(issuedOutput.output) as {
|
||||||
readonly sessionId: string;
|
readonly sessionId: string;
|
||||||
readonly token: string;
|
readonly token: string;
|
||||||
@@ -215,6 +219,7 @@ it.layer(NodeServices.layer)("bin cli parsing", (it) => {
|
|||||||
const listedOutput = yield* captureStdout(
|
const listedOutput = yield* captureStdout(
|
||||||
runCli(["auth", "session", "list", "--base-dir", baseDir, "--json"]),
|
runCli(["auth", "session", "list", "--base-dir", baseDir, "--json"]),
|
||||||
);
|
);
|
||||||
|
// @effect-diagnostics-next-line preferSchemaOverJson:off
|
||||||
const listed = JSON.parse(listedOutput.output) as ReadonlyArray<{
|
const listed = JSON.parse(listedOutput.output) as ReadonlyArray<{
|
||||||
readonly sessionId: string;
|
readonly sessionId: string;
|
||||||
readonly token?: string;
|
readonly token?: string;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import * as Effect from "effect/Effect";
|
|||||||
import * as Layer from "effect/Layer";
|
import * as Layer from "effect/Layer";
|
||||||
import { Command } from "effect/unstable/cli";
|
import { Command } from "effect/unstable/cli";
|
||||||
|
|
||||||
import { NetService } from "@t3tools/shared/Net";
|
import * as NetService from "@t3tools/shared/Net";
|
||||||
import packageJson from "../package.json" with { type: "json" };
|
import packageJson from "../package.json" with { type: "json" };
|
||||||
import { authCommand } from "./cli/auth.ts";
|
import { authCommand } from "./cli/auth.ts";
|
||||||
import { sharedServerCommandFlags } from "./cli/config.ts";
|
import { sharedServerCommandFlags } from "./cli/config.ts";
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
|
// @effect-diagnostics nodeBuiltinImport:off
|
||||||
import * as NFS from "node:fs";
|
import * as NFS from "node:fs";
|
||||||
import * as path from "node:path";
|
import * as path from "node:path";
|
||||||
import { execFileSync, spawn } from "node:child_process";
|
import { execFileSync, spawn } from "node:child_process";
|
||||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||||
import { assert, it } from "@effect/vitest";
|
import { assert, it } from "@effect/vitest";
|
||||||
import { FileSystem, Schema } from "effect";
|
import * as FileSystem from "effect/FileSystem";
|
||||||
|
import * as Schema from "effect/Schema";
|
||||||
import * as Duration from "effect/Duration";
|
import * as Duration from "effect/Duration";
|
||||||
import * as Effect from "effect/Effect";
|
import * as Effect from "effect/Effect";
|
||||||
import * as Fiber from "effect/Fiber";
|
import * as Fiber from "effect/Fiber";
|
||||||
import { TestClock } from "effect/testing";
|
import * as TestClock from "effect/testing/TestClock";
|
||||||
import { vi } from "vitest";
|
import { vi } from "vitest";
|
||||||
|
|
||||||
import { readBootstrapEnvelope, resolveFdPath } from "./bootstrap.ts";
|
import { readBootstrapEnvelope, resolveFdPath } from "./bootstrap.ts";
|
||||||
@@ -36,6 +38,7 @@ vi.mock("node:fs", async (importOriginal) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const TestEnvelopeSchema = Schema.Struct({ mode: Schema.String });
|
const TestEnvelopeSchema = Schema.Struct({ mode: Schema.String });
|
||||||
|
const encodeTestEnvelopeSchema = Schema.encodeEffect(Schema.fromJsonString(TestEnvelopeSchema));
|
||||||
|
|
||||||
it.layer(NodeServices.layer)("readBootstrapEnvelope", (it) => {
|
it.layer(NodeServices.layer)("readBootstrapEnvelope", (it) => {
|
||||||
it.effect("uses platform-specific fd paths", () =>
|
it.effect("uses platform-specific fd paths", () =>
|
||||||
@@ -53,9 +56,7 @@ it.layer(NodeServices.layer)("readBootstrapEnvelope", (it) => {
|
|||||||
|
|
||||||
yield* fs.writeFileString(
|
yield* fs.writeFileString(
|
||||||
filePath,
|
filePath,
|
||||||
`${yield* Schema.encodeEffect(Schema.fromJsonString(TestEnvelopeSchema))({
|
`${yield* encodeTestEnvelopeSchema({ mode: "desktop" })}\n`,
|
||||||
mode: "desktop",
|
|
||||||
})}\n`,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const fd = yield* Effect.acquireRelease(
|
const fd = yield* Effect.acquireRelease(
|
||||||
@@ -77,9 +78,7 @@ it.layer(NodeServices.layer)("readBootstrapEnvelope", (it) => {
|
|||||||
|
|
||||||
yield* fs.writeFileString(
|
yield* fs.writeFileString(
|
||||||
filePath,
|
filePath,
|
||||||
`${yield* Schema.encodeEffect(Schema.fromJsonString(TestEnvelopeSchema))({
|
`${yield* encodeTestEnvelopeSchema({ mode: "desktop" })}\n`,
|
||||||
mode: "desktop",
|
|
||||||
})}\n`,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Open without acquireRelease: the direct-stream fallback uses autoClose: true,
|
// Open without acquireRelease: the direct-stream fallback uses autoClose: true,
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
|
// @effect-diagnostics nodeBuiltinImport:off
|
||||||
import * as NFS from "node:fs";
|
import * as NFS from "node:fs";
|
||||||
import * as Net from "node:net";
|
import * as Net from "node:net";
|
||||||
import * as readline from "node:readline";
|
import * as readline from "node:readline";
|
||||||
import type { Readable } from "node:stream";
|
import type { Readable } from "node:stream";
|
||||||
|
|
||||||
import { Data, Effect, Option, Predicate, Result, Schema } from "effect";
|
import * as Data from "effect/Data";
|
||||||
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Option from "effect/Option";
|
||||||
|
import * as Predicate from "effect/Predicate";
|
||||||
|
import * as Result from "effect/Result";
|
||||||
|
import * as Schema from "effect/Schema";
|
||||||
import { decodeJsonResult } from "@t3tools/shared/schemaJson";
|
import { decodeJsonResult } from "@t3tools/shared/schemaJson";
|
||||||
|
|
||||||
class BootstrapError extends Data.TaggedError("BootstrapError")<{
|
class BootstrapError extends Data.TaggedError("BootstrapError")<{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Schema } from "effect";
|
import * as Schema from "effect/Schema";
|
||||||
import type { ProjectionRepositoryError } from "../persistence/Errors.ts";
|
import type { ProjectionRepositoryError } from "../persistence/Errors.ts";
|
||||||
import type { VcsError } from "@t3tools/contracts";
|
import type { VcsError } from "@t3tools/contracts";
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { CheckpointRef, ProjectId, ThreadId, TurnId } from "@t3tools/contracts";
|
import { CheckpointRef, ProjectId, ThreadId, TurnId } from "@t3tools/contracts";
|
||||||
import { Effect, Layer, Option } from "effect";
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
import * as Option from "effect/Option";
|
||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -39,11 +41,110 @@ function makeThreadCheckpointContext(input: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe("CheckpointDiffQueryLive", () => {
|
describe("CheckpointDiffQueryLive", () => {
|
||||||
|
it("uses the narrow full-thread context lookup for all-turns diffs", async () => {
|
||||||
|
const projectId = ProjectId.make("project-full-thread");
|
||||||
|
const threadId = ThreadId.make("thread-full-thread");
|
||||||
|
const toCheckpointRef = checkpointRefForThreadTurn(threadId, 4);
|
||||||
|
let getThreadCheckpointContextCalls = 0;
|
||||||
|
let getFullThreadDiffContextCalls = 0;
|
||||||
|
const diffCheckpointsCalls: Array<{
|
||||||
|
readonly fromCheckpointRef: CheckpointRef;
|
||||||
|
readonly toCheckpointRef: CheckpointRef;
|
||||||
|
readonly cwd: string;
|
||||||
|
readonly ignoreWhitespace: boolean;
|
||||||
|
}> = [];
|
||||||
|
|
||||||
|
const checkpointStore: CheckpointStoreShape = {
|
||||||
|
isGitRepository: () => Effect.succeed(true),
|
||||||
|
captureCheckpoint: () => Effect.void,
|
||||||
|
hasCheckpointRef: () => Effect.succeed(true),
|
||||||
|
restoreCheckpoint: () => Effect.succeed(true),
|
||||||
|
diffCheckpoints: ({ fromCheckpointRef, toCheckpointRef, cwd, ignoreWhitespace }) =>
|
||||||
|
Effect.sync(() => {
|
||||||
|
diffCheckpointsCalls.push({
|
||||||
|
fromCheckpointRef,
|
||||||
|
toCheckpointRef,
|
||||||
|
cwd,
|
||||||
|
ignoreWhitespace,
|
||||||
|
});
|
||||||
|
return "full thread diff patch";
|
||||||
|
}),
|
||||||
|
deleteCheckpointRefs: () => Effect.void,
|
||||||
|
};
|
||||||
|
|
||||||
|
const layer = CheckpointDiffQueryLive.pipe(
|
||||||
|
Layer.provideMerge(Layer.succeed(CheckpointStore, checkpointStore)),
|
||||||
|
Layer.provideMerge(
|
||||||
|
Layer.succeed(ProjectionSnapshotQuery, {
|
||||||
|
getCommandReadModel: () =>
|
||||||
|
Effect.die("CheckpointDiffQuery should not request the command read model"),
|
||||||
|
getSnapshot: () =>
|
||||||
|
Effect.die("CheckpointDiffQuery should not request the full orchestration snapshot"),
|
||||||
|
getShellSnapshot: () =>
|
||||||
|
Effect.die("CheckpointDiffQuery should not request the orchestration shell snapshot"),
|
||||||
|
getArchivedShellSnapshot: () =>
|
||||||
|
Effect.die("CheckpointDiffQuery should not request archived shell snapshots"),
|
||||||
|
getSnapshotSequence: () => Effect.succeed({ snapshotSequence: 0 }),
|
||||||
|
getCounts: () => Effect.succeed({ projectCount: 0, threadCount: 0 }),
|
||||||
|
getActiveProjectByWorkspaceRoot: () => Effect.succeed(Option.none()),
|
||||||
|
getProjectShellById: () => Effect.succeed(Option.none()),
|
||||||
|
getFirstActiveThreadIdByProjectId: () => Effect.succeed(Option.none()),
|
||||||
|
getThreadCheckpointContext: () =>
|
||||||
|
Effect.sync(() => {
|
||||||
|
getThreadCheckpointContextCalls += 1;
|
||||||
|
return Option.none();
|
||||||
|
}),
|
||||||
|
getFullThreadDiffContext: () =>
|
||||||
|
Effect.sync(() => {
|
||||||
|
getFullThreadDiffContextCalls += 1;
|
||||||
|
return Option.some({
|
||||||
|
threadId,
|
||||||
|
projectId,
|
||||||
|
workspaceRoot: "/tmp/workspace",
|
||||||
|
worktreePath: "/tmp/worktree",
|
||||||
|
latestCheckpointTurnCount: 4,
|
||||||
|
toCheckpointRef,
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
getThreadShellById: () => Effect.succeed(Option.none()),
|
||||||
|
getThreadDetailById: () => Effect.succeed(Option.none()),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
const result = await Effect.runPromise(
|
||||||
|
Effect.gen(function* () {
|
||||||
|
const query = yield* CheckpointDiffQuery;
|
||||||
|
return yield* query.getFullThreadDiff({
|
||||||
|
threadId,
|
||||||
|
toTurnCount: 4,
|
||||||
|
ignoreWhitespace: true,
|
||||||
|
});
|
||||||
|
}).pipe(Effect.provide(layer)),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(getThreadCheckpointContextCalls).toBe(0);
|
||||||
|
expect(getFullThreadDiffContextCalls).toBe(1);
|
||||||
|
expect(diffCheckpointsCalls).toEqual([
|
||||||
|
{
|
||||||
|
cwd: "/tmp/worktree",
|
||||||
|
fromCheckpointRef: checkpointRefForThreadTurn(threadId, 0),
|
||||||
|
toCheckpointRef,
|
||||||
|
ignoreWhitespace: true,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
expect(result).toEqual({
|
||||||
|
threadId,
|
||||||
|
fromTurnCount: 0,
|
||||||
|
toTurnCount: 4,
|
||||||
|
diff: "full thread diff patch",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("computes diffs using canonical turn-0 checkpoint refs", async () => {
|
it("computes diffs using canonical turn-0 checkpoint refs", async () => {
|
||||||
const projectId = ProjectId.make("project-1");
|
const projectId = ProjectId.make("project-1");
|
||||||
const threadId = ThreadId.make("thread-1");
|
const threadId = ThreadId.make("thread-1");
|
||||||
const toCheckpointRef = checkpointRefForThreadTurn(threadId, 1);
|
const toCheckpointRef = checkpointRefForThreadTurn(threadId, 1);
|
||||||
const hasCheckpointRefCalls: Array<CheckpointRef> = [];
|
|
||||||
const diffCheckpointsCalls: Array<{
|
const diffCheckpointsCalls: Array<{
|
||||||
readonly fromCheckpointRef: CheckpointRef;
|
readonly fromCheckpointRef: CheckpointRef;
|
||||||
readonly toCheckpointRef: CheckpointRef;
|
readonly toCheckpointRef: CheckpointRef;
|
||||||
@@ -63,11 +164,7 @@ describe("CheckpointDiffQueryLive", () => {
|
|||||||
const checkpointStore: CheckpointStoreShape = {
|
const checkpointStore: CheckpointStoreShape = {
|
||||||
isGitRepository: () => Effect.succeed(true),
|
isGitRepository: () => Effect.succeed(true),
|
||||||
captureCheckpoint: () => Effect.void,
|
captureCheckpoint: () => Effect.void,
|
||||||
hasCheckpointRef: ({ checkpointRef }) =>
|
hasCheckpointRef: () => Effect.succeed(true),
|
||||||
Effect.sync(() => {
|
|
||||||
hasCheckpointRefCalls.push(checkpointRef);
|
|
||||||
return true;
|
|
||||||
}),
|
|
||||||
restoreCheckpoint: () => Effect.succeed(true),
|
restoreCheckpoint: () => Effect.succeed(true),
|
||||||
diffCheckpoints: ({ fromCheckpointRef, toCheckpointRef, cwd, ignoreWhitespace }) =>
|
diffCheckpoints: ({ fromCheckpointRef, toCheckpointRef, cwd, ignoreWhitespace }) =>
|
||||||
Effect.sync(() => {
|
Effect.sync(() => {
|
||||||
@@ -92,12 +189,15 @@ describe("CheckpointDiffQueryLive", () => {
|
|||||||
Effect.die("CheckpointDiffQuery should not request the full orchestration snapshot"),
|
Effect.die("CheckpointDiffQuery should not request the full orchestration snapshot"),
|
||||||
getShellSnapshot: () =>
|
getShellSnapshot: () =>
|
||||||
Effect.die("CheckpointDiffQuery should not request the orchestration shell snapshot"),
|
Effect.die("CheckpointDiffQuery should not request the orchestration shell snapshot"),
|
||||||
|
getArchivedShellSnapshot: () =>
|
||||||
|
Effect.die("CheckpointDiffQuery should not request archived shell snapshots"),
|
||||||
getSnapshotSequence: () => Effect.succeed({ snapshotSequence: 0 }),
|
getSnapshotSequence: () => Effect.succeed({ snapshotSequence: 0 }),
|
||||||
getCounts: () => Effect.succeed({ projectCount: 0, threadCount: 0 }),
|
getCounts: () => Effect.succeed({ projectCount: 0, threadCount: 0 }),
|
||||||
getActiveProjectByWorkspaceRoot: () => Effect.succeed(Option.none()),
|
getActiveProjectByWorkspaceRoot: () => Effect.succeed(Option.none()),
|
||||||
getProjectShellById: () => Effect.succeed(Option.none()),
|
getProjectShellById: () => Effect.succeed(Option.none()),
|
||||||
getFirstActiveThreadIdByProjectId: () => Effect.succeed(Option.none()),
|
getFirstActiveThreadIdByProjectId: () => Effect.succeed(Option.none()),
|
||||||
getThreadCheckpointContext: () => Effect.succeed(Option.some(threadCheckpointContext)),
|
getThreadCheckpointContext: () => Effect.succeed(Option.some(threadCheckpointContext)),
|
||||||
|
getFullThreadDiffContext: () => Effect.die("unused"),
|
||||||
getThreadShellById: () => Effect.succeed(Option.none()),
|
getThreadShellById: () => Effect.succeed(Option.none()),
|
||||||
getThreadDetailById: () => Effect.succeed(Option.none()),
|
getThreadDetailById: () => Effect.succeed(Option.none()),
|
||||||
}),
|
}),
|
||||||
@@ -117,7 +217,6 @@ describe("CheckpointDiffQueryLive", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const expectedFromRef = checkpointRefForThreadTurn(threadId, 0);
|
const expectedFromRef = checkpointRefForThreadTurn(threadId, 0);
|
||||||
expect(hasCheckpointRefCalls).toEqual([expectedFromRef, toCheckpointRef]);
|
|
||||||
expect(diffCheckpointsCalls).toEqual([
|
expect(diffCheckpointsCalls).toEqual([
|
||||||
{
|
{
|
||||||
cwd: "/tmp/workspace",
|
cwd: "/tmp/workspace",
|
||||||
@@ -172,12 +271,15 @@ describe("CheckpointDiffQueryLive", () => {
|
|||||||
Effect.die("CheckpointDiffQuery should not request the full orchestration snapshot"),
|
Effect.die("CheckpointDiffQuery should not request the full orchestration snapshot"),
|
||||||
getShellSnapshot: () =>
|
getShellSnapshot: () =>
|
||||||
Effect.die("CheckpointDiffQuery should not request the orchestration shell snapshot"),
|
Effect.die("CheckpointDiffQuery should not request the orchestration shell snapshot"),
|
||||||
|
getArchivedShellSnapshot: () =>
|
||||||
|
Effect.die("CheckpointDiffQuery should not request archived shell snapshots"),
|
||||||
getSnapshotSequence: () => Effect.succeed({ snapshotSequence: 0 }),
|
getSnapshotSequence: () => Effect.succeed({ snapshotSequence: 0 }),
|
||||||
getCounts: () => Effect.succeed({ projectCount: 0, threadCount: 0 }),
|
getCounts: () => Effect.succeed({ projectCount: 0, threadCount: 0 }),
|
||||||
getActiveProjectByWorkspaceRoot: () => Effect.succeed(Option.none()),
|
getActiveProjectByWorkspaceRoot: () => Effect.succeed(Option.none()),
|
||||||
getProjectShellById: () => Effect.succeed(Option.none()),
|
getProjectShellById: () => Effect.succeed(Option.none()),
|
||||||
getFirstActiveThreadIdByProjectId: () => Effect.succeed(Option.none()),
|
getFirstActiveThreadIdByProjectId: () => Effect.succeed(Option.none()),
|
||||||
getThreadCheckpointContext: () => Effect.succeed(Option.some(threadCheckpointContext)),
|
getThreadCheckpointContext: () => Effect.succeed(Option.some(threadCheckpointContext)),
|
||||||
|
getFullThreadDiffContext: () => Effect.die("unused"),
|
||||||
getThreadShellById: () => Effect.succeed(Option.none()),
|
getThreadShellById: () => Effect.succeed(Option.none()),
|
||||||
getThreadDetailById: () => Effect.succeed(Option.none()),
|
getThreadDetailById: () => Effect.succeed(Option.none()),
|
||||||
}),
|
}),
|
||||||
@@ -198,6 +300,74 @@ describe("CheckpointDiffQueryLive", () => {
|
|||||||
expect(diffCheckpointsCalls).toEqual([{ ignoreWhitespace: true }]);
|
expect(diffCheckpointsCalls).toEqual([{ ignoreWhitespace: true }]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("does not preflight checkpoint refs before diffing", async () => {
|
||||||
|
const projectId = ProjectId.make("project-no-preflight");
|
||||||
|
const threadId = ThreadId.make("thread-no-preflight");
|
||||||
|
const toCheckpointRef = checkpointRefForThreadTurn(threadId, 1);
|
||||||
|
let hasCheckpointRefCallCount = 0;
|
||||||
|
|
||||||
|
const threadCheckpointContext = makeThreadCheckpointContext({
|
||||||
|
projectId,
|
||||||
|
threadId,
|
||||||
|
workspaceRoot: "/tmp/workspace",
|
||||||
|
worktreePath: null,
|
||||||
|
checkpointTurnCount: 1,
|
||||||
|
checkpointRef: toCheckpointRef,
|
||||||
|
});
|
||||||
|
|
||||||
|
const checkpointStore: CheckpointStoreShape = {
|
||||||
|
isGitRepository: () => Effect.succeed(true),
|
||||||
|
captureCheckpoint: () => Effect.void,
|
||||||
|
hasCheckpointRef: () =>
|
||||||
|
Effect.sync(() => {
|
||||||
|
hasCheckpointRefCallCount += 1;
|
||||||
|
return true;
|
||||||
|
}),
|
||||||
|
restoreCheckpoint: () => Effect.succeed(true),
|
||||||
|
diffCheckpoints: () => Effect.succeed("diff patch"),
|
||||||
|
deleteCheckpointRefs: () => Effect.void,
|
||||||
|
};
|
||||||
|
|
||||||
|
const layer = CheckpointDiffQueryLive.pipe(
|
||||||
|
Layer.provideMerge(Layer.succeed(CheckpointStore, checkpointStore)),
|
||||||
|
Layer.provideMerge(
|
||||||
|
Layer.succeed(ProjectionSnapshotQuery, {
|
||||||
|
getCommandReadModel: () =>
|
||||||
|
Effect.die("CheckpointDiffQuery should not request the command read model"),
|
||||||
|
getSnapshot: () =>
|
||||||
|
Effect.die("CheckpointDiffQuery should not request the full orchestration snapshot"),
|
||||||
|
getShellSnapshot: () =>
|
||||||
|
Effect.die("CheckpointDiffQuery should not request the orchestration shell snapshot"),
|
||||||
|
getArchivedShellSnapshot: () =>
|
||||||
|
Effect.die("CheckpointDiffQuery should not request archived shell snapshots"),
|
||||||
|
getSnapshotSequence: () => Effect.succeed({ snapshotSequence: 0 }),
|
||||||
|
getCounts: () => Effect.succeed({ projectCount: 0, threadCount: 0 }),
|
||||||
|
getActiveProjectByWorkspaceRoot: () => Effect.succeed(Option.none()),
|
||||||
|
getProjectShellById: () => Effect.succeed(Option.none()),
|
||||||
|
getFirstActiveThreadIdByProjectId: () => Effect.succeed(Option.none()),
|
||||||
|
getThreadCheckpointContext: () => Effect.succeed(Option.some(threadCheckpointContext)),
|
||||||
|
getFullThreadDiffContext: () => Effect.die("unused"),
|
||||||
|
getThreadShellById: () => Effect.succeed(Option.none()),
|
||||||
|
getThreadDetailById: () => Effect.succeed(Option.none()),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
await Effect.runPromise(
|
||||||
|
Effect.gen(function* () {
|
||||||
|
const query = yield* CheckpointDiffQuery;
|
||||||
|
return yield* query.getTurnDiff({
|
||||||
|
threadId,
|
||||||
|
fromTurnCount: 0,
|
||||||
|
toTurnCount: 1,
|
||||||
|
ignoreWhitespace: true,
|
||||||
|
});
|
||||||
|
}).pipe(Effect.provide(layer)),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(hasCheckpointRefCallCount).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
it("fails when the thread is missing from the snapshot", async () => {
|
it("fails when the thread is missing from the snapshot", async () => {
|
||||||
const threadId = ThreadId.make("thread-missing");
|
const threadId = ThreadId.make("thread-missing");
|
||||||
|
|
||||||
@@ -220,12 +390,15 @@ describe("CheckpointDiffQueryLive", () => {
|
|||||||
Effect.die("CheckpointDiffQuery should not request the full orchestration snapshot"),
|
Effect.die("CheckpointDiffQuery should not request the full orchestration snapshot"),
|
||||||
getShellSnapshot: () =>
|
getShellSnapshot: () =>
|
||||||
Effect.die("CheckpointDiffQuery should not request the orchestration shell snapshot"),
|
Effect.die("CheckpointDiffQuery should not request the orchestration shell snapshot"),
|
||||||
|
getArchivedShellSnapshot: () =>
|
||||||
|
Effect.die("CheckpointDiffQuery should not request archived shell snapshots"),
|
||||||
getSnapshotSequence: () => Effect.succeed({ snapshotSequence: 0 }),
|
getSnapshotSequence: () => Effect.succeed({ snapshotSequence: 0 }),
|
||||||
getCounts: () => Effect.succeed({ projectCount: 0, threadCount: 0 }),
|
getCounts: () => Effect.succeed({ projectCount: 0, threadCount: 0 }),
|
||||||
getActiveProjectByWorkspaceRoot: () => Effect.succeed(Option.none()),
|
getActiveProjectByWorkspaceRoot: () => Effect.succeed(Option.none()),
|
||||||
getProjectShellById: () => Effect.succeed(Option.none()),
|
getProjectShellById: () => Effect.succeed(Option.none()),
|
||||||
getFirstActiveThreadIdByProjectId: () => Effect.succeed(Option.none()),
|
getFirstActiveThreadIdByProjectId: () => Effect.succeed(Option.none()),
|
||||||
getThreadCheckpointContext: () => Effect.succeed(Option.none()),
|
getThreadCheckpointContext: () => Effect.succeed(Option.none()),
|
||||||
|
getFullThreadDiffContext: () => Effect.succeed(Option.none()),
|
||||||
getThreadShellById: () => Effect.succeed(Option.none()),
|
getThreadShellById: () => Effect.succeed(Option.none()),
|
||||||
getThreadDetailById: () => Effect.succeed(Option.none()),
|
getThreadDetailById: () => Effect.succeed(Option.none()),
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
import {
|
import {
|
||||||
|
type CheckpointRef,
|
||||||
OrchestrationGetTurnDiffResult,
|
OrchestrationGetTurnDiffResult,
|
||||||
type OrchestrationGetFullThreadDiffInput,
|
type ThreadId,
|
||||||
type OrchestrationGetFullThreadDiffResult,
|
type OrchestrationGetFullThreadDiffResult,
|
||||||
type OrchestrationGetTurnDiffResult as OrchestrationGetTurnDiffResultType,
|
type OrchestrationGetTurnDiffResult as OrchestrationGetTurnDiffResultType,
|
||||||
} from "@t3tools/contracts";
|
} from "@t3tools/contracts";
|
||||||
import { Effect, Layer, Option, Schema } from "effect";
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
import * as Option from "effect/Option";
|
||||||
|
import * as Schema from "effect/Schema";
|
||||||
|
|
||||||
import { ProjectionSnapshotQuery } from "../../orchestration/Services/ProjectionSnapshotQuery.ts";
|
import { ProjectionSnapshotQuery } from "../../orchestration/Services/ProjectionSnapshotQuery.ts";
|
||||||
import { CheckpointInvariantError, CheckpointUnavailableError } from "../Errors.ts";
|
import { CheckpointInvariantError, CheckpointUnavailableError } from "../Errors.ts";
|
||||||
@@ -17,6 +21,22 @@ import {
|
|||||||
|
|
||||||
const isTurnDiffResult = Schema.is(OrchestrationGetTurnDiffResult);
|
const isTurnDiffResult = Schema.is(OrchestrationGetTurnDiffResult);
|
||||||
|
|
||||||
|
function buildTurnDiffResult(
|
||||||
|
input: {
|
||||||
|
readonly threadId: ThreadId;
|
||||||
|
readonly fromTurnCount: number;
|
||||||
|
readonly toTurnCount: number;
|
||||||
|
},
|
||||||
|
diff: string,
|
||||||
|
): OrchestrationGetTurnDiffResultType {
|
||||||
|
return {
|
||||||
|
threadId: input.threadId,
|
||||||
|
fromTurnCount: input.fromTurnCount,
|
||||||
|
toTurnCount: input.toTurnCount,
|
||||||
|
diff,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const make = Effect.gen(function* () {
|
const make = Effect.gen(function* () {
|
||||||
const projectionSnapshotQuery = yield* ProjectionSnapshotQuery;
|
const projectionSnapshotQuery = yield* ProjectionSnapshotQuery;
|
||||||
const checkpointStore = yield* CheckpointStore;
|
const checkpointStore = yield* CheckpointStore;
|
||||||
@@ -25,6 +45,12 @@ const make = Effect.gen(function* () {
|
|||||||
function* (input) {
|
function* (input) {
|
||||||
const operation = "CheckpointDiffQuery.getTurnDiff";
|
const operation = "CheckpointDiffQuery.getTurnDiff";
|
||||||
const ignoreWhitespace = input.ignoreWhitespace ?? true;
|
const ignoreWhitespace = input.ignoreWhitespace ?? true;
|
||||||
|
yield* Effect.annotateCurrentSpan({
|
||||||
|
"checkpoint.thread_id": input.threadId,
|
||||||
|
"checkpoint.from_turn_count": input.fromTurnCount,
|
||||||
|
"checkpoint.to_turn_count": input.toTurnCount,
|
||||||
|
"checkpoint.ignore_whitespace": ignoreWhitespace,
|
||||||
|
});
|
||||||
|
|
||||||
if (input.fromTurnCount === input.toTurnCount) {
|
if (input.fromTurnCount === input.toTurnCount) {
|
||||||
const emptyDiff: OrchestrationGetTurnDiffResultType = {
|
const emptyDiff: OrchestrationGetTurnDiffResultType = {
|
||||||
@@ -42,9 +68,9 @@ const make = Effect.gen(function* () {
|
|||||||
return emptyDiff;
|
return emptyDiff;
|
||||||
}
|
}
|
||||||
|
|
||||||
const threadContext = yield* projectionSnapshotQuery.getThreadCheckpointContext(
|
const threadContext = yield* projectionSnapshotQuery
|
||||||
input.threadId,
|
.getThreadCheckpointContext(input.threadId)
|
||||||
);
|
.pipe(Effect.withSpan("checkpoint.turnDiff.lookupContext"));
|
||||||
if (Option.isNone(threadContext)) {
|
if (Option.isNone(threadContext)) {
|
||||||
return yield* new CheckpointInvariantError({
|
return yield* new CheckpointInvariantError({
|
||||||
operation,
|
operation,
|
||||||
@@ -97,50 +123,17 @@ const make = Effect.gen(function* () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const [fromExists, toExists] = yield* Effect.all(
|
const diff = yield* checkpointStore
|
||||||
[
|
.diffCheckpoints({
|
||||||
checkpointStore.hasCheckpointRef({
|
cwd: workspaceCwd,
|
||||||
cwd: workspaceCwd,
|
fromCheckpointRef,
|
||||||
checkpointRef: fromCheckpointRef,
|
toCheckpointRef,
|
||||||
}),
|
fallbackFromToHead: false,
|
||||||
checkpointStore.hasCheckpointRef({
|
ignoreWhitespace,
|
||||||
cwd: workspaceCwd,
|
})
|
||||||
checkpointRef: toCheckpointRef,
|
.pipe(Effect.withSpan("checkpoint.turnDiff.diffCheckpoints"));
|
||||||
}),
|
|
||||||
],
|
|
||||||
{ concurrency: "unbounded" },
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!fromExists) {
|
const turnDiff = buildTurnDiffResult(input, diff);
|
||||||
return yield* new CheckpointUnavailableError({
|
|
||||||
threadId: input.threadId,
|
|
||||||
turnCount: input.fromTurnCount,
|
|
||||||
detail: `Filesystem checkpoint is unavailable for turn ${input.fromTurnCount}.`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!toExists) {
|
|
||||||
return yield* new CheckpointUnavailableError({
|
|
||||||
threadId: input.threadId,
|
|
||||||
turnCount: input.toTurnCount,
|
|
||||||
detail: `Filesystem checkpoint is unavailable for turn ${input.toTurnCount}.`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const diff = yield* checkpointStore.diffCheckpoints({
|
|
||||||
cwd: workspaceCwd,
|
|
||||||
fromCheckpointRef,
|
|
||||||
toCheckpointRef,
|
|
||||||
fallbackFromToHead: false,
|
|
||||||
ignoreWhitespace,
|
|
||||||
});
|
|
||||||
|
|
||||||
const turnDiff: OrchestrationGetTurnDiffResultType = {
|
|
||||||
threadId: input.threadId,
|
|
||||||
fromTurnCount: input.fromTurnCount,
|
|
||||||
toTurnCount: input.toTurnCount,
|
|
||||||
diff,
|
|
||||||
};
|
|
||||||
if (!isTurnDiffResult(turnDiff)) {
|
if (!isTurnDiffResult(turnDiff)) {
|
||||||
return yield* new CheckpointInvariantError({
|
return yield* new CheckpointInvariantError({
|
||||||
operation,
|
operation,
|
||||||
@@ -152,15 +145,99 @@ const make = Effect.gen(function* () {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const getFullThreadDiff: CheckpointDiffQueryShape["getFullThreadDiff"] = (
|
const getFullThreadDiff: CheckpointDiffQueryShape["getFullThreadDiff"] = Effect.fn(
|
||||||
input: OrchestrationGetFullThreadDiffInput,
|
"CheckpointDiffQuery.getFullThreadDiff",
|
||||||
) =>
|
)(function* (input) {
|
||||||
getTurnDiff({
|
const operation = "CheckpointDiffQuery.getFullThreadDiff";
|
||||||
threadId: input.threadId,
|
const ignoreWhitespace = input.ignoreWhitespace ?? true;
|
||||||
fromTurnCount: 0,
|
yield* Effect.annotateCurrentSpan({
|
||||||
toTurnCount: input.toTurnCount,
|
"checkpoint.thread_id": input.threadId,
|
||||||
ignoreWhitespace: input.ignoreWhitespace ?? true,
|
"checkpoint.from_turn_count": 0,
|
||||||
}).pipe(Effect.map((result): OrchestrationGetFullThreadDiffResult => result));
|
"checkpoint.to_turn_count": input.toTurnCount,
|
||||||
|
"checkpoint.ignore_whitespace": ignoreWhitespace,
|
||||||
|
"checkpoint.diff_kind": "full-thread",
|
||||||
|
});
|
||||||
|
|
||||||
|
if (input.toTurnCount === 0) {
|
||||||
|
const emptyDiff = buildTurnDiffResult(
|
||||||
|
{
|
||||||
|
threadId: input.threadId,
|
||||||
|
fromTurnCount: 0,
|
||||||
|
toTurnCount: 0,
|
||||||
|
},
|
||||||
|
"",
|
||||||
|
);
|
||||||
|
if (!isTurnDiffResult(emptyDiff)) {
|
||||||
|
return yield* new CheckpointInvariantError({
|
||||||
|
operation,
|
||||||
|
detail: "Computed full thread diff result does not satisfy contract schema.",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return emptyDiff satisfies OrchestrationGetFullThreadDiffResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
const threadContext = yield* projectionSnapshotQuery
|
||||||
|
.getFullThreadDiffContext(input.threadId, input.toTurnCount)
|
||||||
|
.pipe(Effect.withSpan("checkpoint.fullThread.lookupContext"));
|
||||||
|
|
||||||
|
if (Option.isNone(threadContext)) {
|
||||||
|
return yield* new CheckpointInvariantError({
|
||||||
|
operation,
|
||||||
|
detail: `Thread '${input.threadId}' not found.`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.toTurnCount > threadContext.value.latestCheckpointTurnCount) {
|
||||||
|
return yield* new CheckpointUnavailableError({
|
||||||
|
threadId: input.threadId,
|
||||||
|
turnCount: input.toTurnCount,
|
||||||
|
detail: `Turn diff range exceeds current turn count: requested ${input.toTurnCount}, current ${threadContext.value.latestCheckpointTurnCount}.`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const workspaceCwd = threadContext.value.worktreePath ?? threadContext.value.workspaceRoot;
|
||||||
|
if (!workspaceCwd) {
|
||||||
|
return yield* new CheckpointInvariantError({
|
||||||
|
operation,
|
||||||
|
detail: `Workspace path missing for thread '${input.threadId}' when computing full thread diff.`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!threadContext.value.toCheckpointRef) {
|
||||||
|
return yield* new CheckpointUnavailableError({
|
||||||
|
threadId: input.threadId,
|
||||||
|
turnCount: input.toTurnCount,
|
||||||
|
detail: `Checkpoint ref is unavailable for turn ${input.toTurnCount}.`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const diff = yield* checkpointStore
|
||||||
|
.diffCheckpoints({
|
||||||
|
cwd: workspaceCwd,
|
||||||
|
fromCheckpointRef: checkpointRefForThreadTurn(input.threadId, 0),
|
||||||
|
toCheckpointRef: threadContext.value.toCheckpointRef as CheckpointRef,
|
||||||
|
fallbackFromToHead: false,
|
||||||
|
ignoreWhitespace,
|
||||||
|
})
|
||||||
|
.pipe(Effect.withSpan("checkpoint.fullThread.diffCheckpoints"));
|
||||||
|
|
||||||
|
const turnDiff = buildTurnDiffResult(
|
||||||
|
{
|
||||||
|
threadId: input.threadId,
|
||||||
|
fromTurnCount: 0,
|
||||||
|
toTurnCount: input.toTurnCount,
|
||||||
|
},
|
||||||
|
diff,
|
||||||
|
);
|
||||||
|
if (!isTurnDiffResult(turnDiff)) {
|
||||||
|
return yield* new CheckpointInvariantError({
|
||||||
|
operation,
|
||||||
|
detail: "Computed full thread diff result does not satisfy contract schema.",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return turnDiff satisfies OrchestrationGetFullThreadDiffResult;
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getTurnDiff,
|
getTurnDiff,
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
|
// @effect-diagnostics nodeBuiltinImport:off
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
|
||||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||||
import { it } from "@effect/vitest";
|
import { it } from "@effect/vitest";
|
||||||
import { Effect, FileSystem, Layer, PlatformError, Scope } from "effect";
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as FileSystem from "effect/FileSystem";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
import * as PlatformError from "effect/PlatformError";
|
||||||
|
import * as Scope from "effect/Scope";
|
||||||
import { describe, expect } from "vitest";
|
import { describe, expect } from "vitest";
|
||||||
|
|
||||||
import { checkpointRefForThreadTurn } from "../Utils.ts";
|
import { checkpointRefForThreadTurn } from "../Utils.ts";
|
||||||
|
|||||||
@@ -1,301 +1,79 @@
|
|||||||
/**
|
/**
|
||||||
* CheckpointStoreLive - Filesystem checkpoint store adapter layer.
|
* CheckpointStoreLive - Filesystem checkpoint store adapter layer.
|
||||||
*
|
*
|
||||||
* Implements hidden Git-ref checkpoint capture/restore directly with
|
* Resolves the active VCS driver once per checkpoint operation and delegates
|
||||||
* Effect-native child process execution (`effect/unstable/process`).
|
* checkpoint-specific behavior to the driver's optional checkpoint capability.
|
||||||
*
|
|
||||||
* This layer owns filesystem/Git interactions only; it does not persist
|
|
||||||
* checkpoint metadata and does not coordinate provider rollback semantics.
|
|
||||||
*
|
*
|
||||||
* @module CheckpointStoreLive
|
* @module CheckpointStoreLive
|
||||||
*/
|
*/
|
||||||
import { randomUUID } from "node:crypto";
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
|
||||||
import { Effect, Layer, FileSystem, Path } from "effect";
|
|
||||||
|
|
||||||
import { CheckpointInvariantError } from "../Errors.ts";
|
|
||||||
import { VcsProcessExitError } from "@t3tools/contracts";
|
|
||||||
import { VcsDriverRegistry } from "../../vcs/VcsDriverRegistry.ts";
|
|
||||||
import { CheckpointStore, type CheckpointStoreShape } from "../Services/CheckpointStore.ts";
|
import { CheckpointStore, type CheckpointStoreShape } from "../Services/CheckpointStore.ts";
|
||||||
import { CheckpointRef } from "@t3tools/contracts";
|
import { VcsUnsupportedOperationError } from "@t3tools/contracts";
|
||||||
|
import { VcsDriverRegistry } from "../../vcs/VcsDriverRegistry.ts";
|
||||||
const CHECKPOINT_DIFF_MAX_OUTPUT_BYTES = 10_000_000;
|
import type { VcsCheckpointOps } from "../../vcs/VcsDriver.ts";
|
||||||
|
|
||||||
const makeCheckpointStore = Effect.gen(function* () {
|
const makeCheckpointStore = Effect.gen(function* () {
|
||||||
const fs = yield* FileSystem.FileSystem;
|
|
||||||
const path = yield* Path.Path;
|
|
||||||
const vcsRegistry = yield* VcsDriverRegistry;
|
const vcsRegistry = yield* VcsDriverRegistry;
|
||||||
const vcs = {
|
|
||||||
execute: (input: {
|
|
||||||
readonly operation: string;
|
|
||||||
readonly cwd: string;
|
|
||||||
readonly args: ReadonlyArray<string>;
|
|
||||||
readonly stdin?: string;
|
|
||||||
readonly env?: NodeJS.ProcessEnv;
|
|
||||||
readonly allowNonZeroExit?: boolean;
|
|
||||||
readonly timeoutMs?: number;
|
|
||||||
readonly maxOutputBytes?: number;
|
|
||||||
readonly truncateOutputAtMaxBytes?: boolean;
|
|
||||||
}) =>
|
|
||||||
vcsRegistry
|
|
||||||
.resolve({ cwd: input.cwd, requestedKind: "git" })
|
|
||||||
.pipe(Effect.flatMap((handle) => handle.driver.execute(input))),
|
|
||||||
};
|
|
||||||
|
|
||||||
const resolveHeadCommit = (cwd: string) =>
|
const resolveCheckpoints = Effect.fn("CheckpointStore.resolveCheckpoints")(function* (
|
||||||
vcs
|
operation: string,
|
||||||
.execute({
|
cwd: string,
|
||||||
operation: "CheckpointStore.resolveHeadCommit",
|
) {
|
||||||
cwd,
|
const handle = yield* vcsRegistry.resolve({ cwd });
|
||||||
args: ["rev-parse", "--verify", "--quiet", "HEAD^{commit}"],
|
if (!handle.driver.checkpoints) {
|
||||||
allowNonZeroExit: true,
|
return yield* new VcsUnsupportedOperationError({
|
||||||
})
|
operation,
|
||||||
.pipe(
|
kind: handle.kind,
|
||||||
Effect.map((result) => {
|
detail: `${handle.kind} driver does not implement checkpoint operations.`,
|
||||||
if (result.exitCode !== 0) {
|
});
|
||||||
return null;
|
}
|
||||||
}
|
return handle.driver.checkpoints satisfies VcsCheckpointOps;
|
||||||
const commit = result.stdout.trim();
|
});
|
||||||
return commit.length > 0 ? commit : null;
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
const hasHeadCommit = (cwd: string) =>
|
|
||||||
vcs
|
|
||||||
.execute({
|
|
||||||
operation: "CheckpointStore.hasHeadCommit",
|
|
||||||
cwd,
|
|
||||||
args: ["rev-parse", "--verify", "HEAD"],
|
|
||||||
allowNonZeroExit: true,
|
|
||||||
})
|
|
||||||
.pipe(Effect.map((result) => result.exitCode === 0));
|
|
||||||
|
|
||||||
const resolveCheckpointCommit = (cwd: string, checkpointRef: CheckpointRef) =>
|
|
||||||
vcs
|
|
||||||
.execute({
|
|
||||||
operation: "CheckpointStore.resolveCheckpointCommit",
|
|
||||||
cwd,
|
|
||||||
args: ["rev-parse", "--verify", "--quiet", `${checkpointRef}^{commit}`],
|
|
||||||
allowNonZeroExit: true,
|
|
||||||
})
|
|
||||||
.pipe(
|
|
||||||
Effect.map((result) => {
|
|
||||||
if (result.exitCode !== 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const commit = result.stdout.trim();
|
|
||||||
return commit.length > 0 ? commit : null;
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
const isGitRepository: CheckpointStoreShape["isGitRepository"] = (cwd) =>
|
const isGitRepository: CheckpointStoreShape["isGitRepository"] = (cwd) =>
|
||||||
vcs
|
vcsRegistry.resolve({ cwd, requestedKind: "git" }).pipe(
|
||||||
.execute({
|
Effect.map(() => true),
|
||||||
operation: "CheckpointStore.isGitRepository",
|
Effect.catch(() => Effect.succeed(false)),
|
||||||
cwd,
|
);
|
||||||
args: ["rev-parse", "--is-inside-work-tree"],
|
|
||||||
allowNonZeroExit: true,
|
|
||||||
})
|
|
||||||
.pipe(
|
|
||||||
Effect.map((result) => result.exitCode === 0 && result.stdout.trim() === "true"),
|
|
||||||
Effect.catch(() => Effect.succeed(false)),
|
|
||||||
);
|
|
||||||
|
|
||||||
const captureCheckpoint: CheckpointStoreShape["captureCheckpoint"] = Effect.fn(
|
const captureCheckpoint: CheckpointStoreShape["captureCheckpoint"] = Effect.fn(
|
||||||
"captureCheckpoint",
|
"captureCheckpoint",
|
||||||
)(function* (input) {
|
)(function* (input) {
|
||||||
const operation = "CheckpointStore.captureCheckpoint";
|
const checkpoints = yield* resolveCheckpoints("CheckpointStore.captureCheckpoint", input.cwd);
|
||||||
|
return yield* checkpoints.captureCheckpoint(input);
|
||||||
yield* Effect.acquireUseRelease(
|
|
||||||
fs.makeTempDirectory({ prefix: "t3-fs-checkpoint-" }),
|
|
||||||
Effect.fn("captureCheckpoint.withTempDirectory")(function* (tempDir) {
|
|
||||||
const tempIndexPath = path.join(tempDir, `index-${randomUUID()}`);
|
|
||||||
const commitEnv: NodeJS.ProcessEnv = {
|
|
||||||
...process.env,
|
|
||||||
GIT_INDEX_FILE: tempIndexPath,
|
|
||||||
GIT_AUTHOR_NAME: "T3 Code",
|
|
||||||
GIT_AUTHOR_EMAIL: "[email protected]",
|
|
||||||
GIT_COMMITTER_NAME: "T3 Code",
|
|
||||||
GIT_COMMITTER_EMAIL: "[email protected]",
|
|
||||||
};
|
|
||||||
|
|
||||||
const headExists = yield* hasHeadCommit(input.cwd);
|
|
||||||
if (headExists) {
|
|
||||||
yield* vcs.execute({
|
|
||||||
operation,
|
|
||||||
cwd: input.cwd,
|
|
||||||
args: ["read-tree", "HEAD"],
|
|
||||||
env: commitEnv,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
yield* vcs.execute({
|
|
||||||
operation,
|
|
||||||
cwd: input.cwd,
|
|
||||||
args: ["add", "-A", "--", "."],
|
|
||||||
env: commitEnv,
|
|
||||||
});
|
|
||||||
|
|
||||||
const writeTreeResult = yield* vcs.execute({
|
|
||||||
operation,
|
|
||||||
cwd: input.cwd,
|
|
||||||
args: ["write-tree"],
|
|
||||||
env: commitEnv,
|
|
||||||
});
|
|
||||||
const treeOid = writeTreeResult.stdout.trim();
|
|
||||||
if (treeOid.length === 0) {
|
|
||||||
return yield* new VcsProcessExitError({
|
|
||||||
operation,
|
|
||||||
command: "git write-tree",
|
|
||||||
cwd: input.cwd,
|
|
||||||
exitCode: 0,
|
|
||||||
detail: "git write-tree returned an empty tree oid.",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const message = `t3 checkpoint ref=${input.checkpointRef}`;
|
|
||||||
const commitTreeResult = yield* vcs.execute({
|
|
||||||
operation,
|
|
||||||
cwd: input.cwd,
|
|
||||||
args: ["commit-tree", treeOid, "-m", message],
|
|
||||||
env: commitEnv,
|
|
||||||
});
|
|
||||||
const commitOid = commitTreeResult.stdout.trim();
|
|
||||||
if (commitOid.length === 0) {
|
|
||||||
return yield* new VcsProcessExitError({
|
|
||||||
operation,
|
|
||||||
command: "git commit-tree",
|
|
||||||
cwd: input.cwd,
|
|
||||||
exitCode: 0,
|
|
||||||
detail: "git commit-tree returned an empty commit oid.",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
yield* vcs.execute({
|
|
||||||
operation,
|
|
||||||
cwd: input.cwd,
|
|
||||||
args: ["update-ref", input.checkpointRef, commitOid],
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
(tempDir) => fs.remove(tempDir, { recursive: true }),
|
|
||||||
).pipe(
|
|
||||||
Effect.catchTags({
|
|
||||||
PlatformError: (error) =>
|
|
||||||
Effect.fail(
|
|
||||||
new CheckpointInvariantError({
|
|
||||||
operation: "CheckpointStore.captureCheckpoint",
|
|
||||||
detail: "Failed to capture checkpoint.",
|
|
||||||
cause: error,
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const hasCheckpointRef: CheckpointStoreShape["hasCheckpointRef"] = (input) =>
|
const hasCheckpointRef: CheckpointStoreShape["hasCheckpointRef"] = Effect.fn("hasCheckpointRef")(
|
||||||
resolveCheckpointCommit(input.cwd, input.checkpointRef).pipe(
|
function* (input) {
|
||||||
Effect.map((commit) => commit !== null),
|
const checkpoints = yield* resolveCheckpoints("CheckpointStore.hasCheckpointRef", input.cwd);
|
||||||
);
|
return yield* checkpoints.hasCheckpointRef(input);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const restoreCheckpoint: CheckpointStoreShape["restoreCheckpoint"] = Effect.fn(
|
const restoreCheckpoint: CheckpointStoreShape["restoreCheckpoint"] = Effect.fn(
|
||||||
"restoreCheckpoint",
|
"restoreCheckpoint",
|
||||||
)(function* (input) {
|
)(function* (input) {
|
||||||
const operation = "CheckpointStore.restoreCheckpoint";
|
const checkpoints = yield* resolveCheckpoints("CheckpointStore.restoreCheckpoint", input.cwd);
|
||||||
|
return yield* checkpoints.restoreCheckpoint(input);
|
||||||
let commitOid = yield* resolveCheckpointCommit(input.cwd, input.checkpointRef);
|
|
||||||
|
|
||||||
if (!commitOid && input.fallbackToHead === true) {
|
|
||||||
commitOid = yield* resolveHeadCommit(input.cwd);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!commitOid) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
yield* vcs.execute({
|
|
||||||
operation,
|
|
||||||
cwd: input.cwd,
|
|
||||||
args: ["restore", "--source", commitOid, "--worktree", "--staged", "--", "."],
|
|
||||||
});
|
|
||||||
yield* vcs.execute({
|
|
||||||
operation,
|
|
||||||
cwd: input.cwd,
|
|
||||||
args: ["clean", "-fd", "--", "."],
|
|
||||||
});
|
|
||||||
|
|
||||||
const headExists = yield* hasHeadCommit(input.cwd);
|
|
||||||
if (headExists) {
|
|
||||||
yield* vcs.execute({
|
|
||||||
operation,
|
|
||||||
cwd: input.cwd,
|
|
||||||
args: ["reset", "--quiet", "--", "."],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const diffCheckpoints: CheckpointStoreShape["diffCheckpoints"] = Effect.fn("diffCheckpoints")(
|
const diffCheckpoints: CheckpointStoreShape["diffCheckpoints"] = Effect.fn("diffCheckpoints")(
|
||||||
function* (input) {
|
function* (input) {
|
||||||
const operation = "CheckpointStore.diffCheckpoints";
|
const checkpoints = yield* resolveCheckpoints("CheckpointStore.diffCheckpoints", input.cwd);
|
||||||
|
return yield* checkpoints.diffCheckpoints(input);
|
||||||
let fromCommitOid = yield* resolveCheckpointCommit(input.cwd, input.fromCheckpointRef);
|
|
||||||
const toCommitOid = yield* resolveCheckpointCommit(input.cwd, input.toCheckpointRef);
|
|
||||||
|
|
||||||
if (!fromCommitOid && input.fallbackFromToHead === true) {
|
|
||||||
const headCommit = yield* resolveHeadCommit(input.cwd);
|
|
||||||
if (headCommit) {
|
|
||||||
fromCommitOid = headCommit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fromCommitOid || !toCommitOid) {
|
|
||||||
return yield* new VcsProcessExitError({
|
|
||||||
operation,
|
|
||||||
command: "git diff",
|
|
||||||
cwd: input.cwd,
|
|
||||||
exitCode: 1,
|
|
||||||
detail: "Checkpoint ref is unavailable for diff operation.",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const diffArgs = [
|
|
||||||
"diff",
|
|
||||||
"--patch",
|
|
||||||
"--minimal",
|
|
||||||
"--no-color",
|
|
||||||
...(input.ignoreWhitespace ? ["--ignore-all-space"] : []),
|
|
||||||
fromCommitOid,
|
|
||||||
toCommitOid,
|
|
||||||
];
|
|
||||||
|
|
||||||
const result = yield* vcs.execute({
|
|
||||||
operation,
|
|
||||||
cwd: input.cwd,
|
|
||||||
args: diffArgs,
|
|
||||||
maxOutputBytes: CHECKPOINT_DIFF_MAX_OUTPUT_BYTES,
|
|
||||||
});
|
|
||||||
|
|
||||||
return result.stdout;
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const deleteCheckpointRefs: CheckpointStoreShape["deleteCheckpointRefs"] = Effect.fn(
|
const deleteCheckpointRefs: CheckpointStoreShape["deleteCheckpointRefs"] = Effect.fn(
|
||||||
"deleteCheckpointRefs",
|
"deleteCheckpointRefs",
|
||||||
)(function* (input) {
|
)(function* (input) {
|
||||||
const operation = "CheckpointStore.deleteCheckpointRefs";
|
const checkpoints = yield* resolveCheckpoints(
|
||||||
|
"CheckpointStore.deleteCheckpointRefs",
|
||||||
yield* Effect.forEach(
|
input.cwd,
|
||||||
input.checkpointRefs,
|
|
||||||
(checkpointRef) =>
|
|
||||||
vcs.execute({
|
|
||||||
operation,
|
|
||||||
cwd: input.cwd,
|
|
||||||
args: ["update-ref", "-d", checkpointRef],
|
|
||||||
allowNonZeroExit: true,
|
|
||||||
}),
|
|
||||||
{ discard: true },
|
|
||||||
);
|
);
|
||||||
|
return yield* checkpoints.deleteCheckpointRefs(input);
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import type {
|
|||||||
OrchestrationGetTurnDiffInput,
|
OrchestrationGetTurnDiffInput,
|
||||||
OrchestrationGetTurnDiffResult,
|
OrchestrationGetTurnDiffResult,
|
||||||
} from "@t3tools/contracts";
|
} from "@t3tools/contracts";
|
||||||
import { Context } from "effect";
|
import * as Context from "effect/Context";
|
||||||
import type { Effect } from "effect";
|
import type * as Effect from "effect/Effect";
|
||||||
|
|
||||||
import type { CheckpointServiceError } from "../Errors.ts";
|
import type { CheckpointServiceError } from "../Errors.ts";
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
*
|
*
|
||||||
* @module CheckpointStore
|
* @module CheckpointStore
|
||||||
*/
|
*/
|
||||||
import { Context } from "effect";
|
import * as Context from "effect/Context";
|
||||||
import type { Effect } from "effect";
|
import type * as Effect from "effect/Effect";
|
||||||
|
|
||||||
import type { CheckpointStoreError } from "../Errors.ts";
|
import type { CheckpointStoreError } from "../Errors.ts";
|
||||||
import { CheckpointRef } from "@t3tools/contracts";
|
import { CheckpointRef } from "@t3tools/contracts";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Encoding } from "effect";
|
import * as Encoding from "effect/Encoding";
|
||||||
import { CheckpointRef, ProjectId, type ThreadId } from "@t3tools/contracts";
|
import { CheckpointRef, ProjectId, type ThreadId } from "@t3tools/contracts";
|
||||||
|
|
||||||
export const CHECKPOINT_REFS_PREFIX = "refs/t3/checkpoints";
|
export const CHECKPOINT_REFS_PREFIX = "refs/t3/checkpoints";
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import { AuthSessionId } from "@t3tools/contracts";
|
import { AuthSessionId } from "@t3tools/contracts";
|
||||||
import { Console, Effect, Layer, Option, References } from "effect";
|
import * as Console from "effect/Console";
|
||||||
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
import * as Option from "effect/Option";
|
||||||
|
import * as References from "effect/References";
|
||||||
import { Argument, Command, Flag, GlobalFlag } from "effect/unstable/cli";
|
import { Argument, Command, Flag, GlobalFlag } from "effect/unstable/cli";
|
||||||
|
|
||||||
import { AuthControlPlaneRuntimeLive } from "../auth/Layers/AuthControlPlane.ts";
|
import { AuthControlPlaneRuntimeLive } from "../auth/Layers/AuthControlPlane.ts";
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
import os from "node:os";
|
import NodeOS from "node:os";
|
||||||
|
|
||||||
import { assert, expect, it } from "@effect/vitest";
|
import { assert, expect, it } from "@effect/vitest";
|
||||||
import { ConfigProvider, Effect, FileSystem, Layer, Option, Path, Schema } from "effect";
|
import * as ConfigProvider from "effect/ConfigProvider";
|
||||||
|
import * as Effect from "effect/Effect";
|
||||||
|
import * as FileSystem from "effect/FileSystem";
|
||||||
|
import * as Layer from "effect/Layer";
|
||||||
|
import * as Option from "effect/Option";
|
||||||
|
import * as Path from "effect/Path";
|
||||||
|
import * as Schema from "effect/Schema";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DesktopBackendBootstrap,
|
DesktopBackendBootstrap,
|
||||||
type DesktopBackendBootstrap as DesktopBackendBootstrapValue,
|
type DesktopBackendBootstrap as DesktopBackendBootstrapValue,
|
||||||
} from "@t3tools/contracts";
|
} from "@t3tools/contracts";
|
||||||
import { NetService } from "@t3tools/shared/Net";
|
import * as NetService from "@t3tools/shared/Net";
|
||||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||||
import { deriveServerPaths } from "../config.ts";
|
import { deriveServerPaths } from "../config.ts";
|
||||||
import { resolveServerConfig } from "./config.ts";
|
import { resolveServerConfig } from "./config.ts";
|
||||||
@@ -53,7 +59,7 @@ it.layer(NodeServices.layer)("cli config resolution", (it) => {
|
|||||||
it.effect("falls back to effect/config values when flags are omitted", () =>
|
it.effect("falls back to effect/config values when flags are omitted", () =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const { join } = yield* Path.Path;
|
const { join } = yield* Path.Path;
|
||||||
const baseDir = join(os.tmpdir(), "t3-cli-config-env-base");
|
const baseDir = join(NodeOS.tmpdir(), "t3-cli-config-env-base");
|
||||||
const derivedPaths = yield* deriveServerPaths(baseDir, new URL("http://127.0.0.1:5173"));
|
const derivedPaths = yield* deriveServerPaths(baseDir, new URL("http://127.0.0.1:5173"));
|
||||||
const resolved = yield* resolveServerConfig(
|
const resolved = yield* resolveServerConfig(
|
||||||
{
|
{
|
||||||
@@ -119,7 +125,7 @@ it.layer(NodeServices.layer)("cli config resolution", (it) => {
|
|||||||
it.effect("uses CLI flags when provided", () =>
|
it.effect("uses CLI flags when provided", () =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const { join } = yield* Path.Path;
|
const { join } = yield* Path.Path;
|
||||||
const baseDir = join(os.tmpdir(), "t3-cli-config-flags-base");
|
const baseDir = join(NodeOS.tmpdir(), "t3-cli-config-flags-base");
|
||||||
const derivedPaths = yield* deriveServerPaths(baseDir, new URL("http://127.0.0.1:4173"));
|
const derivedPaths = yield* deriveServerPaths(baseDir, new URL("http://127.0.0.1:4173"));
|
||||||
const resolved = yield* resolveServerConfig(
|
const resolved = yield* resolveServerConfig(
|
||||||
{
|
{
|
||||||
@@ -147,7 +153,7 @@ it.layer(NodeServices.layer)("cli config resolution", (it) => {
|
|||||||
T3CODE_MODE: "desktop",
|
T3CODE_MODE: "desktop",
|
||||||
T3CODE_PORT: "4001",
|
T3CODE_PORT: "4001",
|
||||||
T3CODE_HOST: "0.0.0.0",
|
T3CODE_HOST: "0.0.0.0",
|
||||||
T3CODE_HOME: join(os.tmpdir(), "ignored-base"),
|
T3CODE_HOME: join(NodeOS.tmpdir(), "ignored-base"),
|
||||||
VITE_DEV_SERVER_URL: "http://127.0.0.1:5173",
|
VITE_DEV_SERVER_URL: "http://127.0.0.1:5173",
|
||||||
T3CODE_NO_BROWSER: "false",
|
T3CODE_NO_BROWSER: "false",
|
||||||
T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD: "false",
|
T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD: "false",
|
||||||
@@ -185,7 +191,7 @@ it.layer(NodeServices.layer)("cli config resolution", (it) => {
|
|||||||
it.effect("preserves explicit false CLI boolean flags over env and bootstrap values", () =>
|
it.effect("preserves explicit false CLI boolean flags over env and bootstrap values", () =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const { join } = yield* Path.Path;
|
const { join } = yield* Path.Path;
|
||||||
const baseDir = join(os.tmpdir(), "t3-cli-config-false-flags");
|
const baseDir = join(NodeOS.tmpdir(), "t3-cli-config-false-flags");
|
||||||
const fd = yield* openBootstrapFd(
|
const fd = yield* openBootstrapFd(
|
||||||
makeDesktopBootstrap({
|
makeDesktopBootstrap({
|
||||||
noBrowser: true,
|
noBrowser: true,
|
||||||
@@ -378,7 +384,7 @@ it.layer(NodeServices.layer)("cli config resolution", (it) => {
|
|||||||
it.effect("applies flag then env precedence over bootstrap envelope values", () =>
|
it.effect("applies flag then env precedence over bootstrap envelope values", () =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const { join } = yield* Path.Path;
|
const { join } = yield* Path.Path;
|
||||||
const baseDir = join(os.tmpdir(), "t3-cli-config-env-wins");
|
const baseDir = join(NodeOS.tmpdir(), "t3-cli-config-env-wins");
|
||||||
const fd = yield* openBootstrapFd(
|
const fd = yield* openBootstrapFd(
|
||||||
makeDesktopBootstrap({
|
makeDesktopBootstrap({
|
||||||
port: 4888,
|
port: 4888,
|
||||||
@@ -459,6 +465,7 @@ it.layer(NodeServices.layer)("cli config resolution", (it) => {
|
|||||||
yield* fs.makeDirectory(path.dirname(derivedPaths.settingsPath), { recursive: true });
|
yield* fs.makeDirectory(path.dirname(derivedPaths.settingsPath), { recursive: true });
|
||||||
yield* fs.writeFileString(
|
yield* fs.writeFileString(
|
||||||
derivedPaths.settingsPath,
|
derivedPaths.settingsPath,
|
||||||
|
// @effect-diagnostics-next-line preferSchemaOverJson:off
|
||||||
`${JSON.stringify({
|
`${JSON.stringify({
|
||||||
observability: {
|
observability: {
|
||||||
otlpTracesUrl: "http://localhost:4318/v1/traces",
|
otlpTracesUrl: "http://localhost:4318/v1/traces",
|
||||||
@@ -521,7 +528,7 @@ it.layer(NodeServices.layer)("cli config resolution", (it) => {
|
|||||||
it.effect("forces noBrowser and disables auto-bootstrap for headless startup presentation", () =>
|
it.effect("forces noBrowser and disables auto-bootstrap for headless startup presentation", () =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const { join } = yield* Path.Path;
|
const { join } = yield* Path.Path;
|
||||||
const baseDir = join(os.tmpdir(), "t3-cli-config-headless-base");
|
const baseDir = join(NodeOS.tmpdir(), "t3-cli-config-headless-base");
|
||||||
const derivedPaths = yield* deriveServerPaths(baseDir, undefined);
|
const derivedPaths = yield* deriveServerPaths(baseDir, undefined);
|
||||||
|
|
||||||
const resolved = yield* resolveServerConfig(
|
const resolved = yield* resolveServerConfig(
|
||||||
|
|||||||
@@ -1,18 +1,16 @@
|
|||||||
import { NetService } from "@t3tools/shared/Net";
|
import * as NetService from "@t3tools/shared/Net";
|
||||||
import { parsePersistedServerObservabilitySettings } from "@t3tools/shared/serverSettings";
|
import { parsePersistedServerObservabilitySettings } from "@t3tools/shared/serverSettings";
|
||||||
import { DesktopBackendBootstrap, PortSchema } from "@t3tools/contracts";
|
import { DesktopBackendBootstrap, PortSchema } from "@t3tools/contracts";
|
||||||
import {
|
import * as Config from "effect/Config";
|
||||||
Config,
|
import * as Duration from "effect/Duration";
|
||||||
Duration,
|
import * as Effect from "effect/Effect";
|
||||||
Effect,
|
import * as FileSystem from "effect/FileSystem";
|
||||||
FileSystem,
|
import * as LogLevel from "effect/LogLevel";
|
||||||
LogLevel,
|
import * as Option from "effect/Option";
|
||||||
Option,
|
import * as Path from "effect/Path";
|
||||||
Path,
|
import * as Schema from "effect/Schema";
|
||||||
Schema,
|
import * as SchemaIssue from "effect/SchemaIssue";
|
||||||
SchemaIssue,
|
import * as SchemaTransformation from "effect/SchemaTransformation";
|
||||||
SchemaTransformation,
|
|
||||||
} from "effect";
|
|
||||||
import { Argument, Flag } from "effect/unstable/cli";
|
import { Argument, Flag } from "effect/unstable/cli";
|
||||||
|
|
||||||
import { readBootstrapEnvelope } from "../bootstrap.ts";
|
import { readBootstrapEnvelope } from "../bootstrap.ts";
|
||||||
@@ -215,7 +213,7 @@ export const resolveServerConfig = (
|
|||||||
},
|
},
|
||||||
) =>
|
) =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const { findAvailablePort } = yield* NetService;
|
const { findAvailablePort } = yield* NetService.NetService;
|
||||||
const path = yield* Path.Path;
|
const path = yield* Path.Path;
|
||||||
const fs = yield* FileSystem.FileSystem;
|
const fs = yield* FileSystem.FileSystem;
|
||||||
const env = yield* EnvServerConfig;
|
const env = yield* EnvServerConfig;
|
||||||
|
|||||||