🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@textswift/textswift

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@textswift/textswift - npm Package Compare versions

Package was removed
Sorry, it seems this package was removed from the registry
Comparing version
0.1.1
to
0.1.2
+1
-1
dist/native/host/textswift-host.js

@@ -167,3 +167,3 @@ #!/usr/bin/env node

"-c",
`reasoning_effort="${CODEX_REASONING_EFFORT}"`,
`model_reasoning_effort="${CODEX_REASONING_EFFORT}"`,
"-c",

@@ -170,0 +170,0 @@ 'reasoning_summaries="none"',

@@ -1,15 +0,35 @@

# TextSwift
<div align="center">
Instant in-page translation powered by Codex
<img src="https://raw.githubusercontent.com/baekenough/textswift/main/assets/maki-promition-tile_1400x560.png" alt="TextSwift Banner" width="700">
**Instant in-page translation powered by Codex**
[![npm version](https://img.shields.io/npm/v/@textswift/textswift)](https://www.npmjs.com/package/@textswift/textswift)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[Install](#installation) · [Usage](#usage) · [Development](#development) · [Troubleshooting](#troubleshooting)
</div>
---
## Demo
<div align="center">
<img src="https://raw.githubusercontent.com/baekenough/textswift/main/assets/capture_1280x800.png" alt="TextSwift in action" width="720">
<p><em>Select text on any webpage → click the icon → instant translation</em></p>
</div>
---
## Features
- **Inline Selection Translation**: Select text on any webpage and translate instantly with a single click
- **Popup Translation Panel**: Standalone translation interface accessible from the Chrome toolbar
- **Multi-Language Support**: Translate between English, Korean, Japanese, Chinese, Spanish, and more
- **Secure Native Messaging**: No API keys embedded in extension; reuses local Codex CLI authentication
- **Model Benchmarking**: Automated performance testing to select the fastest translation model
- **Clean UX**: Non-intrusive interface that appears only when needed
| Feature | Description |
|---------|-------------|
| **Inline Translation** | Select text on any webpage and translate instantly with a single click |
| **Popup Panel** | Standalone translation interface from the Chrome toolbar |
| **Multi-Language** | English, Korean, Japanese, Chinese, Spanish, and more |
| **Secure** | No API keys in extension; reuses local Codex CLI authentication |
| **Font Controls** | Adjust translation font size (A+ / A-) for readability |
| **Model Benchmarking** | Automated performance testing to select the fastest model |

@@ -21,34 +41,8 @@ ---

```
┌─────────────┐
│ Web Page │ User selects text
└──────┬──────┘
v
┌─────────────┐
│ Extension │ Click TS icon
│ Content │
│ Script │
└──────┬──────┘
v
┌─────────────┐
│ Background │ Send translation request
│ Service │
│ Worker │
└──────┬──────┘
v
┌─────────────┐
│ Native │ Execute: codex exec translate
│ Messaging │
│ Host │
└──────┬──────┘
v
┌─────────────┐
│ Codex │ Return translated text
│ CLI │
└─────────────┘
Web Page → Content Script → Background Worker → Native Host → Codex CLI
(select) (click icon) (send request) (codex exec) (translate)
```
The extension uses Chrome's [Native Messaging](https://developer.chrome.com/docs/extensions/develop/concepts/native-messaging) to securely communicate with the locally installed Codex CLI. No API keys are stored or transmitted by the extension.
---

@@ -58,9 +52,5 @@

- English
- Korean
- Japanese
- Chinese
- Spanish
🇺🇸 English · 🇰🇷 Korean · 🇯🇵 Japanese · 🇨🇳 Chinese · 🇪🇸 Spanish
Additional languages planned for future releases.
> Additional languages planned for future releases.

@@ -71,3 +61,3 @@ ---

### Quick Setup (npm)
### Quick Setup

@@ -83,3 +73,3 @@ ```bash

If codex is not logged in, run:
If Codex is not logged in, run:

@@ -126,13 +116,13 @@ ```bash

1. Navigate to any web page
2. Select the text you want to translate
3. Click the **TS** icon that appears next to your selection
4. View the instant translation in the inline panel
5. Click **Close** to dismiss the panel
1. Select text on any webpage
2. Click the **TextSwift icon** that appears next to your selection
3. View the instant translation in the inline panel
4. Adjust font size with **A+** / **A-** buttons
5. Click **Close** to dismiss
The inline icon and panel appear only when text is selected and disappear when the selection is cleared.
> The icon stays visible during translation — click it again to reopen the panel.
### Popup Translation
1. Click the TextSwift extension icon in the Chrome toolbar
1. Click the TextSwift icon in the Chrome toolbar
2. Paste or type text into the input field

@@ -159,8 +149,6 @@ 3. Select source and target languages

| `npm run smoke:sites` | Verify extension on multiple real websites |
| `npm run checklist` | Run all quality checks (type + unit + smoke + benchmark) |
| `npm run checklist` | Run all quality checks |
### Quality Assurance
Run the full checklist before committing:
```bash

@@ -170,3 +158,3 @@ npm run checklist

This command executes type checking, unit tests, smoke tests, and benchmark tests to ensure all functionality is working correctly.
Runs type checking, unit tests, smoke tests, and benchmarks before committing.

@@ -177,26 +165,19 @@ ---

TextSwift uses a primary/fallback model chain for optimal performance and reliability:
TextSwift uses a primary/fallback model chain:
- **Primary Model**: `gpt-5.3-codex-low` (faster, cost-effective)
- **Fallback Model**: `gpt-5.1-codex-mini` (reliable backup)
| Role | Model | Trait |
|------|-------|-------|
| Primary | `gpt-5.3-spark` | Faster, cost-effective |
| Fallback | `gpt-5.1-codex-mini` | Reliable backup |
### Benchmarking
To determine the fastest model for your environment:
```bash
# Full benchmark
bash scripts/benchmark-models.sh
```
The benchmark script reports p50/p95 latency and recommends the optimal model based on your system and network performance.
**Run a quick real benchmark** (1 iteration):
```bash
# Quick (1 iteration)
TEXTSWIFT_BENCHMARK_MODE=codex TEXTSWIFT_BENCHMARK_ITERATIONS=1 bash scripts/benchmark-models.sh
```
**Run a mock benchmark** (for testing without API calls):
```bash
# Mock (no API calls)
TEXTSWIFT_BENCHMARK_MODE=mock bash scripts/benchmark-models.sh

@@ -209,32 +190,28 @@ ```

### Issue: Icon/panel remains visible before text selection
<details>
<summary><strong>Icon/panel remains visible before text selection</strong></summary>
- **Cause**: Stale content script from a previous build is still mounted on the tab
- **Fix**:
1. Navigate to `chrome://extensions`
2. Find TextSwift and click **Reload**
3. Refresh or reopen the target web page
Stale content script from a previous build. Reload the extension from `chrome://extensions`, then refresh the page.
</details>
### Issue: "Cannot read properties of undefined (reading 'sendMessage')"
<details>
<summary><strong>"Cannot read properties of undefined (reading 'sendMessage')"</strong></summary>
- **Cause**: Content script running without extension runtime binding (stale or mismatched load)
- **Fix**:
1. Reload the extension from `chrome://extensions`
2. Reload the web page
Content script running without extension runtime binding. Reload both the extension and the web page.
</details>
### Issue: Extension context invalidated
<details>
<summary><strong>Extension context invalidated</strong></summary>
- **Cause**: Extension was reloaded while content scripts were still active
- **Fix**:
1. Close and reopen the affected browser tabs
2. Alternatively, refresh the tabs after reloading the extension
Extension was reloaded while content scripts were active. Close and reopen the affected tabs.
</details>
---
## Security Constraints
## Security
- No API keys are embedded or used directly in the extension
- The extension does not parse or access Codex authentication files
- Native host reuses local Codex CLI authentication via `codex exec` command
- All translation requests are processed through the secure native messaging channel
- No API keys embedded in the extension
- No access to Codex authentication files
- Native host reuses local Codex CLI auth via `codex exec`
- All requests go through Chrome's secure native messaging channel

@@ -245,5 +222,7 @@ ---

- **Milestone 1**: UI-only extension (popup + content widget + state UI) ✓
- **Milestone 2**: Native messaging channel connected ✓
- **Milestone 3**: Real `codex exec` translation path with timeout/error handling and fallback model chain ✓
- [x] UI-only extension (popup + content widget + state UI)
- [x] Native messaging channel connected
- [x] Real `codex exec` translation with timeout/error handling and fallback model chain
- [ ] Chrome Web Store publishing
- [ ] Windows / Linux support

@@ -250,0 +229,0 @@ ---

@@ -24,3 +24,3 @@ import { spawn } from "node:child_process";

targetLang: "ko",
model: "gpt-5.3-codex-low"
model: "gpt-5.3-spark"
});

@@ -38,3 +38,3 @@

targetLang: "ko",
model: "gpt-5.3-codex-low"
model: "gpt-5.3-spark"
});

@@ -41,0 +41,0 @@

@@ -21,3 +21,3 @@ "use strict";

const MODELS = {
FAST_PRIMARY: "gpt-5.3-codex-low",
FAST_PRIMARY: "gpt-5.3-spark",
FAST_FALLBACK: "gpt-5.1-codex-mini"

@@ -24,0 +24,0 @@ };

@@ -246,4 +246,6 @@ "use strict";

inlinePanel.classList.remove("textswift-hidden");
// If already loading or has a result, just reshow panel without new request
if (inlineState === uiStates.LOADING || inlineState === uiStates.SUCCESS) {
// If already loading or has a result for the same text, just reshow panel without new request
const nextText = (pendingInlineText || selectedText).trim();
if ((inlineState === uiStates.LOADING || inlineState === uiStates.SUCCESS) &&
lastRequest && lastRequest.text === nextText) {
return;

@@ -250,0 +252,0 @@ }

{
"name": "@textswift/textswift",
"version": "0.1.1",
"version": "0.1.2",
"private": false,

@@ -5,0 +5,0 @@ "publishConfig": {

+75
-96

@@ -1,15 +0,35 @@

# TextSwift
<div align="center">
Instant in-page translation powered by Codex
<img src="https://raw.githubusercontent.com/baekenough/textswift/main/assets/maki-promition-tile_1400x560.png" alt="TextSwift Banner" width="700">
**Instant in-page translation powered by Codex**
[![npm version](https://img.shields.io/npm/v/@textswift/textswift)](https://www.npmjs.com/package/@textswift/textswift)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[Install](#installation) · [Usage](#usage) · [Development](#development) · [Troubleshooting](#troubleshooting)
</div>
---
## Demo
<div align="center">
<img src="https://raw.githubusercontent.com/baekenough/textswift/main/assets/capture_1280x800.png" alt="TextSwift in action" width="720">
<p><em>Select text on any webpage → click the icon → instant translation</em></p>
</div>
---
## Features
- **Inline Selection Translation**: Select text on any webpage and translate instantly with a single click
- **Popup Translation Panel**: Standalone translation interface accessible from the Chrome toolbar
- **Multi-Language Support**: Translate between English, Korean, Japanese, Chinese, Spanish, and more
- **Secure Native Messaging**: No API keys embedded in extension; reuses local Codex CLI authentication
- **Model Benchmarking**: Automated performance testing to select the fastest translation model
- **Clean UX**: Non-intrusive interface that appears only when needed
| Feature | Description |
|---------|-------------|
| **Inline Translation** | Select text on any webpage and translate instantly with a single click |
| **Popup Panel** | Standalone translation interface from the Chrome toolbar |
| **Multi-Language** | English, Korean, Japanese, Chinese, Spanish, and more |
| **Secure** | No API keys in extension; reuses local Codex CLI authentication |
| **Font Controls** | Adjust translation font size (A+ / A-) for readability |
| **Model Benchmarking** | Automated performance testing to select the fastest model |

@@ -21,34 +41,8 @@ ---

```
┌─────────────┐
│ Web Page │ User selects text
└──────┬──────┘
v
┌─────────────┐
│ Extension │ Click TS icon
│ Content │
│ Script │
└──────┬──────┘
v
┌─────────────┐
│ Background │ Send translation request
│ Service │
│ Worker │
└──────┬──────┘
v
┌─────────────┐
│ Native │ Execute: codex exec translate
│ Messaging │
│ Host │
└──────┬──────┘
v
┌─────────────┐
│ Codex │ Return translated text
│ CLI │
└─────────────┘
Web Page → Content Script → Background Worker → Native Host → Codex CLI
(select) (click icon) (send request) (codex exec) (translate)
```
The extension uses Chrome's [Native Messaging](https://developer.chrome.com/docs/extensions/develop/concepts/native-messaging) to securely communicate with the locally installed Codex CLI. No API keys are stored or transmitted by the extension.
---

@@ -58,9 +52,5 @@

- English
- Korean
- Japanese
- Chinese
- Spanish
🇺🇸 English · 🇰🇷 Korean · 🇯🇵 Japanese · 🇨🇳 Chinese · 🇪🇸 Spanish
Additional languages planned for future releases.
> Additional languages planned for future releases.

@@ -71,3 +61,3 @@ ---

### Quick Setup (npm)
### Quick Setup

@@ -83,3 +73,3 @@ ```bash

If codex is not logged in, run:
If Codex is not logged in, run:

@@ -126,13 +116,13 @@ ```bash

1. Navigate to any web page
2. Select the text you want to translate
3. Click the **TS** icon that appears next to your selection
4. View the instant translation in the inline panel
5. Click **Close** to dismiss the panel
1. Select text on any webpage
2. Click the **TextSwift icon** that appears next to your selection
3. View the instant translation in the inline panel
4. Adjust font size with **A+** / **A-** buttons
5. Click **Close** to dismiss
The inline icon and panel appear only when text is selected and disappear when the selection is cleared.
> The icon stays visible during translation — click it again to reopen the panel.
### Popup Translation
1. Click the TextSwift extension icon in the Chrome toolbar
1. Click the TextSwift icon in the Chrome toolbar
2. Paste or type text into the input field

@@ -159,8 +149,6 @@ 3. Select source and target languages

| `npm run smoke:sites` | Verify extension on multiple real websites |
| `npm run checklist` | Run all quality checks (type + unit + smoke + benchmark) |
| `npm run checklist` | Run all quality checks |
### Quality Assurance
Run the full checklist before committing:
```bash

@@ -170,3 +158,3 @@ npm run checklist

This command executes type checking, unit tests, smoke tests, and benchmark tests to ensure all functionality is working correctly.
Runs type checking, unit tests, smoke tests, and benchmarks before committing.

@@ -177,26 +165,19 @@ ---

TextSwift uses a primary/fallback model chain for optimal performance and reliability:
TextSwift uses a primary/fallback model chain:
- **Primary Model**: `gpt-5.3-codex-low` (faster, cost-effective)
- **Fallback Model**: `gpt-5.1-codex-mini` (reliable backup)
| Role | Model | Trait |
|------|-------|-------|
| Primary | `gpt-5.3-spark` | Faster, cost-effective |
| Fallback | `gpt-5.1-codex-mini` | Reliable backup |
### Benchmarking
To determine the fastest model for your environment:
```bash
# Full benchmark
bash scripts/benchmark-models.sh
```
The benchmark script reports p50/p95 latency and recommends the optimal model based on your system and network performance.
**Run a quick real benchmark** (1 iteration):
```bash
# Quick (1 iteration)
TEXTSWIFT_BENCHMARK_MODE=codex TEXTSWIFT_BENCHMARK_ITERATIONS=1 bash scripts/benchmark-models.sh
```
**Run a mock benchmark** (for testing without API calls):
```bash
# Mock (no API calls)
TEXTSWIFT_BENCHMARK_MODE=mock bash scripts/benchmark-models.sh

@@ -209,32 +190,28 @@ ```

### Issue: Icon/panel remains visible before text selection
<details>
<summary><strong>Icon/panel remains visible before text selection</strong></summary>
- **Cause**: Stale content script from a previous build is still mounted on the tab
- **Fix**:
1. Navigate to `chrome://extensions`
2. Find TextSwift and click **Reload**
3. Refresh or reopen the target web page
Stale content script from a previous build. Reload the extension from `chrome://extensions`, then refresh the page.
</details>
### Issue: "Cannot read properties of undefined (reading 'sendMessage')"
<details>
<summary><strong>"Cannot read properties of undefined (reading 'sendMessage')"</strong></summary>
- **Cause**: Content script running without extension runtime binding (stale or mismatched load)
- **Fix**:
1. Reload the extension from `chrome://extensions`
2. Reload the web page
Content script running without extension runtime binding. Reload both the extension and the web page.
</details>
### Issue: Extension context invalidated
<details>
<summary><strong>Extension context invalidated</strong></summary>
- **Cause**: Extension was reloaded while content scripts were still active
- **Fix**:
1. Close and reopen the affected browser tabs
2. Alternatively, refresh the tabs after reloading the extension
Extension was reloaded while content scripts were active. Close and reopen the affected tabs.
</details>
---
## Security Constraints
## Security
- No API keys are embedded or used directly in the extension
- The extension does not parse or access Codex authentication files
- Native host reuses local Codex CLI authentication via `codex exec` command
- All translation requests are processed through the secure native messaging channel
- No API keys embedded in the extension
- No access to Codex authentication files
- Native host reuses local Codex CLI auth via `codex exec`
- All requests go through Chrome's secure native messaging channel

@@ -245,5 +222,7 @@ ---

- **Milestone 1**: UI-only extension (popup + content widget + state UI) ✓
- **Milestone 2**: Native messaging channel connected ✓
- **Milestone 3**: Real `codex exec` translation path with timeout/error handling and fallback model chain ✓
- [x] UI-only extension (popup + content widget + state UI)
- [x] Native messaging channel connected
- [x] Real `codex exec` translation with timeout/error handling and fallback model chain
- [ ] Chrome Web Store publishing
- [ ] Windows / Linux support

@@ -250,0 +229,0 @@ ---