typeclaw 0.48.0 → 0.48.2
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/package.json +1 -1
- package/src/agent/plugin-tools.ts +68 -9
- package/src/agent/system-prompt.ts +8 -0
- package/src/agent-messenger/config-dir.ts +131 -0
- package/src/agent-messenger/host-config-dir.ts +121 -0
- package/src/bundled-plugins/guard/policies/managed-config.ts +7 -20
- package/src/bundled-plugins/guard/policies/non-workspace-write.ts +7 -20
- package/src/bundled-plugins/guard/policies/skill-authoring.ts +8 -20
- package/src/bundled-plugins/memory/README.md +2 -0
- package/src/bundled-plugins/memory/dreaming.ts +2 -0
- package/src/bundled-plugins/security/policies/private-surface-read.ts +10 -23
- package/src/cli/channel.ts +15 -16
- package/src/cli/hostd.ts +8 -13
- package/src/cli/init.ts +21 -7
- package/src/cli/model.ts +6 -3
- package/src/cli/restart.ts +13 -15
- package/src/compose/restart.ts +14 -6
- package/src/config/providers.ts +106 -143
- package/src/container/agent-operation-lock.ts +85 -0
- package/src/container/controller.ts +6 -0
- package/src/container/index.ts +8 -0
- package/src/container/restart.ts +55 -0
- package/src/container/shared.ts +5 -0
- package/src/container/start.ts +112 -4
- package/src/container/stop.ts +17 -1
- package/src/hostd/daemon.ts +1 -1
- package/src/hostd/paths.ts +17 -0
- package/src/hostd/supervisor.ts +27 -10
- package/src/init/dockerfile.ts +6 -5
- package/src/init/env-file.ts +42 -18
- package/src/init/instagram-auth.ts +55 -31
- package/src/init/kakaotalk-auth.ts +1 -5
- package/src/init/line-auth.ts +45 -29
- package/src/init/models-dev.ts +114 -7
- package/src/init/opengateway-catalog.ts +120 -0
- package/src/path-safety/real-intended-path.ts +111 -0
- package/src/sandbox/canonical-secrets.ts +10 -1
- package/src/sandbox/errors.ts +0 -32
- package/src/sandbox/privileged-runtime.ts +8 -94
- package/src/test-helpers/fake-agent-operation-lock.ts +66 -0
- package/typeclaw.schema.json +10 -30
package/src/cli/channel.ts
CHANGED
|
@@ -654,16 +654,12 @@ async function maybePromptCredentialRefresh(
|
|
|
654
654
|
return
|
|
655
655
|
}
|
|
656
656
|
|
|
657
|
-
const
|
|
658
|
-
if (!
|
|
659
|
-
console.error(errorLine(
|
|
660
|
-
process.exit(1)
|
|
661
|
-
}
|
|
662
|
-
const started = await controller.start({ cwd, preferredHostPort: config.port, cliEntry: process.argv[1] })
|
|
663
|
-
if (!started.ok) {
|
|
664
|
-
console.error(errorLine(`Restart failed during start: ${started.reason}`))
|
|
657
|
+
const restarted = await controller.restart({ cwd, preferredHostPort: config.port, cliEntry: process.argv[1] })
|
|
658
|
+
if (!restarted.ok) {
|
|
659
|
+
console.error(errorLine(formatRestartFailure(restarted.reason)))
|
|
665
660
|
process.exit(1)
|
|
666
661
|
}
|
|
662
|
+
const started = restarted.start
|
|
667
663
|
done({
|
|
668
664
|
title: c.green(`${label} ${verbPast}. Restarted ${started.plan.containerName} on host port ${started.hostPort}.`),
|
|
669
665
|
hints: [
|
|
@@ -2002,16 +1998,12 @@ async function maybePromptRestart(
|
|
|
2002
1998
|
return
|
|
2003
1999
|
}
|
|
2004
2000
|
|
|
2005
|
-
const
|
|
2006
|
-
if (!
|
|
2007
|
-
console.error(errorLine(
|
|
2008
|
-
process.exit(1)
|
|
2009
|
-
}
|
|
2010
|
-
const started = await controller.start({ cwd, preferredHostPort: config.port, cliEntry: process.argv[1] })
|
|
2011
|
-
if (!started.ok) {
|
|
2012
|
-
console.error(errorLine(`Restart failed during start: ${started.reason}`))
|
|
2001
|
+
const restarted = await controller.restart({ cwd, preferredHostPort: config.port, cliEntry: process.argv[1] })
|
|
2002
|
+
if (!restarted.ok) {
|
|
2003
|
+
console.error(errorLine(formatRestartFailure(restarted.reason)))
|
|
2013
2004
|
process.exit(1)
|
|
2014
2005
|
}
|
|
2006
|
+
const started = restarted.start
|
|
2015
2007
|
done({
|
|
2016
2008
|
title: c.green(
|
|
2017
2009
|
`${label} channel ${verb}. Restarted ${started.plan.containerName} on host port ${started.hostPort}.`,
|
|
@@ -2022,3 +2014,10 @@ async function maybePromptRestart(
|
|
|
2022
2014
|
],
|
|
2023
2015
|
})
|
|
2024
2016
|
}
|
|
2017
|
+
|
|
2018
|
+
function formatRestartFailure(reason: string): string {
|
|
2019
|
+
if (reason.startsWith('stop failed: ')) return `Restart failed during stop: ${reason.slice('stop failed: '.length)}`
|
|
2020
|
+
if (reason.startsWith('start failed: '))
|
|
2021
|
+
return `Restart failed during start: ${reason.slice('start failed: '.length)}`
|
|
2022
|
+
return `Restart failed: ${reason}`
|
|
2023
|
+
}
|
package/src/cli/hostd.ts
CHANGED
|
@@ -5,9 +5,8 @@ import {
|
|
|
5
5
|
resolveController,
|
|
6
6
|
resolveHostPort,
|
|
7
7
|
resolveTuiToken,
|
|
8
|
-
type
|
|
9
|
-
type
|
|
10
|
-
type StopResult,
|
|
8
|
+
type RestartOptions,
|
|
9
|
+
type RestartResult,
|
|
11
10
|
} from '@/container'
|
|
12
11
|
import {
|
|
13
12
|
applyCredentialRotation,
|
|
@@ -116,17 +115,15 @@ export const hostdCommand = defineCommand({
|
|
|
116
115
|
|
|
117
116
|
export type HostdRestartDeps = {
|
|
118
117
|
validateConfig: (cwd: string) => ValidateConfigResult
|
|
119
|
-
stop: (opts: { cwd: string }) => Promise<StopResult>
|
|
120
118
|
loadConfigSync: (cwd: string) => Config
|
|
121
|
-
|
|
119
|
+
restart: (opts: RestartOptions) => Promise<RestartResult>
|
|
122
120
|
}
|
|
123
121
|
|
|
124
122
|
const controller = resolveController()
|
|
125
123
|
const defaultRestartDeps: HostdRestartDeps = {
|
|
126
124
|
validateConfig,
|
|
127
|
-
stop: (opts) => controller.stop(opts),
|
|
128
125
|
loadConfigSync,
|
|
129
|
-
|
|
126
|
+
restart: (opts) => controller.restart(opts),
|
|
130
127
|
}
|
|
131
128
|
|
|
132
129
|
export function buildHostdRestart(
|
|
@@ -134,7 +131,7 @@ export function buildHostdRestart(
|
|
|
134
131
|
deps: HostdRestartDeps = defaultRestartDeps,
|
|
135
132
|
daemonVersion?: string,
|
|
136
133
|
): SupervisorRestart {
|
|
137
|
-
return async ({ containerName, cwd, build = false, currentHostDaemon }) => {
|
|
134
|
+
return async ({ containerName, cwd, build = false, currentHostDaemon, operationLease }) => {
|
|
138
135
|
const drift = await detectSourceDrift(cliEntry, daemonVersion)
|
|
139
136
|
if (drift) return { ok: false, reason: drift }
|
|
140
137
|
|
|
@@ -142,19 +139,17 @@ export function buildHostdRestart(
|
|
|
142
139
|
if (!validated.ok) {
|
|
143
140
|
return { ok: false, reason: `invalid config for ${containerName}: ${validated.reason}` }
|
|
144
141
|
}
|
|
145
|
-
const stopResult = await deps.stop({ cwd })
|
|
146
|
-
if (!stopResult.ok) return { ok: false, reason: `stop failed: ${stopResult.reason}` }
|
|
147
|
-
|
|
148
142
|
const cfg = deps.loadConfigSync(cwd)
|
|
149
|
-
const
|
|
143
|
+
const restartResult = await deps.restart({
|
|
150
144
|
cwd,
|
|
151
145
|
preferredHostPort: cfg.port,
|
|
152
146
|
forceBuild: build,
|
|
153
147
|
cliEntry,
|
|
154
148
|
reuseCurrentHostDaemon: true,
|
|
149
|
+
operationLease,
|
|
155
150
|
...(currentHostDaemon ? { currentHostDaemon } : {}),
|
|
156
151
|
})
|
|
157
|
-
if (!
|
|
152
|
+
if (!restartResult.ok) return restartResult
|
|
158
153
|
return { ok: true }
|
|
159
154
|
}
|
|
160
155
|
}
|
package/src/cli/init.ts
CHANGED
|
@@ -64,7 +64,12 @@ import {
|
|
|
64
64
|
type WizardCheckpointStore,
|
|
65
65
|
} from '@/init/checkpoint'
|
|
66
66
|
import { runKakaotalkBootstrap } from '@/init/kakaotalk-auth'
|
|
67
|
-
import {
|
|
67
|
+
import {
|
|
68
|
+
customModelMetaFromOption,
|
|
69
|
+
fetchModelOptions,
|
|
70
|
+
type FetchModelsResult,
|
|
71
|
+
type ModelOption,
|
|
72
|
+
} from '@/init/models-dev'
|
|
68
73
|
import { makeOAuthLoginRunner, type OAuthLoginResult } from '@/init/oauth-login'
|
|
69
74
|
import { detectInitProgress } from '@/init/progress'
|
|
70
75
|
import { runTeamsBootstrap } from '@/init/teams-auth'
|
|
@@ -1223,14 +1228,23 @@ function oauthDiscoveryRef(providerId: KnownProviderId): KnownModelRef {
|
|
|
1223
1228
|
|
|
1224
1229
|
async function loadCatalog(): Promise<NonNullable<WizardState['catalog']>> {
|
|
1225
1230
|
const s = spinner()
|
|
1226
|
-
s.start('Loading model
|
|
1227
|
-
const
|
|
1228
|
-
|
|
1229
|
-
|
|
1231
|
+
s.start('Loading model catalogs...')
|
|
1232
|
+
const result = await fetchModelOptions()
|
|
1233
|
+
const unavailable = catalogFallbackLabels(result)
|
|
1234
|
+
if (unavailable.length > 0) {
|
|
1235
|
+
s.stop(`Loaded model catalog with fallback for ${unavailable.join(', ')}.`)
|
|
1230
1236
|
} else {
|
|
1231
|
-
s.stop('Loaded model
|
|
1237
|
+
s.stop('Loaded model catalogs.')
|
|
1232
1238
|
}
|
|
1233
|
-
return
|
|
1239
|
+
return result
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
function catalogFallbackLabels(result: FetchModelsResult): string[] {
|
|
1243
|
+
const labels: string[] = []
|
|
1244
|
+
if (result.sources.modelsDev === 'unavailable') labels.push('native providers')
|
|
1245
|
+
if (result.sources.openGatewayCatalog === 'unavailable') labels.push('OpenGateway models')
|
|
1246
|
+
else if (result.sources.openGatewayPrices === 'unavailable') labels.push('OpenGateway prices')
|
|
1247
|
+
return labels
|
|
1234
1248
|
}
|
|
1235
1249
|
|
|
1236
1250
|
async function pickVendor(
|
package/src/cli/model.ts
CHANGED
|
@@ -541,15 +541,18 @@ function describeRef(ref: string): string {
|
|
|
541
541
|
}
|
|
542
542
|
|
|
543
543
|
async function printAvailableRefs(): Promise<void> {
|
|
544
|
-
const { options,
|
|
544
|
+
const { options, sources, warnings } = await fetchModelOptions()
|
|
545
545
|
if (options.length === 0) {
|
|
546
546
|
console.log(c.dim('No models registered.'))
|
|
547
547
|
return
|
|
548
548
|
}
|
|
549
549
|
console.log(c.dim('Use `typeclaw model set <profile> <ref>` to apply.'))
|
|
550
|
-
if (
|
|
551
|
-
|
|
550
|
+
if (sources.modelsDev === 'unavailable') console.log(c.dim('Using built-in models for native providers.'))
|
|
551
|
+
if (sources.openGatewayCatalog === 'unavailable') console.log(c.dim('Using the built-in OpenGateway anchor.'))
|
|
552
|
+
else if (sources.openGatewayPrices === 'unavailable') {
|
|
553
|
+
console.log(c.dim('OpenGateway models loaded without live pricing.'))
|
|
552
554
|
}
|
|
555
|
+
if (warnings.length > 0) console.log(c.dim(`Catalog warnings: ${warnings.join('; ')}`))
|
|
553
556
|
for (const providerId of Object.keys(KNOWN_PROVIDERS) as KnownProviderId[]) {
|
|
554
557
|
const providerOptions = options.filter((option) => option.providerId === providerId)
|
|
555
558
|
if (providerOptions.length === 0) continue
|
package/src/cli/restart.ts
CHANGED
|
@@ -74,28 +74,26 @@ export const restartCommand = defineCommand({
|
|
|
74
74
|
|
|
75
75
|
const stopSpin = spinner()
|
|
76
76
|
stopSpin.start('Stopping container...')
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
stopSpin.error(stopped.reason)
|
|
80
|
-
process.exit(1)
|
|
81
|
-
}
|
|
82
|
-
stopSpin.stop(stopped.running ? `Stopped ${c.cyan(stopped.containerName)}.` : 'Already stopped.')
|
|
83
|
-
|
|
84
|
-
const startSpin = spinner()
|
|
85
|
-
startSpin.start('Starting container...')
|
|
86
|
-
const started = await controller.start({
|
|
77
|
+
let startSpin: ReturnType<typeof spinner> | undefined
|
|
78
|
+
const restarted = await controller.restart({
|
|
87
79
|
cwd,
|
|
88
80
|
preferredHostPort: Number(args.port),
|
|
89
81
|
forceBuild: args.build,
|
|
90
82
|
cliEntry: process.argv[1],
|
|
83
|
+
onStopped: (stopped) => {
|
|
84
|
+
stopSpin.stop(stopped.running ? `Stopped ${c.cyan(stopped.containerName)}.` : 'Already stopped.')
|
|
85
|
+
startSpin = spinner()
|
|
86
|
+
startSpin.start('Starting container...')
|
|
87
|
+
},
|
|
91
88
|
})
|
|
92
|
-
if (!
|
|
93
|
-
startSpin.error(
|
|
89
|
+
if (!restarted.ok) {
|
|
90
|
+
if (startSpin === undefined) stopSpin.error(restarted.reason)
|
|
91
|
+
else startSpin.error(restarted.reason)
|
|
94
92
|
process.exit(1)
|
|
95
93
|
}
|
|
96
|
-
startSpin
|
|
94
|
+
startSpin?.stop('Started.')
|
|
97
95
|
|
|
98
|
-
reportConfigWarnings(
|
|
99
|
-
console.log(renderStartSuccess(
|
|
96
|
+
reportConfigWarnings(restarted.start.dockerfileWarnings)
|
|
97
|
+
console.log(renderStartSuccess(restarted.start))
|
|
100
98
|
},
|
|
101
99
|
})
|
package/src/compose/restart.ts
CHANGED
|
@@ -58,12 +58,20 @@ async function runOne(
|
|
|
58
58
|
if (!validated.ok) return { name, ok: false, reason: validated.reason }
|
|
59
59
|
try {
|
|
60
60
|
const controller = resolveController()
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
const restarted = await controller.restart({
|
|
62
|
+
cwd,
|
|
63
|
+
preferredHostPort,
|
|
64
|
+
forceBuild,
|
|
65
|
+
cliEntry,
|
|
66
|
+
onStopped,
|
|
67
|
+
})
|
|
68
|
+
if (!restarted.ok) return { name, ok: false, reason: restarted.reason }
|
|
69
|
+
return {
|
|
70
|
+
name,
|
|
71
|
+
ok: true,
|
|
72
|
+
data: { stop: restarted.stop, start: restarted.start },
|
|
73
|
+
warnings: validated.warnings,
|
|
74
|
+
}
|
|
67
75
|
} catch (error) {
|
|
68
76
|
return { name, ok: false, reason: error instanceof Error ? error.message : String(error) }
|
|
69
77
|
}
|
package/src/config/providers.ts
CHANGED
|
@@ -781,10 +781,14 @@ export const KNOWN_PROVIDERS = {
|
|
|
781
781
|
// the console, the OpenAI-SDK example, and the agent docs all use bare `/v1`.
|
|
782
782
|
//
|
|
783
783
|
// Model lineup spans two families on the same Console API + key:
|
|
784
|
-
// * Closed chat models
|
|
785
|
-
//
|
|
786
|
-
// solar-
|
|
787
|
-
//
|
|
784
|
+
// * Closed chat models. solar-pro4 (512K context / 128K output, released
|
|
785
|
+
// 2026-08-06, current flagship) is per the live model page
|
|
786
|
+
// console.upstage.ai/docs/models/solar-pro4; the rest are from the agent
|
|
787
|
+
// API reference (console.upstage.ai/api/docs/for-agents) as of
|
|
788
|
+
// 2026-03-23: solar-pro3 (102B MoE / 12B active, 128K), solar-pro2
|
|
789
|
+
// (31B, 65K), solar-mini (10.7B, 32K, cheap/fast). Note that the
|
|
790
|
+
// for-agents dump is stale (self-dated 2026-03-07) and omits pro4 — its
|
|
791
|
+
// absence there is not evidence the model is unavailable.
|
|
788
792
|
// * The open-weight Solar Open family: solar-open2 (Solar Open 2), a 102B
|
|
789
793
|
// MoE / 12B active model with a 128K context. It launched on the Console
|
|
790
794
|
// API for the Solar Agent Partner program (Stage 1, from 2026-07-17) —
|
|
@@ -799,6 +803,7 @@ export const KNOWN_PROVIDERS = {
|
|
|
799
803
|
// versioned release.
|
|
800
804
|
//
|
|
801
805
|
// Costs are USD per 1M tokens from upstage.ai/pricing/api (VAT-exclusive).
|
|
806
|
+
// solar-pro4 is $0.30 in / $1.20 out with a $0.06 "Input(Cached)" rate.
|
|
802
807
|
// solar-pro3/pro2 publish an "Input(Cached)" cache-read rate ($0.015); no
|
|
803
808
|
// cache-write surcharge is published, so cacheWrite is 0. solar-mini
|
|
804
809
|
// publishes a single flat $0.15 rate with no cache line, so cacheRead and
|
|
@@ -819,18 +824,37 @@ export const KNOWN_PROVIDERS = {
|
|
|
819
824
|
// definitions are both undocumented, so supportsUsageInStreaming and
|
|
820
825
|
// supportsStrictMode are false (both conservative — pi-ai defaults them to
|
|
821
826
|
// true, and Upstage only documents `strict` inside response_format.json_schema,
|
|
822
|
-
// never on tool defs). `reasoning_effort` IS documented for solar-
|
|
823
|
-
//
|
|
824
|
-
// there; solar-mini
|
|
827
|
+
// never on tool defs). `reasoning_effort` IS documented for solar-pro4,
|
|
828
|
+
// solar-open2, solar-pro3 and solar-pro2, so supportsReasoningEffort stays
|
|
829
|
+
// true there; solar-mini rejects it, so it is false and reasoning is off.
|
|
825
830
|
//
|
|
826
|
-
//
|
|
827
|
-
//
|
|
828
|
-
//
|
|
829
|
-
//
|
|
830
|
-
//
|
|
831
|
-
//
|
|
832
|
-
//
|
|
833
|
-
//
|
|
831
|
+
// Reasoning splits the lineup into two groups with OPPOSITE defaults, per
|
|
832
|
+
// Upstage's reasoning table (console.upstage.ai/docs/capabilities/generate/
|
|
833
|
+
// reasoning). pi adds an `xhigh` level that typeclaw's attention escalation
|
|
834
|
+
// can select (src/agent/attention-escalation.ts), and pi-ai passes the pi
|
|
835
|
+
// level straight through as reasoning_effort when no map is set, so each
|
|
836
|
+
// group needs a different `thinkingLevelMap`:
|
|
837
|
+
//
|
|
838
|
+
// * solar-pro4 and solar-open2 — omitted reasoning_effort means reasoning
|
|
839
|
+
// is ON; `none`/`minimal` turn it OFF; low/medium/high/xhigh/max turn it
|
|
840
|
+
// on. So `off` maps to the string 'none', NOT null: pi-ai emits a string
|
|
841
|
+
// off value verbatim and omits the field only when it is null, and
|
|
842
|
+
// omitting it here would silently leave reasoning enabled (and billed) on
|
|
843
|
+
// every non-reasoning turn. `xhigh` is documented, so it passes through
|
|
844
|
+
// unclamped. Upstage's `max` sits above xhigh, but pi has no level above
|
|
845
|
+
// xhigh to reach it, so `max` is intentionally unreachable.
|
|
846
|
+
// * solar-pro3 and solar-pro2 — omitted means reasoning is OFF, `minimal`
|
|
847
|
+
// and `low` ALSO turn it off, and only `medium`/`high` turn it on. So
|
|
848
|
+
// `off` maps to null (nothing sent) and xhigh clamps to high.
|
|
849
|
+
//
|
|
850
|
+
// Note the trap in both rows: Upstage's `minimal` is an OFF value, but pi's
|
|
851
|
+
// `minimal` is an enabled level meaning "reason a little". Forwarding it
|
|
852
|
+
// verbatim would silently disable reasoning on a request that asked for it.
|
|
853
|
+
// Each group therefore floors pi's enabled levels at its own lowest
|
|
854
|
+
// reasoning-ON value — `low` for pro4/open2, `medium` for pro3/pro2 (which is
|
|
855
|
+
// why pi's `low` also maps to `medium` there). Every level pi can select thus
|
|
856
|
+
// emits a value Upstage treats as reasoning-on. solar-mini needs no map: it
|
|
857
|
+
// does not accept reasoning_effort at all (any value returns HTTP 400).
|
|
834
858
|
upstage: {
|
|
835
859
|
id: 'upstage',
|
|
836
860
|
name: 'Upstage (Solar)',
|
|
@@ -839,6 +863,35 @@ export const KNOWN_PROVIDERS = {
|
|
|
839
863
|
apiKeyEnv: 'UPSTAGE_API_KEY',
|
|
840
864
|
oauthProviderId: null,
|
|
841
865
|
models: {
|
|
866
|
+
'solar-pro4': {
|
|
867
|
+
id: 'solar-pro4',
|
|
868
|
+
name: 'Solar Pro 4',
|
|
869
|
+
api: 'openai-completions',
|
|
870
|
+
provider: 'upstage',
|
|
871
|
+
baseUrl: 'https://api.upstage.ai/v1',
|
|
872
|
+
reasoning: true,
|
|
873
|
+
// pro4 and open2 reason by DEFAULT — see the reasoning-group note above.
|
|
874
|
+
thinkingLevelMap: {
|
|
875
|
+
off: 'none',
|
|
876
|
+
minimal: 'low',
|
|
877
|
+
low: 'low',
|
|
878
|
+
medium: 'medium',
|
|
879
|
+
high: 'high',
|
|
880
|
+
xhigh: 'xhigh',
|
|
881
|
+
},
|
|
882
|
+
input: ['text'],
|
|
883
|
+
cost: { input: 0.3, output: 1.2, cacheRead: 0.06, cacheWrite: 0 },
|
|
884
|
+
contextWindow: 524288,
|
|
885
|
+
maxTokens: 131072,
|
|
886
|
+
compat: {
|
|
887
|
+
supportsStore: false,
|
|
888
|
+
supportsDeveloperRole: false,
|
|
889
|
+
supportsReasoningEffort: true,
|
|
890
|
+
supportsUsageInStreaming: false,
|
|
891
|
+
supportsStrictMode: false,
|
|
892
|
+
maxTokensField: 'max_tokens',
|
|
893
|
+
},
|
|
894
|
+
},
|
|
842
895
|
'solar-open2': {
|
|
843
896
|
id: 'solar-open2',
|
|
844
897
|
name: 'Solar Open 2',
|
|
@@ -846,7 +899,14 @@ export const KNOWN_PROVIDERS = {
|
|
|
846
899
|
provider: 'upstage',
|
|
847
900
|
baseUrl: 'https://api.upstage.ai/v1',
|
|
848
901
|
reasoning: true,
|
|
849
|
-
thinkingLevelMap: {
|
|
902
|
+
thinkingLevelMap: {
|
|
903
|
+
off: 'none',
|
|
904
|
+
minimal: 'low',
|
|
905
|
+
low: 'low',
|
|
906
|
+
medium: 'medium',
|
|
907
|
+
high: 'high',
|
|
908
|
+
xhigh: 'xhigh',
|
|
909
|
+
},
|
|
850
910
|
input: ['text'],
|
|
851
911
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
852
912
|
contextWindow: 128000,
|
|
@@ -867,7 +927,14 @@ export const KNOWN_PROVIDERS = {
|
|
|
867
927
|
provider: 'upstage',
|
|
868
928
|
baseUrl: 'https://api.upstage.ai/v1',
|
|
869
929
|
reasoning: true,
|
|
870
|
-
thinkingLevelMap: {
|
|
930
|
+
thinkingLevelMap: {
|
|
931
|
+
off: null,
|
|
932
|
+
minimal: 'medium',
|
|
933
|
+
low: 'medium',
|
|
934
|
+
medium: 'medium',
|
|
935
|
+
high: 'high',
|
|
936
|
+
xhigh: 'high',
|
|
937
|
+
},
|
|
871
938
|
input: ['text'],
|
|
872
939
|
cost: { input: 0.15, output: 0.6, cacheRead: 0.015, cacheWrite: 0 },
|
|
873
940
|
contextWindow: 128000,
|
|
@@ -888,7 +955,14 @@ export const KNOWN_PROVIDERS = {
|
|
|
888
955
|
provider: 'upstage',
|
|
889
956
|
baseUrl: 'https://api.upstage.ai/v1',
|
|
890
957
|
reasoning: true,
|
|
891
|
-
thinkingLevelMap: {
|
|
958
|
+
thinkingLevelMap: {
|
|
959
|
+
off: null,
|
|
960
|
+
minimal: 'medium',
|
|
961
|
+
low: 'medium',
|
|
962
|
+
medium: 'medium',
|
|
963
|
+
high: 'high',
|
|
964
|
+
xhigh: 'high',
|
|
965
|
+
},
|
|
892
966
|
input: ['text'],
|
|
893
967
|
cost: { input: 0.15, output: 0.6, cacheRead: 0.015, cacheWrite: 0 },
|
|
894
968
|
contextWindow: 65000,
|
|
@@ -1048,25 +1122,13 @@ export const KNOWN_PROVIDERS = {
|
|
|
1048
1122
|
// `providerForModelRef()` matches on the registered provider prefix, the same
|
|
1049
1123
|
// mechanism that already handles the slash-heavy Fireworks router ids.
|
|
1050
1124
|
//
|
|
1051
|
-
//
|
|
1052
|
-
//
|
|
1053
|
-
//
|
|
1054
|
-
//
|
|
1055
|
-
//
|
|
1056
|
-
//
|
|
1057
|
-
//
|
|
1058
|
-
// "openai", so routing those here would silently send the wrong reasoning
|
|
1059
|
-
// field. They all remain reachable as custom `opengateway/...` refs — curation
|
|
1060
|
-
// only drives the picker, JSON-schema enum, and autocomplete.
|
|
1061
|
-
//
|
|
1062
|
-
// Costs are UPSTREAM LIST PRICES in USD per 1M tokens, pinned to the sibling
|
|
1063
|
-
// entry by a guard test in providers.test.ts. OpenGateway bills upstream usage
|
|
1064
|
-
// plus a platform fee and exposes no pricing in /v1/models, so `typeclaw usage`
|
|
1065
|
-
// is an estimate that reads LOW against the real invoice. Do NOT "fix" these
|
|
1066
|
-
// to zero: zero means "no attributable per-token charge" in this registry
|
|
1067
|
-
// (flat-subscription products like the Fireworks Fire Pass router), and
|
|
1068
|
-
// OpenGateway is metered. Replace with gateway-billed rates only if
|
|
1069
|
-
// OpenGateway ever publishes them.
|
|
1125
|
+
// The live picker gets ids and modalities from OpenGateway's public catalog,
|
|
1126
|
+
// then best-effort joins its rate card. This registry intentionally keeps one
|
|
1127
|
+
// anchor only: `resolveModel()` uses `Object.keys(provider.models)[0]` as the
|
|
1128
|
+
// transport/limits template for every uncurated ref, so entries 2..N buy
|
|
1129
|
+
// nothing. An empty map would make custom refs throw, making one the true
|
|
1130
|
+
// floor. Nano is the cheapest conservative context/limit donor and keeps
|
|
1131
|
+
// `curatedOptions()` useful as the offline fallback.
|
|
1070
1132
|
//
|
|
1071
1133
|
// Every model carries an explicit `compat` for the same reason Upstage does:
|
|
1072
1134
|
// pi-ai auto-detects compatibility from the baseUrl, and `apis.opengateway.ai`
|
|
@@ -1077,13 +1139,12 @@ export const KNOWN_PROVIDERS = {
|
|
|
1077
1139
|
// defaults it true) — turning it off would break token and cost reporting.
|
|
1078
1140
|
opengateway: {
|
|
1079
1141
|
id: 'opengateway',
|
|
1080
|
-
name: 'OpenGateway
|
|
1142
|
+
name: 'OpenGateway',
|
|
1081
1143
|
baseUrl: 'https://apis.opengateway.ai/v1',
|
|
1082
1144
|
auth: ['api-key'],
|
|
1083
1145
|
apiKeyEnv: 'OPENGATEWAY_API_KEY',
|
|
1084
1146
|
oauthProviderId: null,
|
|
1085
1147
|
models: {
|
|
1086
|
-
// Mirrors openai/gpt-5.4-nano.
|
|
1087
1148
|
'openai/gpt-5.4-nano': {
|
|
1088
1149
|
id: 'openai/gpt-5.4-nano',
|
|
1089
1150
|
name: 'GPT-5.4 nano',
|
|
@@ -1099,113 +1160,15 @@ export const KNOWN_PROVIDERS = {
|
|
|
1099
1160
|
maxTokensField: 'max_tokens',
|
|
1100
1161
|
},
|
|
1101
1162
|
input: ['text', 'image'],
|
|
1163
|
+
// Offline snapshot of OpenGateway's published rate for this model, NOT
|
|
1164
|
+
// the upstream OpenAI list price. Every other model is priced live from
|
|
1165
|
+
// the rate card, so this is the one number that can go stale; it is the
|
|
1166
|
+
// fallback used when the card is unreachable. Re-check it against
|
|
1167
|
+
// https://opengateway.ai/api/model-prices if you touch it.
|
|
1102
1168
|
cost: { input: 0.2, output: 1.25, cacheRead: 0.02, cacheWrite: 0 },
|
|
1103
1169
|
contextWindow: 400000,
|
|
1104
1170
|
maxTokens: 128000,
|
|
1105
1171
|
},
|
|
1106
|
-
// Mirrors openai/gpt-5.5.
|
|
1107
|
-
'openai/gpt-5.5': {
|
|
1108
|
-
id: 'openai/gpt-5.5',
|
|
1109
|
-
name: 'GPT-5.5',
|
|
1110
|
-
api: 'openai-completions',
|
|
1111
|
-
provider: 'opengateway',
|
|
1112
|
-
baseUrl: 'https://apis.opengateway.ai/v1',
|
|
1113
|
-
reasoning: true,
|
|
1114
|
-
compat: {
|
|
1115
|
-
supportsStore: false,
|
|
1116
|
-
supportsDeveloperRole: false,
|
|
1117
|
-
supportsReasoningEffort: false,
|
|
1118
|
-
supportsStrictMode: false,
|
|
1119
|
-
maxTokensField: 'max_tokens',
|
|
1120
|
-
},
|
|
1121
|
-
input: ['text', 'image'],
|
|
1122
|
-
cost: { input: 5, output: 30, cacheRead: 0.5, cacheWrite: 0 },
|
|
1123
|
-
contextWindow: 1050000,
|
|
1124
|
-
maxTokens: 128000,
|
|
1125
|
-
},
|
|
1126
|
-
// Mirrors anthropic/claude-sonnet-5. Note the transport differs from the
|
|
1127
|
-
// native entry: Anthropic is `anthropic-messages` first-party, but the
|
|
1128
|
-
// gateway only speaks OpenAI chat-completions.
|
|
1129
|
-
'anthropic/claude-sonnet-5': {
|
|
1130
|
-
id: 'anthropic/claude-sonnet-5',
|
|
1131
|
-
name: 'Claude Sonnet 5',
|
|
1132
|
-
api: 'openai-completions',
|
|
1133
|
-
provider: 'opengateway',
|
|
1134
|
-
baseUrl: 'https://apis.opengateway.ai/v1',
|
|
1135
|
-
reasoning: true,
|
|
1136
|
-
compat: {
|
|
1137
|
-
supportsStore: false,
|
|
1138
|
-
supportsDeveloperRole: false,
|
|
1139
|
-
supportsReasoningEffort: false,
|
|
1140
|
-
supportsStrictMode: false,
|
|
1141
|
-
maxTokensField: 'max_tokens',
|
|
1142
|
-
},
|
|
1143
|
-
input: ['text', 'image'],
|
|
1144
|
-
cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
|
1145
|
-
contextWindow: 1000000,
|
|
1146
|
-
maxTokens: 128000,
|
|
1147
|
-
},
|
|
1148
|
-
// Mirrors anthropic/claude-opus-4-8.
|
|
1149
|
-
'anthropic/claude-opus-4-8': {
|
|
1150
|
-
id: 'anthropic/claude-opus-4-8',
|
|
1151
|
-
name: 'Claude Opus 4.8',
|
|
1152
|
-
api: 'openai-completions',
|
|
1153
|
-
provider: 'opengateway',
|
|
1154
|
-
baseUrl: 'https://apis.opengateway.ai/v1',
|
|
1155
|
-
reasoning: true,
|
|
1156
|
-
compat: {
|
|
1157
|
-
supportsStore: false,
|
|
1158
|
-
supportsDeveloperRole: false,
|
|
1159
|
-
supportsReasoningEffort: false,
|
|
1160
|
-
supportsStrictMode: false,
|
|
1161
|
-
maxTokensField: 'max_tokens',
|
|
1162
|
-
},
|
|
1163
|
-
input: ['text', 'image'],
|
|
1164
|
-
cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 },
|
|
1165
|
-
contextWindow: 1000000,
|
|
1166
|
-
maxTokens: 128000,
|
|
1167
|
-
},
|
|
1168
|
-
// Mirrors moonshot/kimi-k2.6. The gateway namespaces Moonshot as
|
|
1169
|
-
// `moonshotai`, so the id is NOT the native `kimi-k2.6`.
|
|
1170
|
-
'moonshotai/kimi-k2.6': {
|
|
1171
|
-
id: 'moonshotai/kimi-k2.6',
|
|
1172
|
-
name: 'Kimi K2.6',
|
|
1173
|
-
api: 'openai-completions',
|
|
1174
|
-
provider: 'opengateway',
|
|
1175
|
-
baseUrl: 'https://apis.opengateway.ai/v1',
|
|
1176
|
-
reasoning: true,
|
|
1177
|
-
compat: {
|
|
1178
|
-
supportsStore: false,
|
|
1179
|
-
supportsDeveloperRole: false,
|
|
1180
|
-
supportsReasoningEffort: false,
|
|
1181
|
-
supportsStrictMode: false,
|
|
1182
|
-
maxTokensField: 'max_tokens',
|
|
1183
|
-
},
|
|
1184
|
-
input: ['text', 'image'],
|
|
1185
|
-
cost: { input: 0.6, output: 2.5, cacheRead: 0.15, cacheWrite: 0 },
|
|
1186
|
-
contextWindow: 256000,
|
|
1187
|
-
maxTokens: 64000,
|
|
1188
|
-
},
|
|
1189
|
-
// Mirrors minimax/MiniMax-M3.
|
|
1190
|
-
'minimax/MiniMax-M3': {
|
|
1191
|
-
id: 'minimax/MiniMax-M3',
|
|
1192
|
-
name: 'MiniMax M3',
|
|
1193
|
-
api: 'openai-completions',
|
|
1194
|
-
provider: 'opengateway',
|
|
1195
|
-
baseUrl: 'https://apis.opengateway.ai/v1',
|
|
1196
|
-
reasoning: true,
|
|
1197
|
-
compat: {
|
|
1198
|
-
supportsStore: false,
|
|
1199
|
-
supportsDeveloperRole: false,
|
|
1200
|
-
supportsReasoningEffort: false,
|
|
1201
|
-
supportsStrictMode: false,
|
|
1202
|
-
maxTokensField: 'max_tokens',
|
|
1203
|
-
},
|
|
1204
|
-
input: ['text', 'image'],
|
|
1205
|
-
cost: { input: 0.3, output: 1.2, cacheRead: 0.06, cacheWrite: 0 },
|
|
1206
|
-
contextWindow: 1000000,
|
|
1207
|
-
maxTokens: 524288,
|
|
1208
|
-
},
|
|
1209
1172
|
},
|
|
1210
1173
|
},
|
|
1211
1174
|
} as const satisfies Record<string, KnownProvider>
|
|
@@ -1299,7 +1262,7 @@ export const KNOWN_PROVIDER_VENDORS = {
|
|
|
1299
1262
|
// Anthropic should land on the Anthropic row, not the gateway that proxies it.
|
|
1300
1263
|
opengateway: {
|
|
1301
1264
|
id: 'opengateway',
|
|
1302
|
-
name: 'OpenGateway
|
|
1265
|
+
name: 'OpenGateway',
|
|
1303
1266
|
providers: ['opengateway'],
|
|
1304
1267
|
},
|
|
1305
1268
|
} as const satisfies Record<string, KnownProviderVendor>
|