Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
feat(jev): integrate TypeSafe classifier
vastsa6a83667db823
diff --git a/apps/desktop/electron/main/runtime/provider-catalog.ts b/apps/desktop/electron/main/runtime/provider-catalog.tsindex f74619c9a..11aee7649 100644--- a/apps/desktop/electron/main/runtime/provider-catalog.ts+++ b/apps/desktop/electron/main/runtime/provider-catalog.ts@@ -173,6 +173,7 @@ export function createProviderCatalogRuntime({.infiniteProviderRetry === true,keepAwakeWhileRunning: (value as T & { keepAwakeWhileRunning?: unknown }).keepAwakeWhileRunning === true,+ jevEnabled: (value as T & { jevEnabled?: unknown }).jevEnabled === true,defaultCommandShell: isCommandShellId(value.defaultCommandShell)? value.defaultCommandShell: defaultCommandShellForPlatform(process.platform),@@ -187,6 +188,7 @@ export function createProviderCatalogRuntime({defaultCommandShell?: unknown;infiniteProviderRetry?: unknown;keepAwakeWhileRunning?: unknown;+ jevEnabled?: unknown;updatePreference?: unknown;lastNotifiedUpdateVersion?: unknown;networkProxy?: unknown;@@ -215,6 +217,14 @@ export function createProviderCatalogRuntime({errorCode: ErrorCodes.INVALID_PARAMS,});}+ if (+ Object.prototype.hasOwnProperty.call(value, "jevEnabled") &&+ typeof value.jevEnabled !== "boolean"+ ) {+ throw Object.assign(new Error("jevEnabled is invalid"), {+ errorCode: ErrorCodes.INVALID_PARAMS,+ });+ }if (Object.prototype.hasOwnProperty.call(value, "updatePreference") &&value.updatePreference !== "automatic" &&diff --git a/apps/desktop/electron/main/runtime/session-launch.ts b/apps/desktop/electron/main/runtime/session-launch.tsindex 569fdc8f6..0cea28ef9 100644--- a/apps/desktop/electron/main/runtime/session-launch.ts+++ b/apps/desktop/electron/main/runtime/session-launch.ts@@ -3,6 +3,7 @@ import {ErrorCodes as SharedErrorCodes,isActiveInProject,isCommandShellCatalog,+ JEV_API_KEY_SECRET_REF,imageGenerationBindings,isImageGenerationModel,normalizeMode,@@ -611,18 +612,36 @@ export function createSessionLaunchRuntime({: [],),);+ const mode = normalizeMode(+ overrides.mode ?? session.mode ?? settings.defaultMode ?? "agent",+ );+ let jevApiKey: string | undefined;+ if (mode === "agent" && settings.jevEnabled === true) {+ try {+ const saved = await runtimeState.host!.call<{ value?: string | null }>(+ "secrets.getForRuntime",+ { secretRef: JEV_API_KEY_SECRET_REF },+ );+ if (typeof saved.value === "string" && saved.value.trim().length > 0) {+ jevApiKey = saved.value;+ }+ } catch {+ logger.app("session", "warn", "Jev API key could not be loaded", {+ sessionId,+ });+ }+ }return {providerId: provider.id,modelId,projectPath,sidecarParams: {sessionId,- mode: normalizeMode(- overrides.mode ?? session.mode ?? settings.defaultMode ?? "agent",- ),+ mode,...(overrides.turnId ? { turnId: overrides.turnId } : {}),thinkingLevel,infiniteProviderRetry: settings.infiniteProviderRetry === true,+ ...(jevApiKey ? { jevApiKey } : {}),commandShell,scratchDir: join(dataDir, "scratch", sessionId),attachmentsDir: join(dataDir, "attachments"),diff --git a/apps/desktop/src/components/settings/JevSettingsCard.tsx b/apps/desktop/src/components/settings/JevSettingsCard.tsxnew file mode 100644index 000000000..f0e587648--- /dev/null+++ b/apps/desktop/src/components/settings/JevSettingsCard.tsx@@ -0,0 +1,161 @@+import { useEffect, useState } from "react";+import { useTranslation } from "react-i18next";+import type { AppSettings } from "@pi-desktop/shared";+import { api } from "../../lib/api";+import { useAppStore } from "../../stores/app-store";+import { Button, Field, PasswordInput, SettingsToggle } from "../ui";+import { SettingsCard, SettingsRow } from "../../features/settings/primitives";++type KeyStatus = "loading" | "configured" | "missing" | "unavailable";+type BusyAction = "save" | "remove" | "toggle" | null;++async function persistSettings(patch: Partial<AppSettings>): Promise<void> {+ const current = useAppStore.getState().settings;+ if (!current) throw new Error("Settings are not ready");+ const next = { ...current, ...patch };+ await api.setSettings(next);+ useAppStore.setState({ settings: next });+}++export function JevSettingsCard({ settings }: { settings?: AppSettings }) {+ const { t } = useTranslation();+ const showToast = useAppStore((state) => state.showToast);+ const [keyDraft, setKeyDraft] = useState("");+ const [keyStatus, setKeyStatus] = useState<KeyStatus>("loading");+ const [busy, setBusy] = useState<BusyAction>(null);+ const enabled = settings?.jevEnabled === true;+ const configured = keyStatus === "configured";++ useEffect(() => {+ let current = true;+ void api.hasJevApiKey().then(+ (hasKey) => {+ if (current) setKeyStatus(hasKey ? "configured" : "missing");+ },+ () => {+ if (current) setKeyStatus("unavailable");+ },+ );+ return () => {+ current = false;+ };+ }, []);++ const saveKey = async () => {+ if (!keyDraft.trim()) return;+ setBusy("save");+ try {+ await api.setJevApiKey(keyDraft);+ setKeyDraft("");+ setKeyStatus("configured");+ showToast(t("settings.jevKeySaved"), { variant: "success" });+ } catch (error) {+ showToast(error instanceof Error ? error.message : String(error), {+ variant: "error",+ });+ } finally {+ setBusy(null);+ }+ };++ const removeKey = async () => {+ setBusy("remove");+ try {+ if (enabled) await persistSettings({ jevEnabled: false });+ await api.deleteJevApiKey();+ setKeyStatus("missing");+ setKeyDraft("");+ showToast(t("settings.jevKeyRemoved"), { variant: "success" });+ } catch (error) {+ try {+ setKeyStatus((await api.hasJevApiKey()) ? "configured" : "missing");+ } catch {+ setKeyStatus("unavailable");+ }+ showToast(error instanceof Error ? error.message : String(error), {+ variant: "error",+ });+ } finally {+ setBusy(null);+ }+ };++ const toggleEnabled = async () => {+ if (!settings || (!enabled && !configured)) return;+ setBusy("toggle");+ try {+ await persistSettings({ jevEnabled: !enabled });+ } catch (error) {+ showToast(error instanceof Error ? error.message : String(error), {+ variant: "error",+ });+ } finally {+ setBusy(null);+ }+ };++ const keyStatusText =+ keyStatus === "configured"+ ? t("settings.jevKeyConfigured")+ : keyStatus === "unavailable"+ ? t("settings.jevKeyStatusUnavailable")+ : keyStatus === "loading"+ ? t("settings.jevKeyStatusChecking")+ : t("settings.jevKeyMissing");++ return (+ <SettingsCard+ title={t("settings.jevTitle")}+ description={t("settings.jevDescription")}+ >+ <SettingsRow+ title={t("settings.jevEnable")}+ description={t("settings.jevEnableDescription")}+ detail={keyStatusText}+ >+ <SettingsToggle+ checked={enabled}+ label={t("settings.jevEnable")}+ disabled={busy !== null || !settings || (!configured && !enabled)}+ busy={busy === "toggle"}+ onChange={() => void toggleEnabled()}+ />+ </SettingsRow>+ <p className="jev-settings-privacy-note">{t("settings.jevPrivacyNotice")}</p>+ <div className="jev-settings-key-form">+ <Field label={t("settings.jevApiKey")}>+ <PasswordInput+ value={keyDraft}+ onChange={(event) => setKeyDraft(event.target.value)}+ placeholder={t("settings.jevApiKeyPlaceholder")}+ aria-label={t("settings.jevApiKey")}+ autoComplete="new-password"+ showLabel={t("settings.showPassword")}+ hideLabel={t("settings.hidePassword")}+ disabled={busy !== null}+ />+ </Field>+ <div className="jev-settings-key-actions">+ <Button+ variant="primary"+ size="sm"+ disabled={busy !== null || !keyDraft.trim()}+ onClick={() => void saveKey()}+ >+ {t("settings.jevSaveKey")}+ </Button>+ <Button+ variant="ghost"+ size="sm"+ disabled={+ busy !== null || keyStatus === "missing" || keyStatus === "loading"+ }+ onClick={() => void removeKey()}+ >+ {t("settings.jevRemoveKey")}+ </Button>+ </div>+ </div>+ </SettingsCard>+ );+}diff --git a/apps/desktop/src/components/settings/ModelConfigPage.tsx b/apps/desktop/src/components/settings/ModelConfigPage.tsxindex 4a0a7ffaf..3416fafab 100644--- a/apps/desktop/src/components/settings/ModelConfigPage.tsx+++ b/apps/desktop/src/components/settings/ModelConfigPage.tsx@@ -35,6 +35,7 @@ import { useVendorAccounts } from "./useVendorAccounts";import { VendorAccountDialog, type VendorAccountForm } from "./VendorAccountDialog";import { ModelConfigImportPanel } from "../../features/settings/imports/ModelConfigImportPanel";import { ImportToggleButton } from "../../features/settings/import-workbench";+import { JevSettingsCard } from "./JevSettingsCard";type CatalogStatus = {loaded: boolean;@@ -376,6 +377,8 @@ export function ModelConfigPage() {</section>) : null}+ <JevSettingsCard settings={settings} />+<section className="settings-card-block"><div className="model-config-section-head"><div className="settings-card-heading-line">diff --git a/apps/desktop/src/lib/api.ts b/apps/desktop/src/lib/api.tsindex 1cc3ef44e..b56cfac32 100644--- a/apps/desktop/src/lib/api.ts+++ b/apps/desktop/src/lib/api.ts@@ -138,6 +138,7 @@ import {validateNetworkPolicy,validateNetworkProxy,validateSpeechSettings,+ JEV_API_KEY_SECRET_REF,} from "@pi-desktop/shared";export type ImportSource = "claude-code" | "opencode" | "codex" | "pi";@@ -362,6 +363,7 @@ export function normalizeSettings(settings: AppSettings): AppSettings {defaultMode: normalizeMode((settings as { defaultMode?: unknown }).defaultMode),infiniteProviderRetry:(settings as { infiniteProviderRetry?: unknown }).infiniteProviderRetry === true,+ jevEnabled: (settings as { jevEnabled?: unknown }).jevEnabled === true,defaultCommandShell: isCommandShellId((settings as { defaultCommandShell?: unknown }).defaultCommandShell,)@@ -397,6 +399,7 @@ export function validateSettingsWrite(settings: AppSettings): AppSettings {fontScale?: unknown;chatContentMaxWidth?: unknown;infiniteProviderRetry?: unknown;+ jevEnabled?: unknown;smoothStreaming?: unknown;updatePreference?: unknown;lastNotifiedUpdateVersion?: unknown;@@ -444,6 +447,14 @@ export function validateSettingsWrite(settings: AppSettings): AppSettings {errorCode: "INVALID_PARAMS",});}+ if (+ Object.prototype.hasOwnProperty.call(value, "jevEnabled") &&+ typeof value.jevEnabled !== "boolean"+ ) {+ throw Object.assign(new Error("jevEnabled is invalid"), {+ errorCode: "INVALID_PARAMS",+ });+ }if (Object.prototype.hasOwnProperty.call(value, "smoothStreaming") &&typeof value.smoothStreaming !== "boolean"@@ -654,6 +665,13 @@ export const api = {invoke<void>(IPC.invoke.storageRemoveBackup, input),setSettings: (settings: AppSettings) =>invoke(IPC.invoke.settingsSet, validateSettingsWrite(settings)),+ /** Store the Jev key in Host secure storage; it is never returned to renderer state. */+ setJevApiKey: (value: string) =>+ invoke(IPC.invoke.secretsSet, { secretRef: JEV_API_KEY_SECRET_REF, value }),+ deleteJevApiKey: () =>+ invoke(IPC.invoke.secretsDelete, JEV_API_KEY_SECRET_REF),+ hasJevApiKey: () =>+ invoke<{ has: boolean }>(IPC.invoke.secretsHas, JEV_API_KEY_SECRET_REF).then((result) => result.has),configSyncGetState: () => invoke<ConfigSyncState>(IPC.invoke.configSyncGetState),configSyncConfigure: (input: ConfigSyncConfigureInput) =>invoke<ConfigSyncState>(IPC.invoke.configSyncConfigure, input),diff --git a/apps/desktop/src/styles/settings.css b/apps/desktop/src/styles/settings.cssindex c365f50ef..542cf0369 100644--- a/apps/desktop/src/styles/settings.css+++ b/apps/desktop/src/styles/settings.css@@ -1064,6 +1064,27 @@min-height: var(--ds-field-height);}+.jev-settings-privacy-note {+ margin: 0;+ padding: 0 16px 12px;+ color: var(--ds-text-secondary);+ font-size: var(--text-sm);+ line-height: var(--leading-body);+}++.jev-settings-key-form {+ display: grid;+ gap: 10px;+ padding: 0 16px 16px;+}++.jev-settings-key-actions {+ display: flex;+ flex-wrap: wrap;+ gap: 8px;+ justify-content: flex-end;+}+/*A toggle paired with an icon action (prompt enhancement). The control columnhas no gap of its own, so the two would otherwise touch.diff --git a/docs/spec/03-runtime/03-tools-and-permissions.md b/docs/spec/03-runtime/03-tools-and-permissions.mdindex 00306e26a..f0f8decf8 100644--- a/docs/spec/03-runtime/03-tools-and-permissions.md+++ b/docs/spec/03-runtime/03-tools-and-permissions.md@@ -8,7 +8,7 @@| Topic | Decision ||---|---|| Default mode | Agent |-| Agent tools | Read / Glob / Grep / Write / Edit / Bash + registered plugin tools |+| Agent tools | Read / Glob / Grep / Write / Edit / Bash + registered plugin tools + optional Jev classifier || Plan tools | Read / Glob / Grep / BrowserPreview / Bash / SubmitPlan + plugin tools that declare plan-safe actions || Goal tools | Read / Glob / Grep / BrowserPreview / Bash / SubmitGoal + plugin tools that declare plan-safe actions || Plan and Goal hard deny | Write / Edit / plugin tools without `planSafeActions` / unknown tools / the other kind's submit tool |@@ -59,6 +59,7 @@ their full schemas up front:- `BrowserPreview`- `PluginCheck`, `PluginScaffold`, and `PluginPack`- plugin-declared agent tools+- `JevClassify` when the user enables Jev and saves a TypeSafe API keyThese tools appear in a bounded `# On-demand tools` catalog with compactdescriptions. The model calls the local `ToolSearch` tool with an exact name or@@ -75,6 +76,16 @@ workspace/scratch containment, timeout, and audit rules do not change when atool is loaded. `ToolSearch` itself never executes a workspace operation andnever bypasses host-core policy.+`JevClassify` is offered only in Agent mode, only when explicitly enabled in+Settings → Models, and only while its TypeSafe key is available. It is a+structured classifier call, not a chat model or workspace operation. The Agent+must supply its JSON state and typed questions; those values go directly to+TypeSafe when the tool is called. The tool validates JSON shape and bounds the+payload to 24 KiB, uses the pi-ai `jev-latest` classifier with a 45-second+timeout, and returns only structured answers and reported usage. Plan and Goal+never receive the tool. The settings disclosure warns users not to pass secrets+or personal information.+An explicit composer MCP selection carries exact server IDs to the runtime.The current host-supplied catalog associates each MCP tool with its server ID;selection activates all mode-allowed tools for that server before the request,@@ -92,7 +103,7 @@ an attachment before opening or persisting a turn. See## 3. Common Tool Constraints-Every non-interactive execution tool must have:+Every non-interactive workspace execution tool must have:1. JSON schema / typebox parameter definition2. timeout@@ -107,6 +118,11 @@ result. Options may be plain strings or `{ label, description? }` objects; theselected label remains the answer value. Stopping the turn resolves outstandingquestions as skipped.+`JevClassify` is an external provider operation rather than a workspace+execution tool. It validates its structured request, observes cancellation,+uses a bounded provider timeout, and returns typed classifier results; it has+no filesystem path or host-core workspace permission surface.+## 4. Path RulesNative file and search tools enforce distinct path shapes (D208, ADR 0069):diff --git a/docs/spec/03-runtime/11-provider-model-system.md b/docs/spec/03-runtime/11-provider-model-system.mdindex 68c45783a..48c05c542 100644--- a/docs/spec/03-runtime/11-provider-model-system.md+++ b/docs/spec/03-runtime/11-provider-model-system.md@@ -217,6 +217,10 @@ PI-Desktop must not permanently restrict users to a short fixed model list.5. Chat, image and classifier models are selected by operation type even whenthey share a model ID. pi-ai remains responsible for OAuth, wire identity,transport and typed non-chat operations that models.dev does not describe.+ PI-Desktop's optional Jev integration uses pi-ai's built-in+ `typesafe/jev-latest` classifier directly; it is never listed or selectable+ as a chat provider/model. A saved TypeSafe key and explicit Jev setting are+ required before Agent mode receives the on-demand `JevClassify` tool.6. Free-form IDs remain configurable. Conservative generic metadata applieswhen no published model matches; explicit user overrides remain supported.Unknown relay metadata uses exact final-segment matching and an unambiguousdiff --git a/docs/spec/03-runtime/14-secrets-storage.md b/docs/spec/03-runtime/14-secrets-storage.mdindex adb73ca39..8d29ad36a 100644--- a/docs/spec/03-runtime/14-secrets-storage.md+++ b/docs/spec/03-runtime/14-secrets-storage.md@@ -51,6 +51,7 @@ type SecretMeta = {```textsecret:provider:<providerId>:api_keysecret:provider:<providerId>:oauth+secret:app:typesafe-jev```The two refs are independent, so one provider row may hold an API key, a vendor@@ -58,6 +59,10 @@ account, or both. The OAuth ref stores the serialized pi-ai `OAuthCredential`(access token, refresh token, expiry) written through the generic `secrets.set`path, so it is encrypted by the same backend but is not indexed in`secrets_meta`; provider delete clears both refs and any metadata row for them.+The Jev API key uses the fixed `secret:app:typesafe-jev` reference through the+same encrypted Host store. Renderer access is limited to set/delete/has; Electron+main reads it only for an explicitly enabled Agent launch and passes it+ephemerally to the sidecar.## 4a. Provider readiness flagsdiff --git a/docs/spec/04-ux/06-settings-ia.md b/docs/spec/04-ux/06-settings-ia.mdindex 1183b345b..9553af0e3 100644--- a/docs/spec/04-ux/06-settings-ia.md+++ b/docs/spec/04-ux/06-settings-ia.md@@ -541,6 +541,18 @@ confirmation only: Ask and Accept edits prompt, while Auto may run a mutatingBash command without confirmation. The AI Defaults card must describe that bothcontract modes are intent boundaries, not strict read-only security profiles.+### Jev classifier++- Keep Jev separate from the chat provider/model list: it is a TypeSafe+ structured classifier, not a conversation model.+- Let the user store or remove a TypeSafe API key and explicitly enable Jev+ for Agent mode. The key stays in Host secure storage; the renderer only reads+ whether one exists.+- Explain that `JevClassify` sends only the state and questions the Agent passes+ to TypeSafe, and warn users not to include secrets or personal information.+- The tool is on demand and unavailable in Plan and Goal modes. Removing the+ key disables Jev.+### Agent capability destinations (Skills / MCP / Subagents)Skills, MCP servers, and user-owned Subagents remain three independentdiff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex a0b4988d8..bebb12dbf 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -16921,6 +16921,33 @@ host-created files. The full app's file-preview viewer is covered separately.Send in an older chat: accepted submission updates new-chat inheritance;rejected submission does not. Deferred configuration alone does not countas usage.++## E2E-AGENT-jev-classifier-opt-in++- **Preconditions:** Isolated desktop profile, a deterministic local chat+ provider fixture, a fake Host secret store, and a sidecar `fetch` fixture+ that intercepts `https://api.typesafe.ai/v1/systemone`. Do not use a real+ TypeSafe key or provider endpoint.+- **Steps:** 1) Open Settings → Models, save a sentinel TypeSafe key, and enable+ Jev. 2) Start an Agent turn whose deterministic chat fixture requests+ `ToolSearch` for Jev, then calls `JevClassify` with one choice, one score and+ one boolean question over a small JSON state. 3) Inspect the fixture request+ and the rendered tool result. 4) Start turns in Plan and Goal. 5) Disable Jev+ and start another Agent turn, then re-enable it and remove the key.+- **Expected:** The key is stored under the fixed Host secret reference and is+ never returned to renderer state or transcript. `JevClassify` appears in the+ Agent's deferred catalog only while enabled with a saved key, and never in+ Plan or Goal. The fixture receives the TypeSafe System One payload and+ bearer header; the tool returns bounded structured answers and usage. A+ disabled/missing key omits the tool on the next turn, and removing the key+ turns the setting off.+- **Specs:** [Tools and permissions](../03-runtime/03-tools-and-permissions.md),+ [provider/model system](../03-runtime/11-provider-model-system.md),+ [secrets storage](../03-runtime/14-secrets-storage.md),+ [settings IA](../04-ux/06-settings-ia.md).+- **Acceptance:** No paid or real-provider call. The fixture verifies request+ body, auth redaction, cancellation, timeout, malformed input rejection, and+ that disabling/removing Jev affects the next Agent launch.- Disable/remove a provider or model and mark a model for image generation:unavailable history entries are skipped for inheritance and recent menu rows.- Settings contains no fixed chat-default picker or Make default service action;diff --git a/packages/agent-runtime/src/jev-classifier-tool.ts b/packages/agent-runtime/src/jev-classifier-tool.tsnew file mode 100644index 000000000..19bda4672--- /dev/null+++ b/packages/agent-runtime/src/jev-classifier-tool.ts@@ -0,0 +1,234 @@+import { createModels } from "@earendil-works/pi-ai/models";+import { TYPESAFE_CLASSIFIER_MODELS } from "@earendil-works/pi-ai/providers/typesafe.models";+import { typesafeProvider } from "@earendil-works/pi-ai/providers/typesafe";+import type {+ ClassifierContext,+ ClassifierQuestion,+ JsonObject,+ JsonValue,+} from "@earendil-works/pi-ai";+import type { AgentTool } from "@earendil-works/pi-agent-core";+import { Type } from "typebox";++const MAX_CONTEXT_BYTES = 24 * 1024;+const MAX_JSON_DEPTH = 8;+const MAX_QUESTIONS = 16;+const MAX_CRITERIA = 32;+const MAX_TEXT_LENGTH = 1_200;++const models = createModels();+models.setProvider(typesafeProvider());++const jevModel = TYPESAFE_CLASSIFIER_MODELS["jev-latest"];++const choiceQuestionSchema = Type.Object(+ {+ type: Type.Literal("choice"),+ instructions: Type.String(),+ criteria: Type.Record(Type.String(), Type.String()),+ },+ { additionalProperties: false },+);+const scoreQuestionSchema = Type.Object(+ {+ type: Type.Literal("score"),+ instructions: Type.String(),+ criteria: Type.Array(Type.String()),+ },+ { additionalProperties: false },+);+const boolQuestionSchema = Type.Object(+ {+ type: Type.Literal("bool"),+ instructions: Type.String(),+ criteria: Type.Object(+ { true: Type.String(), false: Type.String() },+ { additionalProperties: false },+ ),+ },+ { additionalProperties: false },+);++function isRecord(value: unknown): value is Record<string, unknown> {+ return typeof value === "object" && value !== null && !Array.isArray(value);+}++function isJsonValue(value: unknown, depth = 0): value is JsonValue {+ if (depth > MAX_JSON_DEPTH) return false;+ if (+ value === null ||+ typeof value === "string" ||+ typeof value === "boolean"+ ) {+ return true;+ }+ if (typeof value === "number") return Number.isFinite(value);+ if (Array.isArray(value)) {+ return value.every((entry) => isJsonValue(entry, depth + 1));+ }+ return (+ isRecord(value) &&+ Object.values(value).every((entry) => isJsonValue(entry, depth + 1))+ );+}++function boundedText(value: unknown): value is string {+ return (+ typeof value === "string" &&+ value.trim().length > 0 &&+ value.length <= MAX_TEXT_LENGTH+ );+}++function parseQuestion(value: unknown): ClassifierQuestion | undefined {+ if (!isRecord(value) || !boundedText(value.instructions)) return undefined;+ if (value.type === "choice" && isRecord(value.criteria)) {+ const entries = Object.entries(value.criteria);+ if (+ entries.length < 2 ||+ entries.length > MAX_CRITERIA ||+ entries.some(([label, description]) =>+ !boundedText(label) || !boundedText(description),+ )+ ) {+ return undefined;+ }+ return {+ type: "choice",+ instructions: value.instructions,+ criteria: Object.fromEntries(entries) as Record<string, string>,+ };+ }+ if (value.type === "score" && Array.isArray(value.criteria)) {+ if (+ value.criteria.length < 2 ||+ value.criteria.length > MAX_CRITERIA ||+ value.criteria.some((criterion) => !boundedText(criterion))+ ) {+ return undefined;+ }+ return {+ type: "score",+ instructions: value.instructions,+ criteria: value.criteria as string[],+ };+ }+ if (+ value.type === "bool" &&+ isRecord(value.criteria) &&+ boundedText(value.criteria.true) &&+ boundedText(value.criteria.false) &&+ Object.keys(value.criteria).length === 2+ ) {+ return {+ type: "bool",+ instructions: value.instructions,+ criteria: { true: value.criteria.true, false: value.criteria.false },+ };+ }+ return undefined;+}++function parseContext(value: unknown): ClassifierContext | undefined {+ if (!isRecord(value) || !isRecord(value.state) || !isRecord(value.questions)) {+ return undefined;+ }+ if (!Object.values(value.state).every((entry) => isJsonValue(entry))) {+ return undefined;+ }+ const questionEntries = Object.entries(value.questions);+ if (+ questionEntries.length === 0 ||+ questionEntries.length > MAX_QUESTIONS ||+ questionEntries.some(([id]) => !boundedText(id) || id.length > 96)+ ) {+ return undefined;+ }+ const questions = Object.create(null) as Record<string, ClassifierQuestion>;+ for (const [id, rawQuestion] of questionEntries) {+ const question = parseQuestion(rawQuestion);+ if (!question) return undefined;+ questions[id] = question;+ }+ const context: ClassifierContext = {+ state: value.state as JsonObject,+ questions,+ };+ if (Buffer.byteLength(JSON.stringify(context), "utf8") > MAX_CONTEXT_BYTES) {+ return undefined;+ }+ return context;+}++/** Agent-only, deferred call to pi-ai's TypeSafe System One classifier. */+export function createJevClassifierTool(apiKey: string): AgentTool {+ return {+ name: "JevClassify",+ label: "Jev classify",+ description:+ "Classify JSON state with TypeSafe Jev and return structured choice, score, or boolean answers. The state and questions are sent directly to TypeSafe; include only information the user has approved for that service.",+ parameters: Type.Object(+ {+ state: Type.Record(Type.String(), Type.Any()),+ questions: Type.Record(+ Type.String(),+ Type.Union([+ choiceQuestionSchema,+ scoreQuestionSchema,+ boolQuestionSchema,+ ]),+ ),+ },+ { additionalProperties: false },+ ),+ executionMode: "sequential",+ execute: async (_toolCallId, rawParams, signal) => {+ const context = parseContext(rawParams);+ if (!context) {+ return {+ content: [+ {+ type: "text",+ text: "JevClassify requires a JSON object state and 1–16 valid structured questions; the total input must be at most 24 KiB.",+ },+ ],+ details: { errorCode: "JEV_INVALID_ARGUMENT" },+ isError: true,+ };+ }+ const timeoutSignal = AbortSignal.timeout(45_000);+ const requestSignal = signal+ ? AbortSignal.any([signal, timeoutSignal])+ : timeoutSignal;+ const result = await models.classify(jevModel, context, {+ apiKey,+ signal: requestSignal,+ timeoutMs: 45_000,+ maxRetries: 1,+ });+ if (result.stopReason !== "stop") {+ const errorMessage = (result.errorMessage ?? "Request did not complete")+ .replaceAll(apiKey, "[redacted]")+ .slice(0, 1_000);+ return {+ content: [{ type: "text", text: `Jev classification failed: ${errorMessage}` }],+ details: {+ errorCode:+ result.stopReason === "aborted"+ ? "JEV_ABORTED"+ : "JEV_REQUEST_FAILED",+ },+ isError: true,+ };+ }+ const answer = {+ answers: result.answers,+ ...(result.usage ? { usage: result.usage } : {}),+ };+ return {+ content: [{ type: "text", text: JSON.stringify(answer, null, 2) }],+ details: answer,+ };+ },+ };+}diff --git a/packages/agent-runtime/src/runtime.ts b/packages/agent-runtime/src/runtime.tsindex dae46d927..185cba4a9 100644--- a/packages/agent-runtime/src/runtime.ts+++ b/packages/agent-runtime/src/runtime.ts@@ -9,6 +9,7 @@ import { requestExtensionUi } from "./extensions/ui-request.js";import { readLocalRequestErrorDetails } from "./local-request-errors.js";import { imageGenerationDescription, imageGenerationParameters } from "./image-generation/tool.js";import { todoWriteDescription, todoWriteParameters } from "./todo-tool.js";+import { createJevClassifierTool } from "./jev-classifier-tool.js";import { scheduledToolParameters, scheduledToolDescriptions } from "./scheduled-tools.js";import { withPiFileOpToolNames } from "./pi-file-ops.js";import { randomUUID } from "node:crypto";@@ -999,6 +1000,8 @@ export type AgentRuntimeOptions = {thinkingLevel: SessionThinkingLevel;/** Persisted opt-in for retrying transient provider failures until success. */infiniteProviderRetry?: boolean;+ /** TypeSafe Jev credential, resolved by Electron main only when enabled. */+ jevApiKey?: string;systemPrompt?: string;/** pi-compatible SYSTEM.md / APPEND_SYSTEM.md resolved for the session (issue #542). */customSystemPrompt?: CustomSystemPrompt;@@ -1063,6 +1066,7 @@ export type RuntimeMatchConfig = {mode: Mode;provider: RuntimeProviderConfig;thinkingLevel: SessionThinkingLevel;+ jevApiKey?: string;pluginTools?: PluginToolDef[];pluginSkills?: PluginSkillDef[];trustedExtensions?: TrustedExtensionSpec[];@@ -1843,6 +1847,7 @@ export class DesktopAgentRuntime {private providerRateLimitRetryAttempt = 0;/** Opt-in mode removes only the retry-count ceiling; abort and backoff stay intact. */private infiniteProviderRetry = false;+ private jevApiKey?: string;private activeProviderRetryAttempt = 0;private providerRetryInProgress = false;private suppressProviderRetryRunEnd = false;@@ -1940,6 +1945,7 @@ export class DesktopAgentRuntime {this.provider = opts.provider;this.thinkingLevel = clampThinkingLevel(opts.provider, opts.thinkingLevel);this.infiniteProviderRetry = opts.infiniteProviderRetry === true;+ this.jevApiKey = opts.jevApiKey;this.host = opts.host;this.onDiagnostic = opts.onDiagnostic ?? (() => undefined);this.hostCloseUnsubscribe = this.host.onClose?.(() => {@@ -2607,6 +2613,7 @@ Do not invent objections or turn speculative risks into blockers. Stop when the!this.disposed &&providerMatches &&this.mode === config.mode &&+ this.jevApiKey === config.jevApiKey &&this.thinkingLevel ===clampThinkingLevel(config.provider, config.thinkingLevel) &¤t === next &&@@ -3698,6 +3705,10 @@ Do not invent objections or turn speculative risks into blockers. Stop when thetools.push("PluginScaffold", "PluginPack", "GenerateImages", ...Object.keys(scheduledToolParameters));}const builtins = tools.map(exec);+ const jevTools: AgentTool[] =+ this.mode === "agent" && this.jevApiKey+ ? [createJevClassifierTool(this.jevApiKey)]+ : [];// Plugins contribute Agent tools by default. Plan/Goal modes only// expose plugins that declare plan-safe actions (ADR 0211); the@@ -3774,6 +3785,7 @@ Do not invent objections or turn speculative risks into blockers. Stop when theconst extensionTools = this.extensionRunner?.getAgentTools() ?? [];return [...builtins,+ ...jevTools,askTool,...pluginTools,...skillTools,diff --git a/packages/agent-runtime/src/sidecar.ts b/packages/agent-runtime/src/sidecar.tsindex 7b10e4352..639f4f9c2 100644--- a/packages/agent-runtime/src/sidecar.ts+++ b/packages/agent-runtime/src/sidecar.ts@@ -106,6 +106,8 @@ type RuntimeParams = {turnId?: string;thinkingLevel?: SessionThinkingLevel;infiniteProviderRetry?: boolean;+ /** Opt-in TypeSafe classifier credential resolved by Electron main. */+ jevApiKey?: string;provider: RuntimeProviderConfig;commandShell: CommandShellOption;pluginTools?: PluginToolDef[];@@ -229,6 +231,7 @@ async function runtimeFor(subagents,subagentProviders,subagentModelKeys,+ jevApiKey: params.jevApiKey,projectInstructions: params.projectInstructions,customSystemPrompt: params.customSystemPrompt,projectMemory: params.projectMemory,@@ -293,6 +296,7 @@ async function runtimeFor(commandShell: params.commandShell,thinkingLevel,infiniteProviderRetry: params.infiniteProviderRetry === true,+ jevApiKey: params.jevApiKey,history,compaction,compactionSettings: params.compactionSettings,diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.tsindex 1658e5e12..614b21345 100644--- a/packages/i18n/src/locales/de/index.ts+++ b/packages/i18n/src/locales/de/index.ts@@ -1490,6 +1490,21 @@ sklm: {"catalogSourceEmpty": "nicht verfügbar","catalogStatusLine": "Katalog: {{source}} · {{models}} Modelle · aktualisiert {{fetchedAt}}","catalogStatusUnknown": "Modellkatalogstatus nicht verfügbar",+ "jevTitle": "Strukturierter Jev-Klassifikator",+ "jevDescription": "Richte TypeSafe Jev ein, einen strukturierten Klassifikator für Auswahl-, Bewertungs- und Ja/Nein-Fragen des Agenten.",+ "jevEnable": "Jev für den Agenten aktivieren",+ "jevEnableDescription": "Jev wird als Werkzeug auf Abruf im Agent-Modus verfügbar. In Plan und Goal ist es nicht verfügbar.",+ "jevPrivacyNotice": "Bei JevClassify werden der übergebene Zustand und die Fragen direkt an TypeSafe gesendet. Keine Geheimnisse oder persönlichen Daten übermitteln.",+ "jevApiKey": "TypeSafe-API-Schlüssel",+ "jevApiKeyPlaceholder": "TypeSafe-API-Schlüssel einfügen",+ "jevSaveKey": "Schlüssel speichern",+ "jevRemoveKey": "Schlüssel entfernen",+ "jevKeyConfigured": "API-Schlüssel sicher gespeichert",+ "jevKeyMissing": "Kein API-Schlüssel konfiguriert",+ "jevKeyStatusChecking": "API-Schlüssel wird geprüft…",+ "jevKeyStatusUnavailable": "API-Schlüsselstatus konnte nicht geprüft werden",+ "jevKeySaved": "Jev-API-Schlüssel gespeichert",+ "jevKeyRemoved": "Jev-API-Schlüssel entfernt","catalogNeverFetched": "nie","serviceModels": "Modelle aus diesem Dienst","accountModels": "Modelle für dieses Konto",diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.tsindex 2f6c3b2e5..1ccfa0e77 100644--- a/packages/i18n/src/locales/en/index.ts+++ b/packages/i18n/src/locales/en/index.ts@@ -1513,6 +1513,21 @@ sklm: {catalogSourceEmpty: "unavailable",catalogStatusLine: "Catalog: {{source}} · {{models}} models · updated {{fetchedAt}}",catalogStatusUnknown: "Model catalog status unavailable",+ jevTitle: "Jev structured classifier",+ jevDescription: "Configure TypeSafe Jev, a structured classifier that can answer choice, score, and boolean questions for the Agent.",+ jevEnable: "Enable Jev for Agent",+ jevEnableDescription: "Expose Jev as an on-demand tool in Agent mode. It is unavailable in Plan and Goal modes.",+ jevPrivacyNotice: "When the Agent calls JevClassify, the state and questions passed to it are sent directly to TypeSafe. Do not include secrets or personal information.",+ jevApiKey: "TypeSafe API key",+ jevApiKeyPlaceholder: "Paste TypeSafe API key",+ jevSaveKey: "Save key",+ jevRemoveKey: "Remove key",+ jevKeyConfigured: "API key saved securely",+ jevKeyMissing: "API key not configured",+ jevKeyStatusChecking: "Checking API key…",+ jevKeyStatusUnavailable: "Could not check API key status",+ jevKeySaved: "Jev API key saved",+ jevKeyRemoved: "Jev API key removed",catalogNeverFetched: "never",serviceModels: "Models from this service",accountModels: "Models for this account",diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.tsindex 27d75ad00..e2c6c7681 100644--- a/packages/i18n/src/locales/es/index.ts+++ b/packages/i18n/src/locales/es/index.ts@@ -1490,6 +1490,21 @@ sklm: {"catalogSourceEmpty": "no disponible","catalogStatusLine": "Catálogo: {{source}} · {{models}} modelos · actualizado {{fetchedAt}}","catalogStatusUnknown": "Estado del catálogo de modelos no disponible",+ "jevTitle": "Clasificador estructurado Jev",+ "jevDescription": "Configura TypeSafe Jev, un clasificador que responde preguntas estructuradas de opción, puntuación y verdadero o falso para el agente.",+ "jevEnable": "Activar Jev para el agente",+ "jevEnableDescription": "Jev estará disponible como herramienta bajo demanda en el modo Agent. No está disponible en Plan y Goal.",+ "jevPrivacyNotice": "Al llamar a JevClassify, el estado y las preguntas que se le pasen se envían directamente a TypeSafe. No incluyas secretos ni datos personales.",+ "jevApiKey": "Clave API de TypeSafe",+ "jevApiKeyPlaceholder": "Pega la clave API de TypeSafe",+ "jevSaveKey": "Guardar clave",+ "jevRemoveKey": "Eliminar clave",+ "jevKeyConfigured": "Clave API guardada de forma segura",+ "jevKeyMissing": "No hay una clave API configurada",+ "jevKeyStatusChecking": "Comprobando clave API…",+ "jevKeyStatusUnavailable": "No se pudo comprobar el estado de la clave API",+ "jevKeySaved": "Clave API de Jev guardada",+ "jevKeyRemoved": "Clave API de Jev eliminada","catalogNeverFetched": "nunca","serviceModels": "Modelos de este servicio","accountModels": "Modelos para esta cuenta",diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.tsindex 17b751258..42d5b3eb9 100644--- a/packages/i18n/src/locales/fr/index.ts+++ b/packages/i18n/src/locales/fr/index.ts@@ -1490,6 +1490,21 @@ sklm: {"catalogSourceEmpty": "indisponible","catalogStatusLine": "Catalogue : {{source}} · {{models}} modèles · mis à jour {{fetchedAt}}","catalogStatusUnknown": "État du catalogue de modèles indisponible",+ "jevTitle": "Classificateur structuré Jev",+ "jevDescription": "Configurez TypeSafe Jev, un classificateur structuré qui répond aux choix, scores et questions booléennes de l’Agent.",+ "jevEnable": "Activer Jev pour l’Agent",+ "jevEnableDescription": "Jev devient un outil à la demande en mode Agent. Il n’est pas disponible en modes Plan et Goal.",+ "jevPrivacyNotice": "Lors d’un appel à JevClassify, l’état et les questions fournis sont envoyés directement à TypeSafe. N’incluez ni secrets ni données personnelles.",+ "jevApiKey": "Clé API TypeSafe",+ "jevApiKeyPlaceholder": "Collez la clé API TypeSafe",+ "jevSaveKey": "Enregistrer la clé",+ "jevRemoveKey": "Supprimer la clé",+ "jevKeyConfigured": "Clé API enregistrée de façon sécurisée",+ "jevKeyMissing": "Aucune clé API configurée",+ "jevKeyStatusChecking": "Vérification de la clé API…",+ "jevKeyStatusUnavailable": "Impossible de vérifier l’état de la clé API",+ "jevKeySaved": "Clé API Jev enregistrée",+ "jevKeyRemoved": "Clé API Jev supprimée","catalogNeverFetched": "jamais","serviceModels": "Modèles de ce service","accountModels": "Modèles pour ce compte",diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.tsindex fabfd3d35..d5aa00b73 100644--- a/packages/i18n/src/locales/ko/index.ts+++ b/packages/i18n/src/locales/ko/index.ts@@ -1506,6 +1506,21 @@ sklm: {catalogSourceEmpty: "사용할 수 없음",catalogStatusLine: "카탈로그: {{source}} · 모델 {{models}}개 · {{fetchedAt}} 업데이트됨",catalogStatusUnknown: "모델 카탈로그 상태를 확인할 수 없음",+ jevTitle: "Jev 구조화 분류기",+ jevDescription: "Agent의 선택, 점수, 참/거짓 질문에 답하는 구조화 분류기 TypeSafe Jev를 설정합니다.",+ jevEnable: "Agent에서 Jev 사용",+ jevEnableDescription: "Jev가 Agent 모드에서 필요할 때 호출하는 도구로 제공됩니다. Plan 및 Goal 모드에서는 사용할 수 없습니다.",+ jevPrivacyNotice: "Agent가 JevClassify를 호출하면 전달된 상태와 질문이 TypeSafe로 직접 전송됩니다. 비밀이나 개인 정보를 포함하지 마세요.",+ jevApiKey: "TypeSafe API 키",+ jevApiKeyPlaceholder: "TypeSafe API 키 붙여넣기",+ jevSaveKey: "키 저장",+ jevRemoveKey: "키 삭제",+ jevKeyConfigured: "API 키가 안전하게 저장됨",+ jevKeyMissing: "API 키가 설정되지 않음",+ jevKeyStatusChecking: "API 키 확인 중…",+ jevKeyStatusUnavailable: "API 키 상태를 확인할 수 없음",+ jevKeySaved: "Jev API 키 저장됨",+ jevKeyRemoved: "Jev API 키 삭제됨",catalogNeverFetched: "없음",serviceModels: "이 서비스의 모델",accountModels: "이 계정의 모델",diff --git a/packages/i18n/src/locales/pt-BR/index.ts b/packages/i18n/src/locales/pt-BR/index.tsindex 84ecc9fd4..8525bdd1d 100644--- a/packages/i18n/src/locales/pt-BR/index.ts+++ b/packages/i18n/src/locales/pt-BR/index.ts@@ -1454,6 +1454,21 @@ export const ptBR = {catalogSourceEmpty: "indisponível",catalogStatusLine: "Catálogo: {{source}} · {{models}} modelos · atualizado {{fetchedAt}}",catalogStatusUnknown: "Status do catálogo de modelos indisponível",+ jevTitle: "Classificador estruturado Jev",+ jevDescription: "Configure o TypeSafe Jev, um classificador estruturado que responde perguntas de escolha, pontuação e sim/não para o Agent.",+ jevEnable: "Ativar Jev para o Agent",+ jevEnableDescription: "O Jev fica disponível como ferramenta sob demanda no modo Agent. Não fica disponível nos modos Plan e Goal.",+ jevPrivacyNotice: "Ao chamar JevClassify, o estado e as perguntas fornecidos são enviados diretamente ao TypeSafe. Não inclua segredos nem dados pessoais.",+ jevApiKey: "Chave de API do TypeSafe",+ jevApiKeyPlaceholder: "Cole a chave de API do TypeSafe",+ jevSaveKey: "Salvar chave",+ jevRemoveKey: "Remover chave",+ jevKeyConfigured: "Chave de API salva com segurança",+ jevKeyMissing: "Nenhuma chave de API configurada",+ jevKeyStatusChecking: "Verificando a chave de API…",+ jevKeyStatusUnavailable: "Não foi possível verificar o status da chave de API",+ jevKeySaved: "Chave de API do Jev salva",+ jevKeyRemoved: "Chave de API do Jev removida",catalogNeverFetched: "nunca",serviceModels: "Modelos deste serviço",accountModels: "Modelos para esta conta",diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.tsindex 2b17c0857..0498eb717 100644--- a/packages/i18n/src/locales/tr/index.ts+++ b/packages/i18n/src/locales/tr/index.ts@@ -1496,6 +1496,21 @@ sklm: {catalogSourceEmpty: "yok",catalogStatusLine: "Katalog: {{source}} · {{models}} model · güncellendi {{fetchedAt}}",catalogStatusUnknown: "Model katalog durumu yok",+ jevTitle: "Jev yapılandırılmış sınıflandırıcı",+ jevDescription: "Agent için seçenek, puan ve doğru/yanlış sorularını yanıtlayan yapılandırılmış sınıflandırıcı TypeSafe Jev'i ayarlayın.",+ jevEnable: "Agent için Jev'i etkinleştir",+ jevEnableDescription: "Jev, Agent modunda isteğe bağlı bir araç olur. Plan ve Goal modlarında kullanılamaz.",+ jevPrivacyNotice: "Agent JevClassify'ı çağırdığında sağlanan durum ve sorular doğrudan TypeSafe'e gönderilir. Gizli veya kişisel bilgi eklemeyin.",+ jevApiKey: "TypeSafe API anahtarı",+ jevApiKeyPlaceholder: "TypeSafe API anahtarını yapıştırın",+ jevSaveKey: "Anahtarı kaydet",+ jevRemoveKey: "Anahtarı kaldır",+ jevKeyConfigured: "API anahtarı güvenli biçimde kaydedildi",+ jevKeyMissing: "API anahtarı yapılandırılmadı",+ jevKeyStatusChecking: "API anahtarı denetleniyor…",+ jevKeyStatusUnavailable: "API anahtarı durumu denetlenemedi",+ jevKeySaved: "Jev API anahtarı kaydedildi",+ jevKeyRemoved: "Jev API anahtarı kaldırıldı",catalogNeverFetched: "hiç",serviceModels: "Bu servisin modelleri",accountModels: "Bu hesabın modelleri",diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.tsindex 9277b5025..799a3b130 100644--- a/packages/i18n/src/locales/zh-CN/index.ts+++ b/packages/i18n/src/locales/zh-CN/index.ts@@ -1477,6 +1477,21 @@ sklm: {catalogSourceEmpty: "不可用",catalogStatusLine: "目录:{{source}} · {{models}} 个模型 · 更新于 {{fetchedAt}}",catalogStatusUnknown: "模型目录状态不可用",+ jevTitle: "Jev 结构化分类器",+ jevDescription: "配置 TypeSafe Jev。它能为 Agent 回答选项、评分和是非类结构化问题。",+ jevEnable: "在 Agent 中启用 Jev",+ jevEnableDescription: "启用后,Jev 会作为 Agent 模式下的按需工具;Plan 和 Goal 模式不可用。",+ jevPrivacyNotice: "Agent 调用 JevClassify 时,传入的状态和问题会直接发送给 TypeSafe。请勿包含密钥或个人信息。",+ jevApiKey: "TypeSafe API 密钥",+ jevApiKeyPlaceholder: "粘贴 TypeSafe API 密钥",+ jevSaveKey: "保存密钥",+ jevRemoveKey: "移除密钥",+ jevKeyConfigured: "API 密钥已安全保存",+ jevKeyMissing: "尚未配置 API 密钥",+ jevKeyStatusChecking: "正在检查 API 密钥…",+ jevKeyStatusUnavailable: "无法检查 API 密钥状态",+ jevKeySaved: "Jev API 密钥已保存",+ jevKeyRemoved: "Jev API 密钥已移除",catalogNeverFetched: "从未获取",serviceModels: "该服务的模型",accountModels: "该账号的模型",diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.tsindex 16d7cf54f..d3fa3660d 100644--- a/packages/i18n/src/locales/zh-TW/index.ts+++ b/packages/i18n/src/locales/zh-TW/index.ts@@ -1477,6 +1477,21 @@ sklm: {catalogSourceEmpty: "不可用",catalogStatusLine: "目錄:{{source}} · {{models}} 個模型 · 更新於 {{fetchedAt}}",catalogStatusUnknown: "模型目錄狀態不可用",+ jevTitle: "Jev 結構化分類器",+ jevDescription: "設定 TypeSafe Jev。它能為 Agent 回答選擇、評分和是非類結構化問題。",+ jevEnable: "在 Agent 中啟用 Jev",+ jevEnableDescription: "啟用後,Jev 會作為 Agent 模式中的隨選工具;Plan 和 Goal 模式無法使用。",+ jevPrivacyNotice: "Agent 呼叫 JevClassify 時,傳入的狀態和問題會直接傳送給 TypeSafe。請勿包含密鑰或個人資訊。",+ jevApiKey: "TypeSafe API 金鑰",+ jevApiKeyPlaceholder: "貼上 TypeSafe API 金鑰",+ jevSaveKey: "儲存金鑰",+ jevRemoveKey: "移除金鑰",+ jevKeyConfigured: "API 金鑰已安全儲存",+ jevKeyMissing: "尚未設定 API 金鑰",+ jevKeyStatusChecking: "正在檢查 API 金鑰…",+ jevKeyStatusUnavailable: "無法檢查 API 金鑰狀態",+ jevKeySaved: "Jev API 金鑰已儲存",+ jevKeyRemoved: "Jev API 金鑰已移除",catalogNeverFetched: "從未獲取",serviceModels: "該服務的模型",accountModels: "該賬號的模型",diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.tsindex e1fe347a6..e9f4bbee4 100644--- a/packages/shared/src/index.ts+++ b/packages/shared/src/index.ts@@ -71,6 +71,7 @@ export * from "./prompt-enhancement.js";export * from "./native-web-search.js";export * from "./native-web-search-transport.js";export * from "./header-value.js";+export * from "./secret-refs.js";export * from "./session-todos.js";export * from "./tool-call-lineage.js";diff --git a/packages/shared/src/secret-refs.ts b/packages/shared/src/secret-refs.tsnew file mode 100644index 000000000..9711a6488--- /dev/null+++ b/packages/shared/src/secret-refs.ts@@ -0,0 +1,2 @@+/** Fixed Host secret references owned by first-party desktop features. */+export const JEV_API_KEY_SECRET_REF = "secret:app:typesafe-jev";diff --git a/packages/shared/src/types/settings.ts b/packages/shared/src/types/settings.tsindex 4471fd3d2..9ba26c663 100644--- a/packages/shared/src/types/settings.ts+++ b/packages/shared/src/types/settings.ts@@ -44,6 +44,8 @@ export type AppSettings = {* Absent and false use the bounded ten-retry policy.*/infiniteProviderRetry?: boolean;+ /** Allow Agent mode to call TypeSafe Jev for explicit structured classifications. */+ jevEnabled?: boolean;/** Prevent idle system sleep while this desktop app runs; off when absent. */keepAwakeWhileRunning?: boolean;/** Configured command shell for the agent Bash protocol tool. */