yzcode-cli 1.0.1 → 1.0.3
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/assistant/sessionHistory.ts +87 -0
- package/bootstrap/state.ts +1769 -0
- package/bridge/bridgeApi.ts +539 -0
- package/bridge/bridgeConfig.ts +48 -0
- package/bridge/bridgeDebug.ts +135 -0
- package/bridge/bridgeEnabled.ts +202 -0
- package/bridge/bridgeMain.ts +2999 -0
- package/bridge/bridgeMessaging.ts +461 -0
- package/bridge/bridgePermissionCallbacks.ts +43 -0
- package/bridge/bridgePointer.ts +210 -0
- package/bridge/bridgeStatusUtil.ts +163 -0
- package/bridge/bridgeUI.ts +530 -0
- package/bridge/capacityWake.ts +56 -0
- package/bridge/codeSessionApi.ts +168 -0
- package/bridge/createSession.ts +384 -0
- package/bridge/debugUtils.ts +141 -0
- package/bridge/envLessBridgeConfig.ts +165 -0
- package/bridge/flushGate.ts +71 -0
- package/bridge/inboundAttachments.ts +175 -0
- package/bridge/inboundMessages.ts +80 -0
- package/bridge/initReplBridge.ts +569 -0
- package/bridge/jwtUtils.ts +256 -0
- package/bridge/pollConfig.ts +110 -0
- package/bridge/pollConfigDefaults.ts +82 -0
- package/bridge/remoteBridgeCore.ts +1008 -0
- package/bridge/replBridge.ts +2406 -0
- package/bridge/replBridgeHandle.ts +36 -0
- package/bridge/replBridgeTransport.ts +370 -0
- package/bridge/sessionIdCompat.ts +57 -0
- package/bridge/sessionRunner.ts +550 -0
- package/bridge/trustedDevice.ts +210 -0
- package/bridge/types.ts +262 -0
- package/bridge/workSecret.ts +127 -0
- package/buddy/CompanionSprite.tsx +371 -0
- package/buddy/companion.ts +133 -0
- package/buddy/prompt.ts +36 -0
- package/buddy/sprites.ts +514 -0
- package/buddy/types.ts +148 -0
- package/buddy/useBuddyNotification.tsx +98 -0
- package/coordinator/coordinatorMode.ts +369 -0
- package/memdir/findRelevantMemories.ts +141 -0
- package/memdir/memdir.ts +507 -0
- package/memdir/memoryAge.ts +53 -0
- package/memdir/memoryScan.ts +94 -0
- package/memdir/memoryTypes.ts +271 -0
- package/memdir/paths.ts +278 -0
- package/memdir/teamMemPaths.ts +292 -0
- package/memdir/teamMemPrompts.ts +100 -0
- package/migrations/migrateAutoUpdatesToSettings.ts +61 -0
- package/migrations/migrateBypassPermissionsAcceptedToSettings.ts +40 -0
- package/migrations/migrateEnableAllProjectMcpServersToSettings.ts +118 -0
- package/migrations/migrateFennecToOpus.ts +45 -0
- package/migrations/migrateLegacyOpusToCurrent.ts +57 -0
- package/migrations/migrateOpusToOpus1m.ts +43 -0
- package/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.ts +22 -0
- package/migrations/migrateSonnet1mToSonnet45.ts +48 -0
- package/migrations/migrateSonnet45ToSonnet46.ts +67 -0
- package/migrations/resetAutoModeOptInForDefaultOffer.ts +51 -0
- package/migrations/resetProToOpusDefault.ts +51 -0
- package/native-ts/color-diff/index.ts +999 -0
- package/native-ts/file-index/index.ts +370 -0
- package/native-ts/yoga-layout/enums.ts +134 -0
- package/native-ts/yoga-layout/index.ts +2578 -0
- package/outputStyles/loadOutputStylesDir.ts +98 -0
- package/package.json +22 -5
- package/plugins/builtinPlugins.ts +159 -0
- package/plugins/bundled/index.ts +23 -0
- package/schemas/hooks.ts +222 -0
- package/screens/Doctor.tsx +575 -0
- package/screens/REPL.tsx +5006 -0
- package/screens/ResumeConversation.tsx +399 -0
- package/server/createDirectConnectSession.ts +88 -0
- package/server/directConnectManager.ts +213 -0
- package/server/types.ts +57 -0
- package/skills/bundled/batch.ts +124 -0
- package/skills/bundled/claudeApi.ts +196 -0
- package/skills/bundled/claudeApiContent.ts +75 -0
- package/skills/bundled/claudeInChrome.ts +34 -0
- package/skills/bundled/debug.ts +103 -0
- package/skills/bundled/index.ts +79 -0
- package/skills/bundled/keybindings.ts +339 -0
- package/skills/bundled/loop.ts +92 -0
- package/skills/bundled/loremIpsum.ts +282 -0
- package/skills/bundled/remember.ts +82 -0
- package/skills/bundled/scheduleRemoteAgents.ts +447 -0
- package/skills/bundled/simplify.ts +69 -0
- package/skills/bundled/skillify.ts +197 -0
- package/skills/bundled/stuck.ts +79 -0
- package/skills/bundled/updateConfig.ts +475 -0
- package/skills/bundled/verify/SKILL.md +3 -0
- package/skills/bundled/verify/examples/cli.md +3 -0
- package/skills/bundled/verify/examples/server.md +3 -0
- package/skills/bundled/verify.ts +30 -0
- package/skills/bundled/verifyContent.ts +13 -0
- package/skills/bundledSkills.ts +220 -0
- package/skills/loadSkillsDir.ts +1086 -0
- package/skills/mcpSkillBuilders.ts +44 -0
- package/tasks/DreamTask/DreamTask.ts +157 -0
- package/tasks/InProcessTeammateTask/InProcessTeammateTask.tsx +126 -0
- package/tasks/InProcessTeammateTask/types.ts +121 -0
- package/tasks/LocalAgentTask/LocalAgentTask.tsx +683 -0
- package/tasks/LocalMainSessionTask.ts +479 -0
- package/tasks/LocalShellTask/LocalShellTask.tsx +523 -0
- package/tasks/LocalShellTask/guards.ts +41 -0
- package/tasks/LocalShellTask/killShellTasks.ts +76 -0
- package/tasks/RemoteAgentTask/RemoteAgentTask.tsx +856 -0
- package/tasks/pillLabel.ts +82 -0
- package/tasks/stopTask.ts +100 -0
- package/tasks/types.ts +46 -0
- package/upstreamproxy/relay.ts +455 -0
- package/upstreamproxy/upstreamproxy.ts +285 -0
- package/vim/motions.ts +82 -0
- package/vim/operators.ts +556 -0
- package/vim/textObjects.ts +186 -0
- package/vim/transitions.ts +490 -0
- package/vim/types.ts +199 -0
- package/voice/voiceModeEnabled.ts +54 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
|
3
|
+
logEvent,
|
|
4
|
+
} from '../services/analytics/index.js'
|
|
5
|
+
import { saveGlobalConfig } from '../utils/config.js'
|
|
6
|
+
import { isLegacyModelRemapEnabled } from '../utils/model/model.js'
|
|
7
|
+
import { getAPIProvider } from '../utils/model/providers.js'
|
|
8
|
+
import {
|
|
9
|
+
getSettingsForSource,
|
|
10
|
+
updateSettingsForSource,
|
|
11
|
+
} from '../utils/settings/settings.js'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Migrate first-party users off explicit Opus 4.0/4.1 model strings.
|
|
15
|
+
*
|
|
16
|
+
* The 'opus' alias already resolves to Opus 4.6 for 1P, so anyone still
|
|
17
|
+
* on an explicit 4.0/4.1 string pinned it in settings before 4.5 launched.
|
|
18
|
+
* parseUserSpecifiedModel now silently remaps these at runtime anyway —
|
|
19
|
+
* this migration cleans up the settings file so /model shows the right
|
|
20
|
+
* thing, and sets a timestamp so the REPL can show a one-time notification.
|
|
21
|
+
*
|
|
22
|
+
* Only touches userSettings. Legacy strings in project/local/policy settings
|
|
23
|
+
* are left alone (we can't/shouldn't rewrite those) and are still remapped at
|
|
24
|
+
* runtime by parseUserSpecifiedModel. Reading and writing the same source
|
|
25
|
+
* keeps this idempotent without a completion flag, and avoids silently
|
|
26
|
+
* promoting 'opus' to the global default for users who only pinned it in one
|
|
27
|
+
* project.
|
|
28
|
+
*/
|
|
29
|
+
export function migrateLegacyOpusToCurrent(): void {
|
|
30
|
+
if (getAPIProvider() !== 'firstParty') {
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!isLegacyModelRemapEnabled()) {
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const model = getSettingsForSource('userSettings')?.model
|
|
39
|
+
if (
|
|
40
|
+
model !== 'claude-opus-4-20250514' &&
|
|
41
|
+
model !== 'claude-opus-4-1-20250805' &&
|
|
42
|
+
model !== 'claude-opus-4-0' &&
|
|
43
|
+
model !== 'claude-opus-4-1'
|
|
44
|
+
) {
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
updateSettingsForSource('userSettings', { model: 'opus' })
|
|
49
|
+
saveGlobalConfig(current => ({
|
|
50
|
+
...current,
|
|
51
|
+
legacyOpusMigrationTimestamp: Date.now(),
|
|
52
|
+
}))
|
|
53
|
+
logEvent('tengu_legacy_opus_migration', {
|
|
54
|
+
from_model:
|
|
55
|
+
model as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
|
56
|
+
})
|
|
57
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { logEvent } from '../services/analytics/index.js'
|
|
2
|
+
import {
|
|
3
|
+
getDefaultMainLoopModelSetting,
|
|
4
|
+
isOpus1mMergeEnabled,
|
|
5
|
+
parseUserSpecifiedModel,
|
|
6
|
+
} from '../utils/model/model.js'
|
|
7
|
+
import {
|
|
8
|
+
getSettingsForSource,
|
|
9
|
+
updateSettingsForSource,
|
|
10
|
+
} from '../utils/settings/settings.js'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Migrate users with 'opus' pinned in their settings to 'opus[1m]' when they
|
|
14
|
+
* are eligible for the merged Opus 1M experience (Max/Team Premium on 1P).
|
|
15
|
+
*
|
|
16
|
+
* CLI invocations with --model opus are unaffected: that flag is a runtime
|
|
17
|
+
* override and does not touch userSettings, so it continues to use plain Opus.
|
|
18
|
+
*
|
|
19
|
+
* Pro subscribers are skipped — they retain separate Opus and Opus 1M options.
|
|
20
|
+
* 3P users are skipped — their model strings are full model IDs, not aliases.
|
|
21
|
+
*
|
|
22
|
+
* Idempotent: only writes if userSettings.model is exactly 'opus'.
|
|
23
|
+
*/
|
|
24
|
+
export function migrateOpusToOpus1m(): void {
|
|
25
|
+
if (!isOpus1mMergeEnabled()) {
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const model = getSettingsForSource('userSettings')?.model
|
|
30
|
+
if (model !== 'opus') {
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const migrated = 'opus[1m]'
|
|
35
|
+
const modelToSet =
|
|
36
|
+
parseUserSpecifiedModel(migrated) ===
|
|
37
|
+
parseUserSpecifiedModel(getDefaultMainLoopModelSetting())
|
|
38
|
+
? undefined
|
|
39
|
+
: migrated
|
|
40
|
+
updateSettingsForSource('userSettings', { model: modelToSet })
|
|
41
|
+
|
|
42
|
+
logEvent('tengu_opus_to_opus1m_migration', {})
|
|
43
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { saveGlobalConfig } from '../utils/config.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Migrate the `replBridgeEnabled` config key to `remoteControlAtStartup`.
|
|
5
|
+
*
|
|
6
|
+
* The old key was an implementation detail that leaked into user-facing config.
|
|
7
|
+
* This migration copies the value to the new key and removes the old one.
|
|
8
|
+
* Idempotent — only acts when the old key exists and the new one doesn't.
|
|
9
|
+
*/
|
|
10
|
+
export function migrateReplBridgeEnabledToRemoteControlAtStartup(): void {
|
|
11
|
+
saveGlobalConfig(prev => {
|
|
12
|
+
// The old key is no longer in the GlobalConfig type, so access it via
|
|
13
|
+
// an untyped cast. Only migrate if the old key exists and the new key
|
|
14
|
+
// hasn't been set yet.
|
|
15
|
+
const oldValue = (prev as Record<string, unknown>)['replBridgeEnabled']
|
|
16
|
+
if (oldValue === undefined) return prev
|
|
17
|
+
if (prev.remoteControlAtStartup !== undefined) return prev
|
|
18
|
+
const next = { ...prev, remoteControlAtStartup: Boolean(oldValue) }
|
|
19
|
+
delete (next as Record<string, unknown>)['replBridgeEnabled']
|
|
20
|
+
return next
|
|
21
|
+
})
|
|
22
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getMainLoopModelOverride,
|
|
3
|
+
setMainLoopModelOverride,
|
|
4
|
+
} from '../bootstrap/state.js'
|
|
5
|
+
import { getGlobalConfig, saveGlobalConfig } from '../utils/config.js'
|
|
6
|
+
import {
|
|
7
|
+
getSettingsForSource,
|
|
8
|
+
updateSettingsForSource,
|
|
9
|
+
} from '../utils/settings/settings.js'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Migrate users who had "sonnet[1m]" saved to the explicit "sonnet-4-5-20250929[1m]".
|
|
13
|
+
*
|
|
14
|
+
* The "sonnet" alias now resolves to Sonnet 4.6, so users who previously set
|
|
15
|
+
* "sonnet[1m]" (targeting Sonnet 4.5 with 1M context) need to be pinned to the
|
|
16
|
+
* explicit version to preserve their intended model.
|
|
17
|
+
*
|
|
18
|
+
* This is needed because Sonnet 4.6 1M was offered to a different group of users than
|
|
19
|
+
* Sonnet 4.5 1M, so we needed to pin existing sonnet[1m] users to Sonnet 4.5 1M.
|
|
20
|
+
*
|
|
21
|
+
* Reads from userSettings specifically (not merged settings) so we don't
|
|
22
|
+
* promote a project-scoped "sonnet[1m]" to the global default. Runs once,
|
|
23
|
+
* tracked by a completion flag in global config.
|
|
24
|
+
*/
|
|
25
|
+
export function migrateSonnet1mToSonnet45(): void {
|
|
26
|
+
const config = getGlobalConfig()
|
|
27
|
+
if (config.sonnet1m45MigrationComplete) {
|
|
28
|
+
return
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const model = getSettingsForSource('userSettings')?.model
|
|
32
|
+
if (model === 'sonnet[1m]') {
|
|
33
|
+
updateSettingsForSource('userSettings', {
|
|
34
|
+
model: 'sonnet-4-5-20250929[1m]',
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Also migrate the in-memory override if already set
|
|
39
|
+
const override = getMainLoopModelOverride()
|
|
40
|
+
if (override === 'sonnet[1m]') {
|
|
41
|
+
setMainLoopModelOverride('sonnet-4-5-20250929[1m]')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
saveGlobalConfig(current => ({
|
|
45
|
+
...current,
|
|
46
|
+
sonnet1m45MigrationComplete: true,
|
|
47
|
+
}))
|
|
48
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
|
3
|
+
logEvent,
|
|
4
|
+
} from '../services/analytics/index.js'
|
|
5
|
+
import {
|
|
6
|
+
isMaxSubscriber,
|
|
7
|
+
isProSubscriber,
|
|
8
|
+
isTeamPremiumSubscriber,
|
|
9
|
+
} from '../utils/auth.js'
|
|
10
|
+
import { getGlobalConfig, saveGlobalConfig } from '../utils/config.js'
|
|
11
|
+
import { getAPIProvider } from '../utils/model/providers.js'
|
|
12
|
+
import {
|
|
13
|
+
getSettingsForSource,
|
|
14
|
+
updateSettingsForSource,
|
|
15
|
+
} from '../utils/settings/settings.js'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Migrate Pro/Max/Team Premium first-party users off explicit Sonnet 4.5
|
|
19
|
+
* model strings to the 'sonnet' alias (which now resolves to Sonnet 4.6).
|
|
20
|
+
*
|
|
21
|
+
* Users may have been pinned to explicit Sonnet 4.5 strings by:
|
|
22
|
+
* - The earlier migrateSonnet1mToSonnet45 migration (sonnet[1m] → explicit 4.5[1m])
|
|
23
|
+
* - Manually selecting it via /model
|
|
24
|
+
*
|
|
25
|
+
* Reads userSettings specifically (not merged) so we only migrate what /model
|
|
26
|
+
* wrote — project/local pins are left alone.
|
|
27
|
+
* Idempotent: only writes if userSettings.model matches a Sonnet 4.5 string.
|
|
28
|
+
*/
|
|
29
|
+
export function migrateSonnet45ToSonnet46(): void {
|
|
30
|
+
if (getAPIProvider() !== 'firstParty') {
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!isProSubscriber() && !isMaxSubscriber() && !isTeamPremiumSubscriber()) {
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const model = getSettingsForSource('userSettings')?.model
|
|
39
|
+
if (
|
|
40
|
+
model !== 'claude-sonnet-4-5-20250929' &&
|
|
41
|
+
model !== 'claude-sonnet-4-5-20250929[1m]' &&
|
|
42
|
+
model !== 'sonnet-4-5-20250929' &&
|
|
43
|
+
model !== 'sonnet-4-5-20250929[1m]'
|
|
44
|
+
) {
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const has1m = model.endsWith('[1m]')
|
|
49
|
+
updateSettingsForSource('userSettings', {
|
|
50
|
+
model: has1m ? 'sonnet[1m]' : 'sonnet',
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
// Skip notification for brand-new users — they never experienced the old default
|
|
54
|
+
const config = getGlobalConfig()
|
|
55
|
+
if (config.numStartups > 1) {
|
|
56
|
+
saveGlobalConfig(current => ({
|
|
57
|
+
...current,
|
|
58
|
+
sonnet45To46MigrationTimestamp: Date.now(),
|
|
59
|
+
}))
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
logEvent('tengu_sonnet45_to_46_migration', {
|
|
63
|
+
from_model:
|
|
64
|
+
model as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
|
65
|
+
has_1m: has1m,
|
|
66
|
+
})
|
|
67
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { feature } from 'bun:bundle'
|
|
2
|
+
import { logEvent } from 'src/services/analytics/index.js'
|
|
3
|
+
import { getGlobalConfig, saveGlobalConfig } from '../utils/config.js'
|
|
4
|
+
import { logError } from '../utils/log.js'
|
|
5
|
+
import { getAutoModeEnabledState } from '../utils/permissions/permissionSetup.js'
|
|
6
|
+
import {
|
|
7
|
+
getSettingsForSource,
|
|
8
|
+
updateSettingsForSource,
|
|
9
|
+
} from '../utils/settings/settings.js'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* One-shot migration: clear skipAutoPermissionPrompt for users who accepted
|
|
13
|
+
* the old 2-option AutoModeOptInDialog but don't have auto as their default.
|
|
14
|
+
* Re-surfaces the dialog so they see the new "make it my default mode" option.
|
|
15
|
+
* Guard lives in GlobalConfig (~/.claude.json), not settings.json, so it
|
|
16
|
+
* survives settings resets and doesn't re-arm itself.
|
|
17
|
+
*
|
|
18
|
+
* Only runs when tengu_auto_mode_config.enabled === 'enabled'. For 'opt-in'
|
|
19
|
+
* users, clearing skipAutoPermissionPrompt would remove auto from the carousel
|
|
20
|
+
* (permissionSetup.ts:988) — the dialog would become unreachable and the
|
|
21
|
+
* migration would defeat itself. In practice the ~40 target ants are all
|
|
22
|
+
* 'enabled' (they reached the old dialog via bare Shift+Tab, which requires
|
|
23
|
+
* 'enabled'), but the guard makes it safe regardless.
|
|
24
|
+
*/
|
|
25
|
+
export function resetAutoModeOptInForDefaultOffer(): void {
|
|
26
|
+
if (feature('TRANSCRIPT_CLASSIFIER')) {
|
|
27
|
+
const config = getGlobalConfig()
|
|
28
|
+
if (config.hasResetAutoModeOptInForDefaultOffer) return
|
|
29
|
+
if (getAutoModeEnabledState() !== 'enabled') return
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
const user = getSettingsForSource('userSettings')
|
|
33
|
+
if (
|
|
34
|
+
user?.skipAutoPermissionPrompt &&
|
|
35
|
+
user?.permissions?.defaultMode !== 'auto'
|
|
36
|
+
) {
|
|
37
|
+
updateSettingsForSource('userSettings', {
|
|
38
|
+
skipAutoPermissionPrompt: undefined,
|
|
39
|
+
})
|
|
40
|
+
logEvent('tengu_migrate_reset_auto_opt_in_for_default_offer', {})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
saveGlobalConfig(c => {
|
|
44
|
+
if (c.hasResetAutoModeOptInForDefaultOffer) return c
|
|
45
|
+
return { ...c, hasResetAutoModeOptInForDefaultOffer: true }
|
|
46
|
+
})
|
|
47
|
+
} catch (error) {
|
|
48
|
+
logError(new Error(`Failed to reset auto mode opt-in: ${error}`))
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { logEvent } from 'src/services/analytics/index.js'
|
|
2
|
+
import { isProSubscriber } from '../utils/auth.js'
|
|
3
|
+
import { getGlobalConfig, saveGlobalConfig } from '../utils/config.js'
|
|
4
|
+
import { getAPIProvider } from '../utils/model/providers.js'
|
|
5
|
+
import { getSettings_DEPRECATED } from '../utils/settings/settings.js'
|
|
6
|
+
|
|
7
|
+
export function resetProToOpusDefault(): void {
|
|
8
|
+
const config = getGlobalConfig()
|
|
9
|
+
|
|
10
|
+
if (config.opusProMigrationComplete) {
|
|
11
|
+
return
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const apiProvider = getAPIProvider()
|
|
15
|
+
|
|
16
|
+
// Pro users on firstParty get auto-migrated to Opus 4.5 default
|
|
17
|
+
if (apiProvider !== 'firstParty' || !isProSubscriber()) {
|
|
18
|
+
saveGlobalConfig(current => ({
|
|
19
|
+
...current,
|
|
20
|
+
opusProMigrationComplete: true,
|
|
21
|
+
}))
|
|
22
|
+
logEvent('tengu_reset_pro_to_opus_default', { skipped: true })
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const settings = getSettings_DEPRECATED()
|
|
27
|
+
|
|
28
|
+
// Only show notification if user was on default (no custom model setting)
|
|
29
|
+
if (settings?.model === undefined) {
|
|
30
|
+
const opusProMigrationTimestamp = Date.now()
|
|
31
|
+
saveGlobalConfig(current => ({
|
|
32
|
+
...current,
|
|
33
|
+
opusProMigrationComplete: true,
|
|
34
|
+
opusProMigrationTimestamp,
|
|
35
|
+
}))
|
|
36
|
+
logEvent('tengu_reset_pro_to_opus_default', {
|
|
37
|
+
skipped: false,
|
|
38
|
+
had_custom_model: false,
|
|
39
|
+
})
|
|
40
|
+
} else {
|
|
41
|
+
// User has a custom model setting, just mark migration complete
|
|
42
|
+
saveGlobalConfig(current => ({
|
|
43
|
+
...current,
|
|
44
|
+
opusProMigrationComplete: true,
|
|
45
|
+
}))
|
|
46
|
+
logEvent('tengu_reset_pro_to_opus_default', {
|
|
47
|
+
skipped: false,
|
|
48
|
+
had_custom_model: true,
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
}
|