@geminixiang/mikan 1.0.0-beta.68 → 1.0.0-beta.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,12 @@ any release.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [1.0.0-beta.69]
13
+
14
+ ### Changed
15
+
16
+ - `harness/jev.ts` is now backed by [`@geminixiang/jev`](https://github.com/geminixiang/jev), a standalone SDK shaped like pi-ai (providers own auth, a model catalog, and a wire implementation) instead of a hand-rolled OpenRouter fetch client. `evaluateWithJev`'s signature, types, and error classes are unchanged, so the auto-reply gate, DM task-intent classification, and the `jev` tool are unaffected. The swap adds request retries and timeouts, neither of which existed before, and a path to other Jev backends (TypeSafe, Vercel AI Gateway, Cloudflare Workers AI) without touching call sites.
17
+
12
18
  ## [1.0.0-beta.68]
13
19
 
14
20
  ### Added
@@ -81,7 +81,7 @@ export const ENV_MANIFEST = [
81
81
  {
82
82
  name: "OPENROUTER_API_KEY",
83
83
  secret: true,
84
- doc: "OpenRouter API key (chat models routed through OpenRouter, and harness/jev.ts's Jev client)",
84
+ doc: "OpenRouter API key (chat models routed through OpenRouter, and harness/jev.ts's Jev client via @geminixiang/jev)",
85
85
  },
86
86
  ],
87
87
  },
@@ -1 +1 @@
1
- {"version":3,"file":"env-manifest.js","sourceRoot":"","sources":["../src/env-manifest.ts"],"names":[],"mappings":"AAaA,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;IACtC,IAAI,GAAG;QAAE,OAAO,GAAG,CAAC;IAEpB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC;IACtD,OAAO,QAAQ,IAAI,SAAS,CAAC;AAC/B,CAAC;AAED,0EAA0E;AAC1E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C,CAAC;QAC3E,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YAC9B,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;YAChD,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;iBACzE,MAAM,CAAC,OAAO,CAAC;iBACf,IAAI,CAAC,IAAI,CAAC,CAAC;YACd,KAAK,CAAC,IAAI,CACR,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,GAAG,EAAE,CAC1F,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;IACnF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAChC,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACjC,CAAC","sourcesContent":["/**\n * The daemon's environment interface, declared as data — the one inventory\n * that startup validation, `mikan env`, `--help`, and the pm2 deploy\n * template check all derive from. Add a var here and every derived surface\n * picks it up; a var read anywhere else but not listed here is a bug.\n *\n * Names are the un-prefixed spelling; `readEnv` accepts a `MIKAN_`-prefixed\n * alias for each. Not covered: dynamic OAuth service keys from\n * OAUTH_SERVICES_JSON (data-driven by design) and standard proxy vars\n * (HTTPS_PROXY/HTTP_PROXY/NO_PROXY).\n */\nimport type { EnvGroup } from \"./types.js\";\n\nexport function readEnv(name: string): string | undefined {\n const raw = process.env[name]?.trim();\n if (raw) return raw;\n\n const prefixed = process.env[`MIKAN_${name}`]?.trim();\n return prefixed || undefined;\n}\n\n/** Read a standards-owned environment variable without mikan aliasing. */\nexport function readStandardEnv(name: string): string | undefined {\n return process.env[name]?.trim() || undefined;\n}\n\nexport function setEnvAliases(name: string, value: string): void {\n process.env[name] = value;\n process.env[`MIKAN_${name}`] = value;\n}\n\nexport type { EnvGroup } from \"./types.js\";\n\nexport const ENV_MANIFEST: readonly EnvGroup[] = [\n {\n key: \"slack\",\n title: \"Slack\",\n kind: \"platform\",\n vars: [\n {\n name: \"SLACK_APP_TOKEN\",\n required: true,\n secret: true,\n doc: \"Socket-mode app token (xapp-…)\",\n },\n { name: \"SLACK_BOT_TOKEN\", required: true, secret: true, doc: \"Bot token (xoxb-…)\" },\n ],\n },\n {\n key: \"telegram\",\n title: \"Telegram\",\n kind: \"platform\",\n vars: [{ name: \"TELEGRAM_BOT_TOKEN\", required: true, secret: true, doc: \"BotFather token\" }],\n },\n {\n key: \"discord\",\n title: \"Discord\",\n kind: \"platform\",\n vars: [{ name: \"DISCORD_BOT_TOKEN\", required: true, secret: true, doc: \"Bot token\" }],\n },\n {\n key: \"github\",\n title: \"GitHub\",\n kind: \"platform\",\n doc: \"Issue/PR conversations via a GitHub App (polling; optional webhook poke)\",\n vars: [\n { name: \"GITHUB_APP_ID\", required: true, doc: \"GitHub App id\" },\n { name: \"GITHUB_INSTALLATION_ID\", required: true, doc: \"App installation id\" },\n {\n name: \"GITHUB_APP_PRIVATE_KEY_PATH\",\n doc: \"Path to the App private key .pem (preferred; keep outside any repo)\",\n },\n {\n name: \"GITHUB_APP_PRIVATE_KEY\",\n secret: true,\n deploy: false,\n doc: \"App private key PEM with literal \\\\n newlines (fallback)\",\n },\n {\n name: \"GITHUB_REPOS\",\n doc: \"Comma-separated owner/repo allowlist (default: all installed)\",\n },\n { name: \"GITHUB_POLL_INTERVAL\", doc: \"Poll interval in seconds (default 60)\" },\n {\n name: \"GITHUB_WEBHOOK_SECRET\",\n secret: true,\n doc: \"Webhook secret; when set, deliveries to /github/webhook trigger an immediate poll (needs LINK_PORT)\",\n },\n ],\n anyOf: [\"GITHUB_APP_PRIVATE_KEY\", \"GITHUB_APP_PRIVATE_KEY_PATH\"],\n },\n {\n key: \"llm\",\n title: \"LLM providers\",\n kind: \"feature\",\n vars: [\n { name: \"ANTHROPIC_API_KEY\", secret: true, doc: \"Anthropic API key\" },\n { name: \"OPENAI_API_KEY\", secret: true, doc: \"OpenAI API key\" },\n {\n name: \"OPENROUTER_API_KEY\",\n secret: true,\n doc: \"OpenRouter API key (chat models routed through OpenRouter, and harness/jev.ts's Jev client)\",\n },\n ],\n },\n {\n key: \"link\",\n title: \"Link/OAuth server\",\n kind: \"feature\",\n doc: \"Credential onboarding links, session view, and the Admin portal\",\n vars: [\n { name: \"LINK_URL\", doc: \"Externally visible base URL, e.g. https://mikan.example.com\" },\n { name: \"LINK_PORT\", doc: \"Listen port (default 8181 when LINK_URL is set)\" },\n { name: \"GITHUB_OAUTH_CLIENT_ID\", doc: \"GitHub OAuth app for /login linking\" },\n { name: \"GITHUB_OAUTH_CLIENT_SECRET\", secret: true, doc: \"GitHub OAuth app secret\" },\n { name: \"GOOGLE_WORKSPACE_CLI_CLIENT_ID\", doc: \"Google Workspace OAuth client for /login\" },\n {\n name: \"GOOGLE_WORKSPACE_CLI_CLIENT_SECRET\",\n secret: true,\n doc: \"Google Workspace OAuth secret\",\n },\n { name: \"GOOGLE_CLOUD_SDK_CLIENT_ID\", doc: \"Google Cloud SDK OAuth client for /login\" },\n {\n name: \"GOOGLE_CLOUD_SDK_CLIENT_SECRET\",\n secret: true,\n doc: \"Google Cloud SDK OAuth secret\",\n },\n ],\n },\n {\n key: \"openconnector\",\n title: \"OpenConnector\",\n kind: \"feature\",\n doc: \"Default open-connector MCP server and the admin token that mints per-conversation runtime tokens\",\n vars: [\n {\n name: \"OPENCONNECTOR_ENDPOINT\",\n doc: \"Default MCP endpoint used when a conversation does not declare open-connector\",\n },\n {\n name: \"OPENCONNECTOR_ADMIN_TOKEN\",\n secret: true,\n doc: \"Host-only admin token used to mint one runtime token per conversation for the default server\",\n },\n ],\n },\n {\n key: \"cloudflare\",\n title: \"Cloudflare sandbox\",\n kind: \"feature\",\n doc: \"For --sandbox=cloudflare:<id> via the bridge worker\",\n vars: [\n { name: \"CLOUDFLARE_SANDBOX_URL\", doc: \"Bridge worker URL\" },\n { name: \"CLOUDFLARE_SANDBOX_TOKEN\", secret: true, doc: \"Bridge worker auth token\" },\n ],\n },\n {\n key: \"observability\",\n title: \"Observability\",\n kind: \"feature\",\n vars: [\n { name: \"SENTRY_DSN\", secret: true, doc: \"Sentry DSN (settings.json sentry.dsn wins)\" },\n {\n name: \"SENTRY_ENVIRONMENT\",\n deploy: false,\n doc: \"Sentry environment tag (default production)\",\n },\n { name: \"SENTRY_ENABLED\", deploy: false, doc: \"Set to false to disable Sentry errors\" },\n { name: \"OTEL_SDK_DISABLED\", doc: \"Set to true to disable OpenTelemetry\" },\n { name: \"OTEL_SERVICE_NAME\", doc: \"OTLP service name (default mikan)\" },\n {\n name: \"OTEL_RESOURCE_ATTRIBUTES\",\n secret: true,\n doc: \"Comma-separated safe resource attrs\",\n },\n { name: \"OTEL_TRACES_EXPORTER\", doc: \"Trace exporter: otlp or none\" },\n { name: \"OTEL_METRICS_EXPORTER\", doc: \"Metrics exporter: otlp or none\" },\n { name: \"OTEL_EXPORTER_OTLP_ENDPOINT\", secret: true, doc: \"Base OTLP HTTP endpoint\" },\n { name: \"OTEL_EXPORTER_OTLP_TRACES_ENDPOINT\", secret: true, doc: \"OTLP traces endpoint\" },\n { name: \"OTEL_EXPORTER_OTLP_METRICS_ENDPOINT\", secret: true, doc: \"OTLP metrics endpoint\" },\n { name: \"OTEL_EXPORTER_OTLP_HEADERS\", secret: true, doc: \"Shared OTLP auth headers\" },\n { name: \"OTEL_EXPORTER_OTLP_TRACES_HEADERS\", secret: true, doc: \"OTLP trace headers\" },\n { name: \"OTEL_EXPORTER_OTLP_METRICS_HEADERS\", secret: true, doc: \"OTLP metric headers\" },\n { name: \"OTEL_EXPORTER_OTLP_PROTOCOL\", doc: \"OTLP protocol; http/protobuf supported\" },\n { name: \"OTEL_EXPORTER_OTLP_TRACES_PROTOCOL\", doc: \"Trace protocol override\" },\n { name: \"OTEL_EXPORTER_OTLP_METRICS_PROTOCOL\", doc: \"Metric protocol override\" },\n { name: \"OTEL_EXPORTER_OTLP_TIMEOUT\", doc: \"Shared OTLP timeout in milliseconds\" },\n { name: \"OTEL_EXPORTER_OTLP_TRACES_TIMEOUT\", doc: \"Trace timeout in milliseconds\" },\n { name: \"OTEL_EXPORTER_OTLP_METRICS_TIMEOUT\", doc: \"Metric timeout in milliseconds\" },\n { name: \"OTEL_METRIC_EXPORT_INTERVAL\", doc: \"Metric export interval in milliseconds\" },\n { name: \"OTEL_METRIC_EXPORT_TIMEOUT\", doc: \"Metric export timeout in milliseconds\" },\n ],\n },\n {\n key: \"runtime\",\n title: \"Runtime\",\n kind: \"feature\",\n vars: [\n { name: \"STATE_DIR\", deploy: false, doc: \"State dir override (same as --state-dir)\" },\n {\n name: \"HTTP_IDLE_TIMEOUT\",\n deploy: false,\n doc: \"Idle timeout in ms for outbound HTTP streams\",\n },\n ],\n },\n];\n\ntype EnvLookup = (name: string) => string | undefined;\n\n/** A platform group activates when all required vars (and one anyOf) are set. */\nexport function platformIsActive(key: string, env: EnvLookup = readEnv): boolean {\n const group = ENV_MANIFEST.find((candidate) => candidate.key === key);\n if (!group) throw new Error(`Unknown env-manifest group: ${key}`);\n const required = group.vars.filter((spec) => spec.required);\n if (!required.every((spec) => env(spec.name))) return false;\n if (group.anyOf && !group.anyOf.some((name) => env(name))) return false;\n return true;\n}\n\nexport function activePlatformKeys(env: EnvLookup = readEnv): string[] {\n return ENV_MANIFEST.filter(\n (group) => group.kind === \"platform\" && platformIsActive(group.key, env),\n ).map((group) => group.key);\n}\n\n/** One line per platform group: the vars an operator must set to activate it. */\nfunction platformRecipe(group: EnvGroup): string {\n const required = group.vars.filter((spec) => spec.required).map((spec) => spec.name);\n const alternative = group.anyOf ? ` + ${group.anyOf.join(\" | \")}` : \"\";\n return `${group.title}: ${required.join(\" + \")}${alternative}`;\n}\n\nexport function noPlatformsMessage(): string {\n const recipes = ENV_MANIFEST.filter((group) => group.kind === \"platform\")\n .map((group) => ` ${platformRecipe(group)}`)\n .join(\"\\n\");\n return `No platform tokens found. Set one of:\\n${recipes}`;\n}\n\n/** The `--help` environment section, derived from the platform groups. */\nexport function envSummaryLines(): string[] {\n return ENV_MANIFEST.filter((group) => group.kind === \"platform\").map(\n (group) => ` ${platformRecipe(group)}`,\n );\n}\n\n/** Every var an operator may set; `deployOnly` filters to template-listed ones. */\nexport function manifestVarNames(options?: { deployOnly?: boolean }): string[] {\n return ENV_MANIFEST.flatMap((group) =>\n group.vars\n .filter((spec) => !options?.deployOnly || spec.deploy !== false)\n .map((spec) => spec.name),\n );\n}\n\n/** `mikan env` output: every group and var with set/unset status. No values. */\nexport function envReport(env: EnvLookup = readEnv): string {\n const lines: string[] = [];\n for (const group of ENV_MANIFEST) {\n const active =\n group.kind === \"platform\"\n ? platformIsActive(group.key, env)\n ? \" — active\"\n : \" — inactive\"\n : \"\";\n lines.push(`${group.title}${active}${group.doc ? ` · ${group.doc}` : \"\"}`);\n for (const spec of group.vars) {\n const status = env(spec.name) ? \"set\" : \"unset\";\n const marks = [spec.required ? \"required\" : \"\", spec.secret ? \"secret\" : \"\"]\n .filter(Boolean)\n .join(\", \");\n lines.push(\n ` ${spec.name.padEnd(36)} ${status.padEnd(6)}${marks ? ` [${marks}]` : \"\"} ${spec.doc}`,\n );\n }\n lines.push(\"\");\n }\n lines.push(\"Each var also accepts a MIKAN_-prefixed alias (e.g. MIKAN_LINK_URL).\");\n return lines.join(\"\\n\");\n}\n\n/**\n * Externally-visible base URL of the link/OAuth server, e.g.\n * `https://mikan.example.com` (no trailing slash). Read from `LINK_URL` or\n * `MIKAN_LINK_URL`, the same env var the bot uses to build credential onboarding links.\n */\nexport function resolveLinkBaseUrl(): string | undefined {\n const raw = readEnv(\"LINK_URL\");\n if (!raw) return undefined;\n return raw.replace(/\\/+$/, \"\");\n}\n"]}
1
+ {"version":3,"file":"env-manifest.js","sourceRoot":"","sources":["../src/env-manifest.ts"],"names":[],"mappings":"AAaA,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;IACtC,IAAI,GAAG;QAAE,OAAO,GAAG,CAAC;IAEpB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC;IACtD,OAAO,QAAQ,IAAI,SAAS,CAAC;AAC/B,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,KAAa;IACvD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC;AACvC,CAAC;AAID,MAAM,CAAC,MAAM,YAAY,GAAwB;IAC/C;QACE,GAAG,EAAE,OAAO;QACZ,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE;YACJ;gBACE,IAAI,EAAE,iBAAi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AAC,MAAM,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,GAAG,EAAE,CAC1F,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;IACnF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAChC,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACjC,CAAC","sourcesContent":["/**\n * The daemon's environment interface, declared as data — the one inventory\n * that startup validation, `mikan env`, `--help`, and the pm2 deploy\n * template check all derive from. Add a var here and every derived surface\n * picks it up; a var read anywhere else but not listed here is a bug.\n *\n * Names are the un-prefixed spelling; `readEnv` accepts a `MIKAN_`-prefixed\n * alias for each. Not covered: dynamic OAuth service keys from\n * OAUTH_SERVICES_JSON (data-driven by design) and standard proxy vars\n * (HTTPS_PROXY/HTTP_PROXY/NO_PROXY).\n */\nimport type { EnvGroup } from \"./types.js\";\n\nexport function readEnv(name: string): string | undefined {\n const raw = process.env[name]?.trim();\n if (raw) return raw;\n\n const prefixed = process.env[`MIKAN_${name}`]?.trim();\n return prefixed || undefined;\n}\n\n/** Read a standards-owned environment variable without mikan aliasing. */\nexport function readStandardEnv(name: string): string | undefined {\n return process.env[name]?.trim() || undefined;\n}\n\nexport function setEnvAliases(name: string, value: string): void {\n process.env[name] = value;\n process.env[`MIKAN_${name}`] = value;\n}\n\nexport type { EnvGroup } from \"./types.js\";\n\nexport const ENV_MANIFEST: readonly EnvGroup[] = [\n {\n key: \"slack\",\n title: \"Slack\",\n kind: \"platform\",\n vars: [\n {\n name: \"SLACK_APP_TOKEN\",\n required: true,\n secret: true,\n doc: \"Socket-mode app token (xapp-…)\",\n },\n { name: \"SLACK_BOT_TOKEN\", required: true, secret: true, doc: \"Bot token (xoxb-…)\" },\n ],\n },\n {\n key: \"telegram\",\n title: \"Telegram\",\n kind: \"platform\",\n vars: [{ name: \"TELEGRAM_BOT_TOKEN\", required: true, secret: true, doc: \"BotFather token\" }],\n },\n {\n key: \"discord\",\n title: \"Discord\",\n kind: \"platform\",\n vars: [{ name: \"DISCORD_BOT_TOKEN\", required: true, secret: true, doc: \"Bot token\" }],\n },\n {\n key: \"github\",\n title: \"GitHub\",\n kind: \"platform\",\n doc: \"Issue/PR conversations via a GitHub App (polling; optional webhook poke)\",\n vars: [\n { name: \"GITHUB_APP_ID\", required: true, doc: \"GitHub App id\" },\n { name: \"GITHUB_INSTALLATION_ID\", required: true, doc: \"App installation id\" },\n {\n name: \"GITHUB_APP_PRIVATE_KEY_PATH\",\n doc: \"Path to the App private key .pem (preferred; keep outside any repo)\",\n },\n {\n name: \"GITHUB_APP_PRIVATE_KEY\",\n secret: true,\n deploy: false,\n doc: \"App private key PEM with literal \\\\n newlines (fallback)\",\n },\n {\n name: \"GITHUB_REPOS\",\n doc: \"Comma-separated owner/repo allowlist (default: all installed)\",\n },\n { name: \"GITHUB_POLL_INTERVAL\", doc: \"Poll interval in seconds (default 60)\" },\n {\n name: \"GITHUB_WEBHOOK_SECRET\",\n secret: true,\n doc: \"Webhook secret; when set, deliveries to /github/webhook trigger an immediate poll (needs LINK_PORT)\",\n },\n ],\n anyOf: [\"GITHUB_APP_PRIVATE_KEY\", \"GITHUB_APP_PRIVATE_KEY_PATH\"],\n },\n {\n key: \"llm\",\n title: \"LLM providers\",\n kind: \"feature\",\n vars: [\n { name: \"ANTHROPIC_API_KEY\", secret: true, doc: \"Anthropic API key\" },\n { name: \"OPENAI_API_KEY\", secret: true, doc: \"OpenAI API key\" },\n {\n name: \"OPENROUTER_API_KEY\",\n secret: true,\n doc: \"OpenRouter API key (chat models routed through OpenRouter, and harness/jev.ts's Jev client via @geminixiang/jev)\",\n },\n ],\n },\n {\n key: \"link\",\n title: \"Link/OAuth server\",\n kind: \"feature\",\n doc: \"Credential onboarding links, session view, and the Admin portal\",\n vars: [\n { name: \"LINK_URL\", doc: \"Externally visible base URL, e.g. https://mikan.example.com\" },\n { name: \"LINK_PORT\", doc: \"Listen port (default 8181 when LINK_URL is set)\" },\n { name: \"GITHUB_OAUTH_CLIENT_ID\", doc: \"GitHub OAuth app for /login linking\" },\n { name: \"GITHUB_OAUTH_CLIENT_SECRET\", secret: true, doc: \"GitHub OAuth app secret\" },\n { name: \"GOOGLE_WORKSPACE_CLI_CLIENT_ID\", doc: \"Google Workspace OAuth client for /login\" },\n {\n name: \"GOOGLE_WORKSPACE_CLI_CLIENT_SECRET\",\n secret: true,\n doc: \"Google Workspace OAuth secret\",\n },\n { name: \"GOOGLE_CLOUD_SDK_CLIENT_ID\", doc: \"Google Cloud SDK OAuth client for /login\" },\n {\n name: \"GOOGLE_CLOUD_SDK_CLIENT_SECRET\",\n secret: true,\n doc: \"Google Cloud SDK OAuth secret\",\n },\n ],\n },\n {\n key: \"openconnector\",\n title: \"OpenConnector\",\n kind: \"feature\",\n doc: \"Default open-connector MCP server and the admin token that mints per-conversation runtime tokens\",\n vars: [\n {\n name: \"OPENCONNECTOR_ENDPOINT\",\n doc: \"Default MCP endpoint used when a conversation does not declare open-connector\",\n },\n {\n name: \"OPENCONNECTOR_ADMIN_TOKEN\",\n secret: true,\n doc: \"Host-only admin token used to mint one runtime token per conversation for the default server\",\n },\n ],\n },\n {\n key: \"cloudflare\",\n title: \"Cloudflare sandbox\",\n kind: \"feature\",\n doc: \"For --sandbox=cloudflare:<id> via the bridge worker\",\n vars: [\n { name: \"CLOUDFLARE_SANDBOX_URL\", doc: \"Bridge worker URL\" },\n { name: \"CLOUDFLARE_SANDBOX_TOKEN\", secret: true, doc: \"Bridge worker auth token\" },\n ],\n },\n {\n key: \"observability\",\n title: \"Observability\",\n kind: \"feature\",\n vars: [\n { name: \"SENTRY_DSN\", secret: true, doc: \"Sentry DSN (settings.json sentry.dsn wins)\" },\n {\n name: \"SENTRY_ENVIRONMENT\",\n deploy: false,\n doc: \"Sentry environment tag (default production)\",\n },\n { name: \"SENTRY_ENABLED\", deploy: false, doc: \"Set to false to disable Sentry errors\" },\n { name: \"OTEL_SDK_DISABLED\", doc: \"Set to true to disable OpenTelemetry\" },\n { name: \"OTEL_SERVICE_NAME\", doc: \"OTLP service name (default mikan)\" },\n {\n name: \"OTEL_RESOURCE_ATTRIBUTES\",\n secret: true,\n doc: \"Comma-separated safe resource attrs\",\n },\n { name: \"OTEL_TRACES_EXPORTER\", doc: \"Trace exporter: otlp or none\" },\n { name: \"OTEL_METRICS_EXPORTER\", doc: \"Metrics exporter: otlp or none\" },\n { name: \"OTEL_EXPORTER_OTLP_ENDPOINT\", secret: true, doc: \"Base OTLP HTTP endpoint\" },\n { name: \"OTEL_EXPORTER_OTLP_TRACES_ENDPOINT\", secret: true, doc: \"OTLP traces endpoint\" },\n { name: \"OTEL_EXPORTER_OTLP_METRICS_ENDPOINT\", secret: true, doc: \"OTLP metrics endpoint\" },\n { name: \"OTEL_EXPORTER_OTLP_HEADERS\", secret: true, doc: \"Shared OTLP auth headers\" },\n { name: \"OTEL_EXPORTER_OTLP_TRACES_HEADERS\", secret: true, doc: \"OTLP trace headers\" },\n { name: \"OTEL_EXPORTER_OTLP_METRICS_HEADERS\", secret: true, doc: \"OTLP metric headers\" },\n { name: \"OTEL_EXPORTER_OTLP_PROTOCOL\", doc: \"OTLP protocol; http/protobuf supported\" },\n { name: \"OTEL_EXPORTER_OTLP_TRACES_PROTOCOL\", doc: \"Trace protocol override\" },\n { name: \"OTEL_EXPORTER_OTLP_METRICS_PROTOCOL\", doc: \"Metric protocol override\" },\n { name: \"OTEL_EXPORTER_OTLP_TIMEOUT\", doc: \"Shared OTLP timeout in milliseconds\" },\n { name: \"OTEL_EXPORTER_OTLP_TRACES_TIMEOUT\", doc: \"Trace timeout in milliseconds\" },\n { name: \"OTEL_EXPORTER_OTLP_METRICS_TIMEOUT\", doc: \"Metric timeout in milliseconds\" },\n { name: \"OTEL_METRIC_EXPORT_INTERVAL\", doc: \"Metric export interval in milliseconds\" },\n { name: \"OTEL_METRIC_EXPORT_TIMEOUT\", doc: \"Metric export timeout in milliseconds\" },\n ],\n },\n {\n key: \"runtime\",\n title: \"Runtime\",\n kind: \"feature\",\n vars: [\n { name: \"STATE_DIR\", deploy: false, doc: \"State dir override (same as --state-dir)\" },\n {\n name: \"HTTP_IDLE_TIMEOUT\",\n deploy: false,\n doc: \"Idle timeout in ms for outbound HTTP streams\",\n },\n ],\n },\n];\n\ntype EnvLookup = (name: string) => string | undefined;\n\n/** A platform group activates when all required vars (and one anyOf) are set. */\nexport function platformIsActive(key: string, env: EnvLookup = readEnv): boolean {\n const group = ENV_MANIFEST.find((candidate) => candidate.key === key);\n if (!group) throw new Error(`Unknown env-manifest group: ${key}`);\n const required = group.vars.filter((spec) => spec.required);\n if (!required.every((spec) => env(spec.name))) return false;\n if (group.anyOf && !group.anyOf.some((name) => env(name))) return false;\n return true;\n}\n\nexport function activePlatformKeys(env: EnvLookup = readEnv): string[] {\n return ENV_MANIFEST.filter(\n (group) => group.kind === \"platform\" && platformIsActive(group.key, env),\n ).map((group) => group.key);\n}\n\n/** One line per platform group: the vars an operator must set to activate it. */\nfunction platformRecipe(group: EnvGroup): string {\n const required = group.vars.filter((spec) => spec.required).map((spec) => spec.name);\n const alternative = group.anyOf ? ` + ${group.anyOf.join(\" | \")}` : \"\";\n return `${group.title}: ${required.join(\" + \")}${alternative}`;\n}\n\nexport function noPlatformsMessage(): string {\n const recipes = ENV_MANIFEST.filter((group) => group.kind === \"platform\")\n .map((group) => ` ${platformRecipe(group)}`)\n .join(\"\\n\");\n return `No platform tokens found. Set one of:\\n${recipes}`;\n}\n\n/** The `--help` environment section, derived from the platform groups. */\nexport function envSummaryLines(): string[] {\n return ENV_MANIFEST.filter((group) => group.kind === \"platform\").map(\n (group) => ` ${platformRecipe(group)}`,\n );\n}\n\n/** Every var an operator may set; `deployOnly` filters to template-listed ones. */\nexport function manifestVarNames(options?: { deployOnly?: boolean }): string[] {\n return ENV_MANIFEST.flatMap((group) =>\n group.vars\n .filter((spec) => !options?.deployOnly || spec.deploy !== false)\n .map((spec) => spec.name),\n );\n}\n\n/** `mikan env` output: every group and var with set/unset status. No values. */\nexport function envReport(env: EnvLookup = readEnv): string {\n const lines: string[] = [];\n for (const group of ENV_MANIFEST) {\n const active =\n group.kind === \"platform\"\n ? platformIsActive(group.key, env)\n ? \" — active\"\n : \" — inactive\"\n : \"\";\n lines.push(`${group.title}${active}${group.doc ? ` · ${group.doc}` : \"\"}`);\n for (const spec of group.vars) {\n const status = env(spec.name) ? \"set\" : \"unset\";\n const marks = [spec.required ? \"required\" : \"\", spec.secret ? \"secret\" : \"\"]\n .filter(Boolean)\n .join(\", \");\n lines.push(\n ` ${spec.name.padEnd(36)} ${status.padEnd(6)}${marks ? ` [${marks}]` : \"\"} ${spec.doc}`,\n );\n }\n lines.push(\"\");\n }\n lines.push(\"Each var also accepts a MIKAN_-prefixed alias (e.g. MIKAN_LINK_URL).\");\n return lines.join(\"\\n\");\n}\n\n/**\n * Externally-visible base URL of the link/OAuth server, e.g.\n * `https://mikan.example.com` (no trailing slash). Read from `LINK_URL` or\n * `MIKAN_LINK_URL`, the same env var the bot uses to build credential onboarding links.\n */\nexport function resolveLinkBaseUrl(): string | undefined {\n const raw = readEnv(\"LINK_URL\");\n if (!raw) return undefined;\n return raw.replace(/\\/+$/, \"\");\n}\n"]}
@@ -9,7 +9,7 @@ export declare const JEV_MODEL_ID = "~typesafe/jev-latest";
9
9
  export type JevEntry = string | number | boolean | null | JevEntry[] | {
10
10
  [key: string]: JevEntry;
11
11
  };
12
- /** A shared caller-facing question shape; translated to OpenRouter's wire format below. */
12
+ /** A shared caller-facing question shape; translated to `@geminixiang/jev`'s shape below. */
13
13
  export type JevQuestion = {
14
14
  type: "boolean";
15
15
  instructions: JevEntry;
@@ -61,6 +61,7 @@ export interface JevResult<QUESTIONS extends JevQuestions> {
61
61
  };
62
62
  readonly model: string;
63
63
  }
64
+ /** Thrown when no Jev backend has a usable credential. Callers fail closed on this. */
64
65
  export declare class JevNotConfiguredError extends Error {
65
66
  constructor();
66
67
  }
@@ -76,10 +77,10 @@ export interface EvaluateWithJevOptions {
76
77
  }
77
78
  /**
78
79
  * Evaluate one or more typed questions against a shared `state` using Jev,
79
- * reached through OpenRouter's decisions API. Every question is scored
80
- * independently against the same state in a single request; batching
81
- * questions here is cheap (they share the input) and is preferred over
82
- * separate calls per question.
80
+ * reached through OpenRouter's decisions API by way of `@geminixiang/jev`.
81
+ * Every question is scored independently against the same state in a
82
+ * single request; batching questions here is cheap (they share the input)
83
+ * and is preferred over separate calls per question.
83
84
  */
84
85
  export declare function evaluateWithJev<const QUESTIONS extends JevQuestions>(state: JevEntry, questions: QUESTIONS, options?: EvaluateWithJevOptions): Promise<JevResult<QUESTIONS>>;
85
86
  //# sourceMappingURL=jev.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jev.d.ts","sourceRoot":"","sources":["../../src/harness/jev.ts"],"names":[],"mappings":"AAwBA,qDAAqD;AACrD,eAAO,MAAM,YAAY,yBAAyB,CAAC;AAInD;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,QAAQ,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,CAAC;AAEnG,2FAA2F;AAC3F,MAAM,MAAM,WAAW,GACnB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,EAAE,QAAQ,CAAC;IACvB,sDAAsD;IACtD,QAAQ,C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YAAY;IACvD,QAAQ,CAAC,OAAO,EAAE;SAAG,EAAE,IAAI,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;KAAE,CAAC;IACxE,QAAQ,CAAC,KAAK,EAAE;QACd,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;QAChC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;QACjC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;KAC1B,CAAC;IACF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,uFAAuF;AACvF,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,cAKC;CACF;AAED,qBAAa,eAAgB,SAAQ,KAAK;aAGtB,MAAM,EAAE,MAAM;IAFhC,YACE,OAAO,EAAE,MAAM,EACC,MAAM,EAAE,MAAM,EAI/B;CACF;AAED,MAAM,WAAW,sBAAsB;IACrC,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AA6ED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,KAAK,CAAC,SAAS,SAAS,YAAY,EACxE,KAAK,EAAE,QAAQ,EACf,SAAS,EAAE,SAAS,EACpB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAwD/B"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Jev (typesafe/jev) client, reached through OpenRouter's decisions API.
2
+ * Jev (typesafe/jev) client, backed by `@geminixiang/jev`.
3
3
  *
4
4
  * Jev is a "System One" evaluation model: it scores a shared `state`
5
5
  * against typed questions (a yes/no probability, a multiple choice, or a
@@ -14,16 +14,19 @@
14
14
  * classification, routing, guardrails), and interpret the returned
15
15
  * probabilities themselves.
16
16
  *
17
- * Requires `OPENROUTER_API_KEY` (see env-manifest.ts) — the same key
18
- * pi-ai's `openrouter` chat provider reads. `evaluateWithJev` calls
19
- * OpenRouter's `/api/alpha/decisions` REST endpoint directly; this is a
20
- * plain typed-decision API, not chat/completion, so it does not go
21
- * through pi-ai's provider machinery.
17
+ * `@geminixiang/jev` owns the wire protocol, provider catalog, and auth
18
+ * resolution for four backends (TypeSafe, OpenRouter, Vercel AI Gateway,
19
+ * Cloudflare Workers AI); this module picks OpenRouter (the same key
20
+ * pi-ai's `openrouter` chat provider reads) and adapts its typed
21
+ * request/answer shapes to the caller-facing contract mikan's call sites
22
+ * already depend on, so this file is the only one that needs to know a
23
+ * dependency swap happened.
22
24
  */
25
+ import { createBuiltinJevModels, JevAPIError, JevAuthError, JevConfigError, JevConnectionError, JevResponseError, JevTimeoutError, } from "@geminixiang/jev";
23
26
  import { readEnv } from "../env-manifest.js";
24
27
  /** The current public Jev model id on OpenRouter. */
25
28
  export const JEV_MODEL_ID = "~typesafe/jev-latest";
26
- const OPENROUTER_DECISIONS_URL = "https://openrouter.ai/api/alpha/decisions";
29
+ /** Thrown when no Jev backend has a usable credential. Callers fail closed on this. */
27
30
  export class JevNotConfiguredError extends Error {
28
31
  constructor() {
29
32
  super("Jev requires OPENROUTER_API_KEY (an OpenRouter API key). Set it in the environment before calling evaluateWithJev().");
@@ -37,34 +40,68 @@ export class JevRequestError extends Error {
37
40
  this.name = "JevRequestError";
38
41
  }
39
42
  }
40
- function toOpenRouterQuestion(question) {
43
+ // ── @geminixiang/jev wiring ──────────────────────────────────────────────
44
+ /**
45
+ * Routes env reads through `readEnv` so `MIKAN_OPENROUTER_API_KEY` resolves
46
+ * the same as every other mikan-aliased credential, instead of the
47
+ * package's default `process.env`-only context.
48
+ */
49
+ const mikanAuthContext = {
50
+ async env(name) {
51
+ return readEnv(name);
52
+ },
53
+ async fileExists() {
54
+ return false;
55
+ },
56
+ };
57
+ let cachedModels;
58
+ function models() {
59
+ cachedModels ??= createBuiltinJevModels({ authContext: mikanAuthContext });
60
+ return cachedModels;
61
+ }
62
+ function toGeminixiangQuestion(question) {
63
+ const instructions = question.instructions;
41
64
  if (question.type === "boolean") {
65
+ // `@geminixiang/jev` leaves noul criteria optional; mikan has always sent
66
+ // an explicit Yes/No default so the wire payload (and anything tuned
67
+ // against it, e.g. the auto-reply gate) does not change under this swap.
42
68
  return {
43
69
  type: "noul",
44
- instructions: question.instructions,
70
+ instructions,
45
71
  criteria: {
46
72
  true: question.criteria?.true ?? "Yes",
47
73
  false: question.criteria?.false ?? "No",
48
74
  },
49
75
  };
50
76
  }
51
- return question;
77
+ if (question.type === "choice") {
78
+ return {
79
+ type: "choice",
80
+ instructions,
81
+ criteria: question.criteria,
82
+ };
83
+ }
84
+ const [first, second, ...rest] = question.criteria;
85
+ if (first === undefined || second === undefined) {
86
+ throw new Error("score questions need at least two levels");
87
+ }
88
+ return { type: "score", instructions, criteria: [first, second, ...rest] };
52
89
  }
53
- function fromOpenRouterAnswer(answer) {
90
+ function fromGeminixiangAnswer(answer) {
54
91
  if (answer.type === "noul") {
55
- return { type: "boolean", probability: answer.noul ?? 0 };
92
+ return { type: "boolean", probability: answer.noul };
56
93
  }
57
94
  if (answer.type === "choice") {
58
95
  return {
59
96
  type: "choice",
60
- choice: answer.choice ?? "",
97
+ choice: answer.choice,
61
98
  probabilities: answer.probabilities,
62
99
  confidence: answer.confidence,
63
100
  };
64
101
  }
65
102
  return {
66
103
  type: "score",
67
- score: answer.score ?? 0,
104
+ score: answer.score,
68
105
  probabilities: answer.probabilities,
69
106
  legend: answer.legend,
70
107
  confidence: answer.confidence,
@@ -72,52 +109,59 @@ function fromOpenRouterAnswer(answer) {
72
109
  }
73
110
  /**
74
111
  * Evaluate one or more typed questions against a shared `state` using Jev,
75
- * reached through OpenRouter's decisions API. Every question is scored
76
- * independently against the same state in a single request; batching
77
- * questions here is cheap (they share the input) and is preferred over
78
- * separate calls per question.
112
+ * reached through OpenRouter's decisions API by way of `@geminixiang/jev`.
113
+ * Every question is scored independently against the same state in a
114
+ * single request; batching questions here is cheap (they share the input)
115
+ * and is preferred over separate calls per question.
79
116
  */
80
117
  export async function evaluateWithJev(state, questions, options = {}) {
81
- const apiKey = readEnv("OPENROUTER_API_KEY");
82
- if (!apiKey)
118
+ const catalogModel = models().getModel("openrouter", "jev-latest");
119
+ if (!catalogModel)
83
120
  throw new JevNotConfiguredError();
121
+ // `options.model` is the wire model id callers already pass (e.g. from
122
+ // JEV_MODEL_ID); override the catalog slug directly rather than adding a
123
+ // second catalog entry per possible override.
124
+ const model = options.model ? { ...catalogModel, slug: options.model } : catalogModel;
84
125
  const wireQuestions = {};
85
126
  for (const [id, question] of Object.entries(questions)) {
86
- wireQuestions[id] = toOpenRouterQuestion(question);
127
+ wireQuestions[id] = toGeminixiangQuestion(question);
87
128
  }
88
- const response = await fetch(OPENROUTER_DECISIONS_URL, {
89
- method: "POST",
90
- headers: {
91
- Authorization: `Bearer ${apiKey}`,
92
- "Content-Type": "application/json",
93
- ...options.headers,
94
- },
95
- body: JSON.stringify({
96
- model: options.model ?? JEV_MODEL_ID,
97
- state,
98
- questions: wireQuestions,
99
- }),
100
- signal: options.abortSignal,
101
- });
102
- const body = (await response.json());
103
- if (!response.ok || body.error) {
104
- throw new JevRequestError(body.error?.message ?? `Jev request failed with status ${response.status}`, body.error?.code ?? response.status);
129
+ let result;
130
+ try {
131
+ result = await models().evaluate(model, { state: state, questions: wireQuestions }, {
132
+ ...(options.headers ? { headers: options.headers } : {}),
133
+ ...(options.abortSignal ? { signal: options.abortSignal } : {}),
134
+ });
135
+ }
136
+ catch (error) {
137
+ if (error instanceof JevAuthError || error instanceof JevConfigError) {
138
+ throw new JevNotConfiguredError();
139
+ }
140
+ if (error instanceof JevAPIError) {
141
+ throw new JevRequestError(error.message, error.status);
142
+ }
143
+ if (error instanceof JevResponseError ||
144
+ error instanceof JevConnectionError ||
145
+ error instanceof JevTimeoutError) {
146
+ throw new JevRequestError(error.message, 502);
147
+ }
148
+ throw error;
105
149
  }
106
150
  const answers = {};
107
151
  for (const id of Object.keys(questions)) {
108
- const answer = body.answers[id];
152
+ const answer = result.answers[id];
109
153
  if (!answer)
110
154
  throw new JevRequestError(`Jev response missing answer for "${id}"`, 502);
111
- answers[id] = fromOpenRouterAnswer(answer);
155
+ answers[id] = fromGeminixiangAnswer(answer);
112
156
  }
113
157
  return {
114
158
  answers,
115
159
  usage: {
116
- inputTokens: body.usage?.input_tokens,
117
- outputTokens: body.usage?.output_tokens,
118
- cost: body.usage?.cost,
160
+ inputTokens: result.usage.input,
161
+ outputTokens: result.usage.output,
162
+ cost: result.usage.cost.total,
119
163
  },
120
- model: body.model,
164
+ model: result.model,
121
165
  };
122
166
  }
123
167
  //# sourceMappingURL=jev.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"jev.js","sourceRoot":"","sources":["../../src/harness/jev.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,qDAAqD;AACrD,MAAM,CAAC,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAEnD,MAAM,wBAAwB,GAAG,2CAA2C,CAAC;AAqD7E,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C;QACE,KAAK,CACH,sHAAsH,CACvH,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YACE,OAAe,EACC,MAAc;QAE9B,KAAK,CAAC,OAAO,CAAC,CAAC;sBAFC,MAAM;QAGtB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAqCD,SAAS,oBAAoB,CAAC,QAAqB;IACjD,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,YAAY,EAAE,QAAQ,CAAC,YAAY;YACnC,QAAQ,EAAE;gBACR,IA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,IAAI,CAAC,KAAK,EAAE,aAAa;YACvC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI;SACvB;QACD,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Jev (typesafe/jev) client, reached through OpenRouter's decisions API.\n *\n * Jev is a \"System One\" evaluation model: it scores a shared `state`\n * against typed questions (a yes/no probability, a multiple choice, or a\n * position on an ordered scale) and returns calibrated probabilities. It\n * does not generate text or tool calls, so it cannot be driven through\n * pi-ai's `Provider`/`Model`/`stream()` contract the way every model\n * `models.ts` catalogs is — that contract is chat/completion shaped\n * (system prompt + messages in, streamed text/tool-call events out), and\n * Jev's typed-decision shape does not fit it. Jev is therefore not a\n * selectable chat provider: callers import `evaluateWithJev` directly at\n * whatever call site wants a fast, cheap, type-safe decision (e.g.\n * classification, routing, guardrails), and interpret the returned\n * probabilities themselves.\n *\n * Requires `OPENROUTER_API_KEY` (see env-manifest.ts) — the same key\n * pi-ai's `openrouter` chat provider reads. `evaluateWithJev` calls\n * OpenRouter's `/api/alpha/decisions` REST endpoint directly; this is a\n * plain typed-decision API, not chat/completion, so it does not go\n * through pi-ai's provider machinery.\n */\nimport { readEnv } from \"../env-manifest.js\";\n\n/** The current public Jev model id on OpenRouter. */\nexport const JEV_MODEL_ID = \"~typesafe/jev-latest\";\n\nconst OPENROUTER_DECISIONS_URL = \"https://openrouter.ai/api/alpha/decisions\";\n\n/**\n * Any value Jev accepts as text-bearing structure: a string, a JSON object,\n * an array, or `null`. State, instructions, and criteria descriptions all\n * take this shape; Jev is trained to read the structure, so objects with\n * labelled keys are preferred over string templates.\n */\nexport type JevEntry = string | number | boolean | null | JevEntry[] | { [key: string]: JevEntry };\n\n/** A shared caller-facing question shape; translated to OpenRouter's wire format below. */\nexport type JevQuestion =\n | {\n type: \"boolean\";\n instructions: JevEntry;\n /** Optional descriptions of the yes / no outcomes. */\n criteria?: { true?: JevEntry; false?: JevEntry };\n }\n | { type: \"choice\"; instructions: JevEntry; criteria: Record<string, JevEntry> }\n | { type: \"score\"; instructions: JevEntry; criteria: readonly JevEntry[] };\n\nexport type JevQuestions = Record<string, JevQuestion>;\n\nexport type JevAnswer<QUESTION extends JevQuestion> = QUESTION extends { type: \"choice\" }\n ? {\n type: \"choice\";\n choice: string;\n probabilities?: Record<string, number>;\n /** 0-1 statistic over `probabilities`; low means no option clearly fits. */\n confidence?: number;\n }\n : QUESTION extends { type: \"score\" }\n ? {\n type: \"score\";\n /** Expected level index; fractional between levels. */\n score: number;\n probabilities?: Record<string, number>;\n /** Level index -> criterion text, as echoed by Jev. */\n legend?: Record<string, string>;\n confidence?: number;\n }\n : { type: \"boolean\"; probability: number };\n\nexport interface JevResult<QUESTIONS extends JevQuestions> {\n readonly answers: { [ID in keyof QUESTIONS]: JevAnswer<QUESTIONS[ID]> };\n readonly usage: {\n inputTokens: number | undefined;\n outputTokens: number | undefined;\n cost: number | undefined;\n };\n readonly model: string;\n}\n\nexport class JevNotConfiguredError extends Error {\n constructor() {\n super(\n \"Jev requires OPENROUTER_API_KEY (an OpenRouter API key). Set it in the environment before calling evaluateWithJev().\",\n );\n this.name = \"JevNotConfiguredError\";\n }\n}\n\nexport class JevRequestError extends Error {\n constructor(\n message: string,\n public readonly status: number,\n ) {\n super(message);\n this.name = \"JevRequestError\";\n }\n}\n\nexport interface EvaluateWithJevOptions {\n /** Evaluation model id; defaults to the current public Jev model. */\n model?: string;\n abortSignal?: AbortSignal;\n headers?: Record<string, string>;\n}\n\n// ── wire format (OpenRouter decisions API) ──────────────────────────────────\n\ntype OpenRouterQuestion =\n | {\n type: \"noul\";\n instructions: JevEntry;\n criteria: { true: JevEntry; false: JevEntry };\n }\n | { type: \"choice\"; instructions: JevEntry; criteria: Record<string, JevEntry> }\n | { type: \"score\"; instructions: JevEntry; criteria: readonly JevEntry[] };\n\ninterface OpenRouterAnswer {\n type: \"noul\" | \"choice\" | \"score\";\n noul?: number;\n choice?: string;\n score?: number;\n probabilities?: Record<string, number>;\n confidence?: number;\n legend?: Record<string, string>;\n}\n\ninterface OpenRouterDecisionsResponse {\n model: string;\n answers: Record<string, OpenRouterAnswer>;\n usage?: { input_tokens?: number; output_tokens?: number; cost?: number };\n error?: { message: string; code?: number };\n}\n\nfunction toOpenRouterQuestion(question: JevQuestion): OpenRouterQuestion {\n if (question.type === \"boolean\") {\n return {\n type: \"noul\",\n instructions: question.instructions,\n criteria: {\n true: question.criteria?.true ?? \"Yes\",\n false: question.criteria?.false ?? \"No\",\n },\n };\n }\n return question;\n}\n\nfunction fromOpenRouterAnswer(answer: OpenRouterAnswer): JevAnswer<JevQuestion> {\n if (answer.type === \"noul\") {\n return { type: \"boolean\", probability: answer.noul ?? 0 };\n }\n if (answer.type === \"choice\") {\n return {\n type: \"choice\",\n choice: answer.choice ?? \"\",\n probabilities: answer.probabilities,\n confidence: answer.confidence,\n };\n }\n return {\n type: \"score\",\n score: answer.score ?? 0,\n probabilities: answer.probabilities,\n legend: answer.legend,\n confidence: answer.confidence,\n };\n}\n\n/**\n * Evaluate one or more typed questions against a shared `state` using Jev,\n * reached through OpenRouter's decisions API. Every question is scored\n * independently against the same state in a single request; batching\n * questions here is cheap (they share the input) and is preferred over\n * separate calls per question.\n */\nexport async function evaluateWithJev<const QUESTIONS extends JevQuestions>(\n state: JevEntry,\n questions: QUESTIONS,\n options: EvaluateWithJevOptions = {},\n): Promise<JevResult<QUESTIONS>> {\n const apiKey = readEnv(\"OPENROUTER_API_KEY\");\n if (!apiKey) throw new JevNotConfiguredError();\n\n const wireQuestions: Record<string, OpenRouterQuestion> = {};\n for (const [id, question] of Object.entries(questions)) {\n wireQuestions[id] = toOpenRouterQuestion(question);\n }\n\n const response = await fetch(OPENROUTER_DECISIONS_URL, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${apiKey}`,\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n body: JSON.stringify({\n model: options.model ?? JEV_MODEL_ID,\n state,\n questions: wireQuestions,\n }),\n signal: options.abortSignal,\n });\n\n const body = (await response.json()) as OpenRouterDecisionsResponse;\n if (!response.ok || body.error) {\n throw new JevRequestError(\n body.error?.message ?? `Jev request failed with status ${response.status}`,\n body.error?.code ?? response.status,\n );\n }\n\n const answers = {} as { [ID in keyof QUESTIONS]: JevAnswer<QUESTIONS[ID]> };\n for (const id of Object.keys(questions)) {\n const answer = body.answers[id];\n if (!answer) throw new JevRequestError(`Jev response missing answer for \"${id}\"`, 502);\n (answers as Record<string, JevAnswer<JevQuestion>>)[id] = fromOpenRouterAnswer(answer);\n }\n\n return {\n answers,\n usage: {\n inputTokens: body.usage?.input_tokens,\n outputTokens: body.usage?.output_tokens,\n cost: body.usage?.cost,\n },\n model: body.model,\n };\n}\n"]}
1
+ {"version":3,"file":"jev.js","sourceRoot":"","sources":["../../src/harness/jev.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EACL,sBAAsB,EACtB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,GAIhB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,qDAAqD;AACrD,MAAM,CAAC,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAqDnD,uFAAuF;AACvF,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C;QACE,KAAK,CACH,sHAAsH,CACvH,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YACE,OAAe,EACC,MAAc;QAE9B,KAAK,CAAC,OAAO,CAAC,CAAC;sBAFC,MAAM;QAGtB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AASD,4EAA4E;AAE5E;;;;GAIG;AACH,MAAM,gBAAgB,GAAgB;IACpC,KAAK,CAAC,GA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oCAAoC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QACtF,OAAkD,CAAC,EAAE,CAAC,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC1F,CAAC;IAED,OAAO;QACL,OAAO;QACP,KAAK,EAAE;YACL,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK;YAC/B,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;YACjC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK;SAC9B;QACD,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Jev (typesafe/jev) client, backed by `@geminixiang/jev`.\n *\n * Jev is a \"System One\" evaluation model: it scores a shared `state`\n * against typed questions (a yes/no probability, a multiple choice, or a\n * position on an ordered scale) and returns calibrated probabilities. It\n * does not generate text or tool calls, so it cannot be driven through\n * pi-ai's `Provider`/`Model`/`stream()` contract the way every model\n * `models.ts` catalogs is — that contract is chat/completion shaped\n * (system prompt + messages in, streamed text/tool-call events out), and\n * Jev's typed-decision shape does not fit it. Jev is therefore not a\n * selectable chat provider: callers import `evaluateWithJev` directly at\n * whatever call site wants a fast, cheap, type-safe decision (e.g.\n * classification, routing, guardrails), and interpret the returned\n * probabilities themselves.\n *\n * `@geminixiang/jev` owns the wire protocol, provider catalog, and auth\n * resolution for four backends (TypeSafe, OpenRouter, Vercel AI Gateway,\n * Cloudflare Workers AI); this module picks OpenRouter (the same key\n * pi-ai's `openrouter` chat provider reads) and adapts its typed\n * request/answer shapes to the caller-facing contract mikan's call sites\n * already depend on, so this file is the only one that needs to know a\n * dependency swap happened.\n */\nimport {\n createBuiltinJevModels,\n JevAPIError,\n JevAuthError,\n JevConfigError,\n JevConnectionError,\n JevResponseError,\n JevTimeoutError,\n type AnswerFor as GeminixiangAnswerFor,\n type Entry as GeminixiangEntry,\n type Question as GeminixiangQuestion,\n} from \"@geminixiang/jev\";\nimport type { AuthContext } from \"@earendil-works/pi-ai\";\nimport { readEnv } from \"../env-manifest.js\";\n\n/** The current public Jev model id on OpenRouter. */\nexport const JEV_MODEL_ID = \"~typesafe/jev-latest\";\n\n/**\n * Any value Jev accepts as text-bearing structure: a string, a JSON object,\n * an array, or `null`. State, instructions, and criteria descriptions all\n * take this shape; Jev is trained to read the structure, so objects with\n * labelled keys are preferred over string templates.\n */\nexport type JevEntry = string | number | boolean | null | JevEntry[] | { [key: string]: JevEntry };\n\n/** A shared caller-facing question shape; translated to `@geminixiang/jev`'s shape below. */\nexport type JevQuestion =\n | {\n type: \"boolean\";\n instructions: JevEntry;\n /** Optional descriptions of the yes / no outcomes. */\n criteria?: { true?: JevEntry; false?: JevEntry };\n }\n | { type: \"choice\"; instructions: JevEntry; criteria: Record<string, JevEntry> }\n | { type: \"score\"; instructions: JevEntry; criteria: readonly JevEntry[] };\n\nexport type JevQuestions = Record<string, JevQuestion>;\n\nexport type JevAnswer<QUESTION extends JevQuestion> = QUESTION extends { type: \"choice\" }\n ? {\n type: \"choice\";\n choice: string;\n probabilities?: Record<string, number>;\n /** 0-1 statistic over `probabilities`; low means no option clearly fits. */\n confidence?: number;\n }\n : QUESTION extends { type: \"score\" }\n ? {\n type: \"score\";\n /** Expected level index; fractional between levels. */\n score: number;\n probabilities?: Record<string, number>;\n /** Level index -> criterion text, as echoed by Jev. */\n legend?: Record<string, string>;\n confidence?: number;\n }\n : { type: \"boolean\"; probability: number };\n\nexport interface JevResult<QUESTIONS extends JevQuestions> {\n readonly answers: { [ID in keyof QUESTIONS]: JevAnswer<QUESTIONS[ID]> };\n readonly usage: {\n inputTokens: number | undefined;\n outputTokens: number | undefined;\n cost: number | undefined;\n };\n readonly model: string;\n}\n\n/** Thrown when no Jev backend has a usable credential. Callers fail closed on this. */\nexport class JevNotConfiguredError extends Error {\n constructor() {\n super(\n \"Jev requires OPENROUTER_API_KEY (an OpenRouter API key). Set it in the environment before calling evaluateWithJev().\",\n );\n this.name = \"JevNotConfiguredError\";\n }\n}\n\nexport class JevRequestError extends Error {\n constructor(\n message: string,\n public readonly status: number,\n ) {\n super(message);\n this.name = \"JevRequestError\";\n }\n}\n\nexport interface EvaluateWithJevOptions {\n /** Evaluation model id; defaults to the current public Jev model. */\n model?: string;\n abortSignal?: AbortSignal;\n headers?: Record<string, string>;\n}\n\n// ── @geminixiang/jev wiring ──────────────────────────────────────────────\n\n/**\n * Routes env reads through `readEnv` so `MIKAN_OPENROUTER_API_KEY` resolves\n * the same as every other mikan-aliased credential, instead of the\n * package's default `process.env`-only context.\n */\nconst mikanAuthContext: AuthContext = {\n async env(name) {\n return readEnv(name);\n },\n async fileExists() {\n return false;\n },\n};\n\nlet cachedModels: ReturnType<typeof createBuiltinJevModels> | undefined;\n\nfunction models() {\n cachedModels ??= createBuiltinJevModels({ authContext: mikanAuthContext });\n return cachedModels;\n}\n\nfunction toGeminixiangQuestion(question: JevQuestion): GeminixiangQuestion {\n const instructions = question.instructions as GeminixiangEntry;\n if (question.type === \"boolean\") {\n // `@geminixiang/jev` leaves noul criteria optional; mikan has always sent\n // an explicit Yes/No default so the wire payload (and anything tuned\n // against it, e.g. the auto-reply gate) does not change under this swap.\n return {\n type: \"noul\",\n instructions,\n criteria: {\n true: (question.criteria?.true as GeminixiangEntry) ?? \"Yes\",\n false: (question.criteria?.false as GeminixiangEntry) ?? \"No\",\n },\n };\n }\n if (question.type === \"choice\") {\n return {\n type: \"choice\",\n instructions,\n criteria: question.criteria as Record<string, GeminixiangEntry>,\n };\n }\n const [first, second, ...rest] = question.criteria as GeminixiangEntry[];\n if (first === undefined || second === undefined) {\n throw new Error(\"score questions need at least two levels\");\n }\n return { type: \"score\", instructions, criteria: [first, second, ...rest] };\n}\n\nfunction fromGeminixiangAnswer(\n answer: GeminixiangAnswerFor<GeminixiangQuestion>,\n): JevAnswer<JevQuestion> {\n if (answer.type === \"noul\") {\n return { type: \"boolean\", probability: answer.noul };\n }\n if (answer.type === \"choice\") {\n return {\n type: \"choice\",\n choice: answer.choice,\n probabilities: answer.probabilities as Record<string, number>,\n confidence: answer.confidence,\n };\n }\n return {\n type: \"score\",\n score: answer.score,\n probabilities: answer.probabilities,\n legend: answer.legend as Record<string, string> | undefined,\n confidence: answer.confidence,\n };\n}\n\n/**\n * Evaluate one or more typed questions against a shared `state` using Jev,\n * reached through OpenRouter's decisions API by way of `@geminixiang/jev`.\n * Every question is scored independently against the same state in a\n * single request; batching questions here is cheap (they share the input)\n * and is preferred over separate calls per question.\n */\nexport async function evaluateWithJev<const QUESTIONS extends JevQuestions>(\n state: JevEntry,\n questions: QUESTIONS,\n options: EvaluateWithJevOptions = {},\n): Promise<JevResult<QUESTIONS>> {\n const catalogModel = models().getModel(\"openrouter\", \"jev-latest\");\n if (!catalogModel) throw new JevNotConfiguredError();\n // `options.model` is the wire model id callers already pass (e.g. from\n // JEV_MODEL_ID); override the catalog slug directly rather than adding a\n // second catalog entry per possible override.\n const model = options.model ? { ...catalogModel, slug: options.model } : catalogModel;\n\n const wireQuestions: Record<string, GeminixiangQuestion> = {};\n for (const [id, question] of Object.entries(questions)) {\n wireQuestions[id] = toGeminixiangQuestion(question);\n }\n\n let result;\n try {\n result = await models().evaluate(\n model,\n { state: state as GeminixiangEntry, questions: wireQuestions },\n {\n ...(options.headers ? { headers: options.headers } : {}),\n ...(options.abortSignal ? { signal: options.abortSignal } : {}),\n },\n );\n } catch (error) {\n if (error instanceof JevAuthError || error instanceof JevConfigError) {\n throw new JevNotConfiguredError();\n }\n if (error instanceof JevAPIError) {\n throw new JevRequestError(error.message, error.status);\n }\n if (\n error instanceof JevResponseError ||\n error instanceof JevConnectionError ||\n error instanceof JevTimeoutError\n ) {\n throw new JevRequestError(error.message, 502);\n }\n throw error;\n }\n\n const answers = {} as { [ID in keyof QUESTIONS]: JevAnswer<QUESTIONS[ID]> };\n for (const id of Object.keys(questions)) {\n const answer = result.answers[id];\n if (!answer) throw new JevRequestError(`Jev response missing answer for \"${id}\"`, 502);\n (answers as Record<string, JevAnswer<JevQuestion>>)[id] = fromGeminixiangAnswer(answer);\n }\n\n return {\n answers,\n usage: {\n inputTokens: result.usage.input,\n outputTokens: result.usage.output,\n cost: result.usage.cost.total,\n },\n model: result.model,\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geminixiang/mikan",
3
- "version": "1.0.0-beta.68",
3
+ "version": "1.0.0-beta.69",
4
4
  "description": "Self-hosted AI coding agent for organizations: every Slack channel and DM gets its own sandboxed workspace, credentials, and memory.",
5
5
  "keywords": [
6
6
  "agent",
@@ -68,6 +68,7 @@
68
68
  "@clack/prompts": "^1.8.1",
69
69
  "@earendil-works/pi-agent-core": "^0.85.1",
70
70
  "@earendil-works/pi-ai": "^0.85.1",
71
+ "@geminixiang/jev": "^0.3.1",
71
72
  "@modelcontextprotocol/sdk": "^1.30.0",
72
73
  "@opentelemetry/api": "^1.9.1",
73
74
  "@opentelemetry/exporter-metrics-otlp-proto": "^0.221.0",