@gengjiawen/os-init 1.28.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.1.0](https://github.com/gengjiawen/os-init/compare/v2.0.0...v2.1.0) (2026-09-30)
4
+
5
+
6
+ ### Features
7
+
8
+ * raise Codex auto-compact limit to 156k ([#54](https://github.com/gengjiawen/os-init/issues/54)) ([0656770](https://github.com/gengjiawen/os-init/commit/06567700c397a6161801a50f007c5cadc888b852))
9
+ * switch Codex default model to gpt-6.1-sol ([#52](https://github.com/gengjiawen/os-init/issues/52)) ([befd1a8](https://github.com/gengjiawen/os-init/commit/befd1a8ab1f1c9ced7aa7e6315357f81ed20f7d0))
10
+
11
+ ## [2.0.0](https://github.com/gengjiawen/os-init/compare/v1.28.1...v2.0.0) (2026-09-29)
12
+
13
+
14
+ ### ⚠ BREAKING CHANGES
15
+
16
+ * replace set-raycast-ai with set-tinycast ([#48](https://github.com/gengjiawen/os-init/issues/48))
17
+
18
+ ### Features
19
+
20
+ * enable Claude 1M context and stop forcing max effort level ([#50](https://github.com/gengjiawen/os-init/issues/50)) ([123f044](https://github.com/gengjiawen/os-init/commit/123f0446abff37f0b38b629159011b66d9847910))
21
+ * replace set-raycast-ai with set-tinycast ([#48](https://github.com/gengjiawen/os-init/issues/48)) ([2c4bc52](https://github.com/gengjiawen/os-init/commit/2c4bc52983dfbe3035721da5bdb62b01ec536a85))
22
+
3
23
  ## [1.28.1](https://github.com/gengjiawen/os-init/compare/v1.28.0...v1.28.1) (2026-09-15)
4
24
 
5
25
 
package/README.md CHANGED
@@ -154,14 +154,23 @@ Configures OpenCode CLI with your API key. This command will:
154
154
  - Write `~/.config/opencode/opencode.json`
155
155
  - Install global tool: `opencode-ai` (provides `opencode` command)
156
156
 
157
- ### Configure Raycast AI
157
+ ### Configure Tinycast AI Chat
158
158
 
159
159
  ```bash
160
- pnpx @gengjiawen/os-init set-raycast-ai <API_KEY>
160
+ pnpx @gengjiawen/os-init set-tinycast <API_KEY>
161
161
  ```
162
162
 
163
- Configures Raycast AI providers with your API key. This command will:
163
+ macOS only, and **quit Tinycast first** — a running app rewrites its own
164
+ preferences and would discard the config. Tinycast has no providers file: it
165
+ keeps connections in `UserDefaults` and the key in the login Keychain, and
166
+ excludes both from its settings import on purpose. So this command will:
164
167
 
165
- - Write `~/.config/raycast/ai/providers.yaml`
168
+ - Add an `OpenAI Compatible` connection for `https://ai.gengjiawen.com/api/openai/v1`
169
+ to `com.tinycast.app`'s defaults, leaving any connection you added yourself
170
+ - Select `sota` as the default chat model
171
+ - Turn on AI Chat, which ships off
172
+ - Store the key in the login Keychain under `com.tinycast.app.ai-api-keys`
173
+
174
+ Tinycast prompts once for Keychain access the first time it reads the key.
166
175
 
167
176
  Project generated by [gengjiawen/ts-scaffold](https://github.com/gengjiawen/ts-scaffold)
package/bin/bin.js CHANGED
@@ -11,7 +11,7 @@ const {
11
11
  installOpencodeDeps,
12
12
  writeAllAgentsConfig,
13
13
  installAllAgentsDeps,
14
- writeRaycastConfig,
14
+ writeTinycastConfig,
15
15
  setupDevEnvironment,
16
16
  setupAndroidEnvironment,
17
17
  writeClashConfig,
@@ -153,9 +153,9 @@ program
153
153
  })
154
154
 
155
155
  program
156
- .command('set-raycast-ai')
157
- .description('setup Raycast AI providers config')
158
- .argument('<apiKey>', 'API key to set for Raycast AI')
156
+ .command('set-tinycast')
157
+ .description('setup Tinycast AI Chat provider')
158
+ .argument('<apiKey>', 'API key to set for Tinycast')
159
159
  .action(async (apiKey) => {
160
160
  if (!apiKey || String(apiKey).trim().length === 0) {
161
161
  console.error('Missing required argument: <apiKey>')
@@ -163,13 +163,13 @@ program
163
163
  return
164
164
  }
165
165
  try {
166
- const { configPath } = writeRaycastConfig(apiKey)
167
- console.log(`Raycast AI config written to: ${configPath}`)
166
+ const { baseURL } = await writeTinycastConfig(apiKey)
167
+ console.log(`Tinycast AI connection written for: ${baseURL}`)
168
168
  } catch (err) {
169
- console.error('Failed to setup Raycast AI:', err.message)
169
+ console.error('Failed to setup Tinycast:', err.message)
170
170
  process.exit(1)
171
171
  }
172
- console.log('Raycast AI is ready to use')
172
+ console.log('Tinycast AI Chat is ready to use')
173
173
  })
174
174
 
175
175
  program
@@ -10,7 +10,6 @@ const jsonc_parser_1 = require("jsonc-parser");
10
10
  const utils_1 = require("./utils");
11
11
  const CLAUDE_BASE_URL = 'https://ai.gengjiawen.com/api/claude/';
12
12
  const CLAUDE_AUTO_COMPACT_WINDOW = '128000';
13
- const CLAUDE_DISABLE_1M_CONTEXT = '1';
14
13
  const CLAUDE_ATTRIBUTION_HEADER = '0';
15
14
  function getClaudeSettingsDir() {
16
15
  return path.join(os.homedir(), '.claude');
@@ -29,13 +28,11 @@ function getVSCodeUserSettingsPath() {
29
28
  const CLAUDE_SETTINGS_TEMPLATE = `{
30
29
  "env": {
31
30
  "DISABLE_TELEMETRY": "1",
32
- "CLAUDE_CODE_EFFORT_LEVEL": "max",
33
31
  "OTEL_METRICS_EXPORTER": "otlp",
34
32
  "ANTHROPIC_API_KEY": "API_KEY_PLACEHOLDER",
35
33
  "ANTHROPIC_BASE_URL": "${CLAUDE_BASE_URL}",
36
34
  "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
37
35
  "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "${CLAUDE_AUTO_COMPACT_WINDOW}",
38
- "CLAUDE_CODE_DISABLE_1M_CONTEXT": "${CLAUDE_DISABLE_1M_CONTEXT}",
39
36
  "CLAUDE_CODE_ATTRIBUTION_HEADER": "${CLAUDE_ATTRIBUTION_HEADER}"
40
37
  },
41
38
  "includeCoAuthoredBy": false,
@@ -74,10 +71,6 @@ function writeVSCodeClaudePluginConfig(apiKey) {
74
71
  name: 'CLAUDE_CODE_AUTO_COMPACT_WINDOW',
75
72
  value: CLAUDE_AUTO_COMPACT_WINDOW,
76
73
  },
77
- {
78
- name: 'CLAUDE_CODE_DISABLE_1M_CONTEXT',
79
- value: CLAUDE_DISABLE_1M_CONTEXT,
80
- },
81
74
  {
82
75
  name: 'CLAUDE_CODE_ATTRIBUTION_HEADER',
83
76
  value: CLAUDE_ATTRIBUTION_HEADER,
package/build/codex.js CHANGED
@@ -14,10 +14,10 @@ function getCodexConfigDir() {
14
14
  }
15
15
  function getCodexConfigTomlTemplate(bearerToken) {
16
16
  return `model_provider = "jw"
17
- model = "gpt-5.6-sol"
17
+ model = "gpt-6.1-sol"
18
18
  model_reasoning_effort = "high"
19
19
  plan_mode_reasoning_effort = "high"
20
- model_auto_compact_token_limit = 131072
20
+ model_auto_compact_token_limit = 159744
21
21
  disable_response_storage = true
22
22
  check_for_update_on_startup = false
23
23
 
package/build/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- export declare function writeRaycastConfig(apiKey: string): {
2
- configPath: string;
3
- };
4
1
  export { writeClaudeConfig, installDeps } from './claude-code';
5
2
  export { writeCodexConfig, installCodexDeps } from './codex';
6
3
  export { writeOpencodeConfig, installOpencodeDeps } from './opencode';
@@ -10,3 +7,4 @@ export { setupAndroidEnvironment } from './android-setup';
10
7
  export { writeClashConfig, downloadClashBinary } from './clash';
11
8
  export { setupEnv } from './setup-env';
12
9
  export { CURSOR_TYPESCRIPT_EXTENSION_ID, disableCursorTypescriptExtension, getCursorStateDbPath, mergeDisabledExtension, } from './cursor';
10
+ export { writeTinycastConfig } from './tinycast';
package/build/index.js CHANGED
@@ -1,43 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeDisabledExtension = exports.getCursorStateDbPath = exports.disableCursorTypescriptExtension = exports.CURSOR_TYPESCRIPT_EXTENSION_ID = exports.setupEnv = exports.downloadClashBinary = exports.writeClashConfig = exports.setupAndroidEnvironment = exports.setupDevEnvironment = exports.installAllAgentsDeps = exports.writeAllAgentsConfig = exports.installOpencodeDeps = exports.writeOpencodeConfig = exports.installCodexDeps = exports.writeCodexConfig = exports.installDeps = exports.writeClaudeConfig = void 0;
4
- exports.writeRaycastConfig = writeRaycastConfig;
5
- const fs = require("fs");
6
- const path = require("path");
7
- const os = require("os");
8
- const utils_1 = require("./utils");
9
- function getRaycastAIConfigDir() {
10
- return path.join(os.homedir(), '.config', 'raycast', 'ai');
11
- }
12
- const RAYCAST_PROVIDERS_YAML_TEMPLATE = `providers:
13
- - id: my_provider
14
- name: gengjiawen AI
15
- base_url: https://ai.gengjiawen.com/api/openai/v1/
16
- api_keys:
17
- openai: API_KEY_PLACEHOLDER
18
- models:
19
- - id: sota
20
- name: "sota"
21
- context: 200000
22
- provider: openai
23
- abilities:
24
- temperature:
25
- supported: true
26
- vision:
27
- supported: true
28
- system_message:
29
- supported: true
30
- tools:
31
- supported: true
32
- `;
33
- function writeRaycastConfig(apiKey) {
34
- const configDir = getRaycastAIConfigDir();
35
- (0, utils_1.ensureDir)(configDir);
36
- const configPath = path.join(configDir, 'providers.yaml');
37
- const content = RAYCAST_PROVIDERS_YAML_TEMPLATE.replace('API_KEY_PLACEHOLDER', apiKey);
38
- fs.writeFileSync(configPath, content);
39
- return { configPath };
40
- }
3
+ exports.writeTinycastConfig = exports.mergeDisabledExtension = exports.getCursorStateDbPath = exports.disableCursorTypescriptExtension = exports.CURSOR_TYPESCRIPT_EXTENSION_ID = exports.setupEnv = exports.downloadClashBinary = exports.writeClashConfig = exports.setupAndroidEnvironment = exports.setupDevEnvironment = exports.installAllAgentsDeps = exports.writeAllAgentsConfig = exports.installOpencodeDeps = exports.writeOpencodeConfig = exports.installCodexDeps = exports.writeCodexConfig = exports.installDeps = exports.writeClaudeConfig = void 0;
41
4
  var claude_code_1 = require("./claude-code");
42
5
  Object.defineProperty(exports, "writeClaudeConfig", { enumerable: true, get: function () { return claude_code_1.writeClaudeConfig; } });
43
6
  Object.defineProperty(exports, "installDeps", { enumerable: true, get: function () { return claude_code_1.installDeps; } });
@@ -64,3 +27,5 @@ Object.defineProperty(exports, "CURSOR_TYPESCRIPT_EXTENSION_ID", { enumerable: t
64
27
  Object.defineProperty(exports, "disableCursorTypescriptExtension", { enumerable: true, get: function () { return cursor_1.disableCursorTypescriptExtension; } });
65
28
  Object.defineProperty(exports, "getCursorStateDbPath", { enumerable: true, get: function () { return cursor_1.getCursorStateDbPath; } });
66
29
  Object.defineProperty(exports, "mergeDisabledExtension", { enumerable: true, get: function () { return cursor_1.mergeDisabledExtension; } });
30
+ var tinycast_1 = require("./tinycast");
31
+ Object.defineProperty(exports, "writeTinycastConfig", { enumerable: true, get: function () { return tinycast_1.writeTinycastConfig; } });
@@ -0,0 +1,16 @@
1
+ export interface TinycastConnection {
2
+ id: string;
3
+ name: string;
4
+ provider: string;
5
+ baseURL: string;
6
+ models: string[];
7
+ visionModels: string[];
8
+ }
9
+ export declare function buildTinycastConnection(): TinycastConnection;
10
+ export declare function buildTinycastDefaultModel(): unknown;
11
+ export declare function mergeTinycastConnections(existing: TinycastConnection[], connection: TinycastConnection): TinycastConnection[];
12
+ export declare function encodeDefaultsData(value: unknown): string;
13
+ export declare function writeTinycastConfig(apiKey: string): Promise<{
14
+ connectionId: string;
15
+ baseURL: string;
16
+ }>;
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildTinycastConnection = buildTinycastConnection;
4
+ exports.buildTinycastDefaultModel = buildTinycastDefaultModel;
5
+ exports.mergeTinycastConnections = mergeTinycastConnections;
6
+ exports.encodeDefaultsData = encodeDefaultsData;
7
+ exports.writeTinycastConfig = writeTinycastConfig;
8
+ const execa_1 = require("execa");
9
+ const TINYCAST_BUNDLE_ID = 'com.tinycast.app';
10
+ const TINYCAST_KEYCHAIN_SERVICE = `${TINYCAST_BUNDLE_ID}.ai-api-keys`;
11
+ const TINYCAST_BASE_URL = 'https://ai.gengjiawen.com/api/openai/v1';
12
+ const TINYCAST_DEFAULT_MODEL = 'sota';
13
+ const TINYCAST_MODEL_IDS = [
14
+ TINYCAST_DEFAULT_MODEL,
15
+ 'gpt',
16
+ 'glm',
17
+ 'kimi',
18
+ 'minimax',
19
+ 'deepseek',
20
+ ];
21
+ const TINYCAST_CONNECTION_ID = '7E3A1C04-9B52-5F86-A1D7-0C4E8B2F6A93';
22
+ function buildTinycastConnection() {
23
+ return {
24
+ id: TINYCAST_CONNECTION_ID,
25
+ name: 'gengjiawen AI',
26
+ provider: 'openAICompatible',
27
+ baseURL: TINYCAST_BASE_URL,
28
+ models: TINYCAST_MODEL_IDS,
29
+ visionModels: [],
30
+ };
31
+ }
32
+ function buildTinycastDefaultModel() {
33
+ return {
34
+ api: { connection: TINYCAST_CONNECTION_ID, model: TINYCAST_DEFAULT_MODEL },
35
+ };
36
+ }
37
+ function mergeTinycastConnections(existing, connection) {
38
+ const index = existing.findIndex((entry) => entry.id === connection.id);
39
+ if (index === -1) {
40
+ return [...existing, connection];
41
+ }
42
+ const merged = [...existing];
43
+ merged[index] = connection;
44
+ return merged;
45
+ }
46
+ function encodeDefaultsData(value) {
47
+ return Buffer.from(JSON.stringify(value), 'utf8').toString('hex');
48
+ }
49
+ function decodeConnections(base64) {
50
+ if (typeof base64 !== 'string') {
51
+ return [];
52
+ }
53
+ try {
54
+ const parsed = JSON.parse(Buffer.from(base64, 'base64').toString('utf8'));
55
+ return Array.isArray(parsed) ? parsed : [];
56
+ }
57
+ catch {
58
+ return [];
59
+ }
60
+ }
61
+ async function readTinycastDefaults() {
62
+ const exported = await (0, execa_1.execa)('defaults', ['export', TINYCAST_BUNDLE_ID, '-'], {
63
+ reject: false,
64
+ });
65
+ if (exported.exitCode !== 0 || exported.stdout.trim().length === 0) {
66
+ return {};
67
+ }
68
+ const converted = await (0, execa_1.execa)('plutil', ['-convert', 'json', '-o', '-', '-'], {
69
+ input: exported.stdout,
70
+ reject: false,
71
+ });
72
+ if (converted.exitCode !== 0) {
73
+ return {};
74
+ }
75
+ try {
76
+ return JSON.parse(converted.stdout);
77
+ }
78
+ catch {
79
+ return {};
80
+ }
81
+ }
82
+ async function assertTinycastNotRunning() {
83
+ const running = await (0, execa_1.execa)('pgrep', ['-x', 'Tinycast'], { reject: false });
84
+ if (running.exitCode === 0) {
85
+ throw new Error('Tinycast is running. Quit it first — a running app rewrites its own preferences and would discard this config.');
86
+ }
87
+ }
88
+ async function writeTinycastConfig(apiKey) {
89
+ if (process.platform !== 'darwin') {
90
+ throw new Error('Tinycast is macOS only.');
91
+ }
92
+ await assertTinycastNotRunning();
93
+ const connection = buildTinycastConnection();
94
+ const defaults = await readTinycastDefaults();
95
+ const connections = mergeTinycastConnections(decodeConnections(defaults.aiConnections), connection);
96
+ await (0, execa_1.execa)('defaults', [
97
+ 'write',
98
+ TINYCAST_BUNDLE_ID,
99
+ 'aiConnections',
100
+ '-data',
101
+ encodeDefaultsData(connections),
102
+ ]);
103
+ await (0, execa_1.execa)('defaults', [
104
+ 'write',
105
+ TINYCAST_BUNDLE_ID,
106
+ 'aiDefaultModel',
107
+ '-data',
108
+ encodeDefaultsData(buildTinycastDefaultModel()),
109
+ ]);
110
+ await (0, execa_1.execa)('defaults', [
111
+ 'write',
112
+ TINYCAST_BUNDLE_ID,
113
+ 'aiEnabled',
114
+ '-bool',
115
+ 'true',
116
+ ]);
117
+ await (0, execa_1.execa)('security', [
118
+ 'add-generic-password',
119
+ '-U',
120
+ '-s',
121
+ TINYCAST_KEYCHAIN_SERVICE,
122
+ '-a',
123
+ connection.id,
124
+ '-w',
125
+ apiKey,
126
+ ]);
127
+ return { connectionId: connection.id, baseURL: connection.baseURL };
128
+ }
@@ -81,7 +81,8 @@ describe('writeClaudeConfig', () => {
81
81
  expect(claudeSettings).toContain(
82
82
  '"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "128000"'
83
83
  )
84
- expect(claudeSettings).toContain('"CLAUDE_CODE_DISABLE_1M_CONTEXT": "1"')
84
+ expect(claudeSettings).not.toContain('CLAUDE_CODE_DISABLE_1M_CONTEXT')
85
+ expect(claudeSettings).not.toContain('CLAUDE_CODE_EFFORT_LEVEL')
85
86
  expect(claudeSettings).toContain('"CLAUDE_CODE_ATTRIBUTION_HEADER": "0"')
86
87
 
87
88
  const vscodeSettings = fs.readFileSync(result.vscodeSettingsPath, 'utf8')
@@ -94,7 +95,7 @@ describe('writeClaudeConfig', () => {
94
95
  )
95
96
  expect(vscodeSettings).toContain('"CLAUDE_CODE_AUTO_COMPACT_WINDOW"')
96
97
  expect(vscodeSettings).toContain('"128000"')
97
- expect(vscodeSettings).toContain('"CLAUDE_CODE_DISABLE_1M_CONTEXT"')
98
+ expect(vscodeSettings).not.toContain('CLAUDE_CODE_DISABLE_1M_CONTEXT')
98
99
  expect(vscodeSettings).toContain('"CLAUDE_CODE_ATTRIBUTION_HEADER"')
99
100
  expect(vscodeSettings).toContain('"0"')
100
101
  expect(vscodeSettings).toContain('"1"')
@@ -13,7 +13,6 @@ import {
13
13
 
14
14
  const CLAUDE_BASE_URL = 'https://ai.gengjiawen.com/api/claude/'
15
15
  const CLAUDE_AUTO_COMPACT_WINDOW = '128000'
16
- const CLAUDE_DISABLE_1M_CONTEXT = '1'
17
16
  const CLAUDE_ATTRIBUTION_HEADER = '0'
18
17
 
19
18
  /** Return Claude settings directory path */
@@ -49,13 +48,11 @@ function getVSCodeUserSettingsPath(): string {
49
48
  const CLAUDE_SETTINGS_TEMPLATE = `{
50
49
  "env": {
51
50
  "DISABLE_TELEMETRY": "1",
52
- "CLAUDE_CODE_EFFORT_LEVEL": "max",
53
51
  "OTEL_METRICS_EXPORTER": "otlp",
54
52
  "ANTHROPIC_API_KEY": "API_KEY_PLACEHOLDER",
55
53
  "ANTHROPIC_BASE_URL": "${CLAUDE_BASE_URL}",
56
54
  "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
57
55
  "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "${CLAUDE_AUTO_COMPACT_WINDOW}",
58
- "CLAUDE_CODE_DISABLE_1M_CONTEXT": "${CLAUDE_DISABLE_1M_CONTEXT}",
59
56
  "CLAUDE_CODE_ATTRIBUTION_HEADER": "${CLAUDE_ATTRIBUTION_HEADER}"
60
57
  },
61
58
  "includeCoAuthoredBy": false,
@@ -112,10 +109,6 @@ function writeVSCodeClaudePluginConfig(apiKey: string): {
112
109
  name: 'CLAUDE_CODE_AUTO_COMPACT_WINDOW',
113
110
  value: CLAUDE_AUTO_COMPACT_WINDOW,
114
111
  },
115
- {
116
- name: 'CLAUDE_CODE_DISABLE_1M_CONTEXT',
117
- value: CLAUDE_DISABLE_1M_CONTEXT,
118
- },
119
112
  {
120
113
  name: 'CLAUDE_CODE_ATTRIBUTION_HEADER',
121
114
  value: CLAUDE_ATTRIBUTION_HEADER,
@@ -23,7 +23,7 @@ describe('writeCodexConfig', () => {
23
23
  fs.rmSync(tempHome, { recursive: true, force: true })
24
24
  })
25
25
 
26
- test('writes config with bearer token and 128k auto compact threshold', () => {
26
+ test('writes config with bearer token and 156k auto compact threshold', () => {
27
27
  const result = writeCodexConfig('test-api-key')
28
28
  const configPath = path.join(tempHome, '.codex', 'config.toml')
29
29
  const authPath = path.join(tempHome, '.codex', 'auth.json')
@@ -40,7 +40,7 @@ describe('writeCodexConfig', () => {
40
40
  }
41
41
 
42
42
  expect(result.configPath).toBe(configPath)
43
- expect(config.model_auto_compact_token_limit).toBe(131072)
43
+ expect(config.model_auto_compact_token_limit).toBe(159744)
44
44
  expect(config.model_providers.jw.experimental_bearer_token).toBe(
45
45
  'test-api-key'
46
46
  )
@@ -95,7 +95,7 @@ custom_model = "keep-me"
95
95
  expect(config).not.toHaveProperty('service_tier')
96
96
  expect(config).not.toHaveProperty('model_catalog_json')
97
97
  expect(config.custom_flag).toBe(true)
98
- expect(config.model).toBe('gpt-5.6-sol')
98
+ expect(config.model).toBe('gpt-6.1-sol')
99
99
  expect(config).not.toHaveProperty('preferred_auth_method')
100
100
  expect(config.model_providers.jw.base_url).toBe(
101
101
  'https://ai.gengjiawen.com/api/openai'
@@ -134,7 +134,7 @@ base_url = "https://example.com"
134
134
  }
135
135
  }
136
136
 
137
- expect(config.model).toBe('gpt-5.6-sol')
137
+ expect(config.model).toBe('gpt-6.1-sol')
138
138
  expect(config).not.toHaveProperty('model_catalog_json')
139
139
  expect(config).not.toHaveProperty('preferred_auth_method')
140
140
  expect(config.model_providers.jw.name).toBe('jw')
@@ -166,6 +166,6 @@ base_url = "https://example.com"
166
166
  >
167
167
 
168
168
  expect(config).not.toHaveProperty('model_catalog_json')
169
- expect(config.model).toBe('gpt-5.6-sol')
169
+ expect(config.model).toBe('gpt-6.1-sol')
170
170
  })
171
171
  })
package/libs/codex.ts CHANGED
@@ -16,10 +16,10 @@ function getCodexConfigDir(): string {
16
16
 
17
17
  function getCodexConfigTomlTemplate(bearerToken: string): string {
18
18
  return `model_provider = "jw"
19
- model = "gpt-5.6-sol"
19
+ model = "gpt-6.1-sol"
20
20
  model_reasoning_effort = "high"
21
21
  plan_mode_reasoning_effort = "high"
22
- model_auto_compact_token_limit = 131072
22
+ model_auto_compact_token_limit = 159744
23
23
  disable_response_storage = true
24
24
  check_for_update_on_startup = false
25
25
 
package/libs/index.ts CHANGED
@@ -1,51 +1,3 @@
1
- import * as fs from 'fs'
2
- import * as path from 'path'
3
- import * as os from 'os'
4
- import { ensureDir } from './utils'
5
-
6
- /** Return Raycast AI configuration directory path */
7
- function getRaycastAIConfigDir(): string {
8
- return path.join(os.homedir(), '.config', 'raycast', 'ai')
9
- }
10
-
11
- /** Template for Raycast AI providers.yaml */
12
- const RAYCAST_PROVIDERS_YAML_TEMPLATE = `providers:
13
- - id: my_provider
14
- name: gengjiawen AI
15
- base_url: https://ai.gengjiawen.com/api/openai/v1/
16
- api_keys:
17
- openai: API_KEY_PLACEHOLDER
18
- models:
19
- - id: sota
20
- name: "sota"
21
- context: 200000
22
- provider: openai
23
- abilities:
24
- temperature:
25
- supported: true
26
- vision:
27
- supported: true
28
- system_message:
29
- supported: true
30
- tools:
31
- supported: true
32
- `
33
-
34
- /** Write Raycast AI providers.yaml */
35
- export function writeRaycastConfig(apiKey: string): { configPath: string } {
36
- const configDir = getRaycastAIConfigDir()
37
- ensureDir(configDir)
38
-
39
- const configPath = path.join(configDir, 'providers.yaml')
40
- const content = RAYCAST_PROVIDERS_YAML_TEMPLATE.replace(
41
- 'API_KEY_PLACEHOLDER',
42
- apiKey
43
- )
44
- fs.writeFileSync(configPath, content)
45
-
46
- return { configPath }
47
- }
48
-
49
1
  // Re-export claude-code functionality
50
2
  export { writeClaudeConfig, installDeps } from './claude-code'
51
3
 
@@ -77,3 +29,6 @@ export {
77
29
  getCursorStateDbPath,
78
30
  mergeDisabledExtension,
79
31
  } from './cursor'
32
+
33
+ // Re-export Tinycast functionality
34
+ export { writeTinycastConfig } from './tinycast'
@@ -0,0 +1,196 @@
1
+ jest.mock('execa', () => ({
2
+ execa: jest.fn(),
3
+ }))
4
+
5
+ import { execa } from 'execa'
6
+ import {
7
+ buildTinycastConnection,
8
+ buildTinycastDefaultModel,
9
+ encodeDefaultsData,
10
+ mergeTinycastConnections,
11
+ writeTinycastConfig,
12
+ } from './tinycast'
13
+
14
+ const execaMock = execa as unknown as jest.Mock
15
+
16
+ const BUNDLE_ID = 'com.tinycast.app'
17
+
18
+ function decodeHex(hex: string) {
19
+ return JSON.parse(Buffer.from(hex, 'hex').toString('utf8'))
20
+ }
21
+
22
+ function callFor(command: string, ...args: string[]) {
23
+ return execaMock.mock.calls.find(
24
+ ([binary, argv]: [string, string[]]) =>
25
+ binary === command && args.every((arg, index) => argv[index] === arg)
26
+ )
27
+ }
28
+
29
+ describe('tinycast config builders', () => {
30
+ test('builds an OpenAI-compatible connection for the gateway', () => {
31
+ const connection = buildTinycastConnection()
32
+
33
+ expect(connection.provider).toBe('openAICompatible')
34
+ expect(connection.baseURL).toBe('https://ai.gengjiawen.com/api/openai/v1')
35
+ expect(connection.models).toContain('sota')
36
+ expect(connection.visionModels).toEqual([])
37
+ // Swift's UUID encodes uppercase, and Tinycast keys the Keychain item on it.
38
+ expect(connection.id).toBe(connection.id.toUpperCase())
39
+ })
40
+
41
+ test('selects sota on the connection it just built', () => {
42
+ expect(buildTinycastDefaultModel()).toEqual({
43
+ api: { connection: buildTinycastConnection().id, model: 'sota' },
44
+ })
45
+ })
46
+
47
+ test('replaces our connection and keeps the rest', () => {
48
+ const connection = buildTinycastConnection()
49
+ const mine = { ...connection, models: ['stale'] }
50
+ const theirs = { ...connection, id: 'OTHER', name: 'theirs' }
51
+
52
+ const merged = mergeTinycastConnections([theirs, mine], connection)
53
+
54
+ expect(merged).toHaveLength(2)
55
+ expect(merged[0]).toBe(theirs)
56
+ expect(merged[1].models).toEqual(connection.models)
57
+ })
58
+
59
+ test('appends when no connection of ours is stored yet', () => {
60
+ const connection = buildTinycastConnection()
61
+ const theirs = { ...connection, id: 'OTHER', name: 'theirs' }
62
+
63
+ expect(mergeTinycastConnections([theirs], connection)).toEqual([
64
+ theirs,
65
+ connection,
66
+ ])
67
+ })
68
+
69
+ test('encodes defaults data as the hex `defaults write -data` takes', () => {
70
+ expect(decodeHex(encodeDefaultsData({ a: 1 }))).toEqual({ a: 1 })
71
+ })
72
+ })
73
+
74
+ describe('writeTinycastConfig', () => {
75
+ const originalPlatform = Object.getOwnPropertyDescriptor(process, 'platform')
76
+
77
+ function setPlatform(platform: string) {
78
+ Object.defineProperty(process, 'platform', { value: platform })
79
+ }
80
+
81
+ beforeEach(() => {
82
+ execaMock.mockReset()
83
+ setPlatform('darwin')
84
+ })
85
+
86
+ afterEach(() => {
87
+ if (originalPlatform) {
88
+ Object.defineProperty(process, 'platform', originalPlatform)
89
+ }
90
+ })
91
+
92
+ function mockExeca(existingConnections?: unknown) {
93
+ execaMock.mockImplementation(async (command: string, args: string[]) => {
94
+ if (command === 'pgrep') {
95
+ return { exitCode: 1, stdout: '' }
96
+ }
97
+ if (command === 'defaults' && args[0] === 'export') {
98
+ return existingConnections === undefined
99
+ ? { exitCode: 1, stdout: '' }
100
+ : { exitCode: 0, stdout: '<plist/>' }
101
+ }
102
+ if (command === 'plutil') {
103
+ return {
104
+ exitCode: 0,
105
+ stdout: JSON.stringify({
106
+ aiConnections: Buffer.from(
107
+ JSON.stringify(existingConnections)
108
+ ).toString('base64'),
109
+ }),
110
+ }
111
+ }
112
+ return { exitCode: 0, stdout: '' }
113
+ })
114
+ }
115
+
116
+ test('writes the connection, the selection, the switch and the key', async () => {
117
+ mockExeca()
118
+
119
+ const result = await writeTinycastConfig('test-api-key')
120
+
121
+ const connection = buildTinycastConnection()
122
+ expect(result).toEqual({
123
+ connectionId: connection.id,
124
+ baseURL: connection.baseURL,
125
+ })
126
+
127
+ const connectionsCall = callFor(
128
+ 'defaults',
129
+ 'write',
130
+ BUNDLE_ID,
131
+ 'aiConnections'
132
+ )
133
+ expect(decodeHex(connectionsCall![1][4])).toEqual([connection])
134
+
135
+ const modelCall = callFor('defaults', 'write', BUNDLE_ID, 'aiDefaultModel')
136
+ expect(decodeHex(modelCall![1][4])).toEqual(buildTinycastDefaultModel())
137
+
138
+ // AI Chat is off out of the box, so configuring it has to arm it too.
139
+ expect(callFor('defaults', 'write', BUNDLE_ID, 'aiEnabled')).toBeDefined()
140
+
141
+ const keychainCall = callFor('security', 'add-generic-password')
142
+ expect(keychainCall![1]).toEqual([
143
+ 'add-generic-password',
144
+ '-U',
145
+ '-s',
146
+ 'com.tinycast.app.ai-api-keys',
147
+ '-a',
148
+ connection.id,
149
+ '-w',
150
+ 'test-api-key',
151
+ ])
152
+ })
153
+
154
+ test('keeps connections the user configured themselves', async () => {
155
+ const theirs = { ...buildTinycastConnection(), id: 'OTHER', name: 'theirs' }
156
+ mockExeca([theirs])
157
+
158
+ await writeTinycastConfig('test-api-key')
159
+
160
+ const connectionsCall = callFor(
161
+ 'defaults',
162
+ 'write',
163
+ BUNDLE_ID,
164
+ 'aiConnections'
165
+ )
166
+ expect(decodeHex(connectionsCall![1][4])).toEqual([
167
+ theirs,
168
+ buildTinycastConnection(),
169
+ ])
170
+ })
171
+
172
+ test('refuses while Tinycast is running, before writing anything', async () => {
173
+ execaMock.mockImplementation(async (command: string) => {
174
+ if (command === 'pgrep') {
175
+ return { exitCode: 0, stdout: '4242' }
176
+ }
177
+ return { exitCode: 0, stdout: '' }
178
+ })
179
+
180
+ await expect(writeTinycastConfig('test-api-key')).rejects.toThrow(
181
+ /Quit it first/
182
+ )
183
+ expect(callFor('defaults', 'write')).toBeUndefined()
184
+ expect(callFor('security')).toBeUndefined()
185
+ })
186
+
187
+ test('refuses off macOS', async () => {
188
+ setPlatform('linux')
189
+ mockExeca()
190
+
191
+ await expect(writeTinycastConfig('test-api-key')).rejects.toThrow(
192
+ 'Tinycast is macOS only.'
193
+ )
194
+ expect(execaMock).not.toHaveBeenCalled()
195
+ })
196
+ })
@@ -0,0 +1,188 @@
1
+ import { execa } from 'execa'
2
+
3
+ /**
4
+ * Tinycast keeps AI connections in `UserDefaults` and the key in the login
5
+ * Keychain, and excludes both from its settings import on purpose, so there is
6
+ * no config file to write. These are the two stores it reads at launch; see the
7
+ * app's `AppSettingsKey` and `KeychainSecretStore`.
8
+ */
9
+ const TINYCAST_BUNDLE_ID = 'com.tinycast.app'
10
+ const TINYCAST_KEYCHAIN_SERVICE = `${TINYCAST_BUNDLE_ID}.ai-api-keys`
11
+ const TINYCAST_BASE_URL = 'https://ai.gengjiawen.com/api/openai/v1'
12
+ const TINYCAST_DEFAULT_MODEL = 'sota'
13
+ const TINYCAST_MODEL_IDS = [
14
+ TINYCAST_DEFAULT_MODEL,
15
+ 'gpt',
16
+ 'glm',
17
+ 'kimi',
18
+ 'minimax',
19
+ 'deepseek',
20
+ ]
21
+
22
+ /**
23
+ * Fixed rather than random: the key is stored under the connection id, so a
24
+ * stable id lets a re-run update this connection instead of appending a
25
+ * duplicate and orphaning the previous Keychain item. Uppercase because that is
26
+ * what Swift's `UUID` encodes to.
27
+ */
28
+ const TINYCAST_CONNECTION_ID = '7E3A1C04-9B52-5F86-A1D7-0C4E8B2F6A93'
29
+
30
+ export interface TinycastConnection {
31
+ id: string
32
+ name: string
33
+ provider: string
34
+ baseURL: string
35
+ models: string[]
36
+ visionModels: string[]
37
+ }
38
+
39
+ /** Build the `AIConnection` Tinycast decodes from the `aiConnections` default */
40
+ export function buildTinycastConnection(): TinycastConnection {
41
+ return {
42
+ id: TINYCAST_CONNECTION_ID,
43
+ name: 'gengjiawen AI',
44
+ // The only preset with a user-editable base URL, which is what a gateway needs.
45
+ provider: 'openAICompatible',
46
+ baseURL: TINYCAST_BASE_URL,
47
+ models: TINYCAST_MODEL_IDS,
48
+ visionModels: [],
49
+ }
50
+ }
51
+
52
+ /** Build the `AIModelSelection` Tinycast decodes from the `aiDefaultModel` default */
53
+ export function buildTinycastDefaultModel(): unknown {
54
+ return {
55
+ api: { connection: TINYCAST_CONNECTION_ID, model: TINYCAST_DEFAULT_MODEL },
56
+ }
57
+ }
58
+
59
+ /** Replace our connection in place, leaving every other one the user has */
60
+ export function mergeTinycastConnections(
61
+ existing: TinycastConnection[],
62
+ connection: TinycastConnection
63
+ ): TinycastConnection[] {
64
+ const index = existing.findIndex((entry) => entry.id === connection.id)
65
+ if (index === -1) {
66
+ return [...existing, connection]
67
+ }
68
+ const merged = [...existing]
69
+ merged[index] = connection
70
+ return merged
71
+ }
72
+
73
+ /** `defaults write -data` takes hex, and these defaults hold JSON-encoded data */
74
+ export function encodeDefaultsData(value: unknown): string {
75
+ return Buffer.from(JSON.stringify(value), 'utf8').toString('hex')
76
+ }
77
+
78
+ function decodeConnections(base64: unknown): TinycastConnection[] {
79
+ if (typeof base64 !== 'string') {
80
+ return []
81
+ }
82
+ try {
83
+ const parsed = JSON.parse(Buffer.from(base64, 'base64').toString('utf8'))
84
+ return Array.isArray(parsed) ? parsed : []
85
+ } catch {
86
+ // A default we cannot read is one Tinycast wrote in a shape we do not know.
87
+ return []
88
+ }
89
+ }
90
+
91
+ /** Read the app's current defaults through `cfprefsd`, not the plist file */
92
+ async function readTinycastDefaults(): Promise<Record<string, unknown>> {
93
+ const exported = await execa(
94
+ 'defaults',
95
+ ['export', TINYCAST_BUNDLE_ID, '-'],
96
+ {
97
+ reject: false,
98
+ }
99
+ )
100
+ if (exported.exitCode !== 0 || exported.stdout.trim().length === 0) {
101
+ return {}
102
+ }
103
+ const converted = await execa(
104
+ 'plutil',
105
+ ['-convert', 'json', '-o', '-', '-'],
106
+ {
107
+ input: exported.stdout,
108
+ reject: false,
109
+ }
110
+ )
111
+ if (converted.exitCode !== 0) {
112
+ return {}
113
+ }
114
+ try {
115
+ return JSON.parse(converted.stdout)
116
+ } catch {
117
+ return {}
118
+ }
119
+ }
120
+
121
+ async function assertTinycastNotRunning(): Promise<void> {
122
+ const running = await execa('pgrep', ['-x', 'Tinycast'], { reject: false })
123
+ if (running.exitCode === 0) {
124
+ throw new Error(
125
+ 'Tinycast is running. Quit it first — a running app rewrites its own preferences and would discard this config.'
126
+ )
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Point Tinycast's AI Chat at the gateway.
132
+ *
133
+ * Writes the connection and the default model to `com.tinycast.app`'s defaults,
134
+ * enables AI Chat (off out of the box), and stores the key in the login Keychain
135
+ * under the connection id. macOS only.
136
+ */
137
+ export async function writeTinycastConfig(
138
+ apiKey: string
139
+ ): Promise<{ connectionId: string; baseURL: string }> {
140
+ if (process.platform !== 'darwin') {
141
+ throw new Error('Tinycast is macOS only.')
142
+ }
143
+
144
+ await assertTinycastNotRunning()
145
+
146
+ const connection = buildTinycastConnection()
147
+ const defaults = await readTinycastDefaults()
148
+ const connections = mergeTinycastConnections(
149
+ decodeConnections(defaults.aiConnections),
150
+ connection
151
+ )
152
+
153
+ await execa('defaults', [
154
+ 'write',
155
+ TINYCAST_BUNDLE_ID,
156
+ 'aiConnections',
157
+ '-data',
158
+ encodeDefaultsData(connections),
159
+ ])
160
+ await execa('defaults', [
161
+ 'write',
162
+ TINYCAST_BUNDLE_ID,
163
+ 'aiDefaultModel',
164
+ '-data',
165
+ encodeDefaultsData(buildTinycastDefaultModel()),
166
+ ])
167
+ await execa('defaults', [
168
+ 'write',
169
+ TINYCAST_BUNDLE_ID,
170
+ 'aiEnabled',
171
+ '-bool',
172
+ 'true',
173
+ ])
174
+
175
+ // `-U` updates the item when a previous run already stored a key for this id.
176
+ await execa('security', [
177
+ 'add-generic-password',
178
+ '-U',
179
+ '-s',
180
+ TINYCAST_KEYCHAIN_SERVICE,
181
+ '-a',
182
+ connection.id,
183
+ '-w',
184
+ apiKey,
185
+ ])
186
+
187
+ return { connectionId: connection.id, baseURL: connection.baseURL }
188
+ }
package/macOS-init.md CHANGED
@@ -21,8 +21,11 @@ brew install google-chrome
21
21
  brew install jetbrains-toolbox
22
22
  brew install omnidisksweeper
23
23
  brew install git-lfs
24
- brew install jordanbaird-ice
25
- brew install raycast
24
+ # Tinycast ships from its own tap. Apple silicon + macOS 26 or newer;
25
+ # on Intel install `tinycast-universal` instead.
26
+ brew trust --tap abue-ammar/tinycast
27
+ brew tap abue-ammar/tinycast
28
+ brew install --cask tinycast
26
29
  sudo n lts
27
30
  rustup-init -y
28
31
  sudo git lfs install --system
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gengjiawen/os-init",
3
3
  "private": false,
4
- "version": "1.28.1",
4
+ "version": "2.1.0",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "bin": {