@glassly/engine 0.4.0-dev.1017 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  export const ENGINE_RELEASE_METADATA = Object.freeze({
2
2
  "schemaVersion": 1,
3
3
  "familyBaseVersion": "0.4.0",
4
- "releaseIdentity": "0.4.0-dev.1017",
5
- "releaseSetId": "glassly-0.4.0-dev.1017",
6
- "sourceCommit": "2d95873e90b2de55f29df33e0e361469fc2b58f8",
4
+ "releaseIdentity": "0.4.0",
5
+ "releaseSetId": "glassly-0.4.0",
6
+ "sourceCommit": "b0de6d1f62b32238f0b7e916113ecc5164c4bd28",
7
7
  "otaManifestUrl": null,
8
8
  "otaManifestSha256": null
9
9
  });
@@ -1 +1 @@
1
- {"version":3,"file":"releaseMetadata.js","sourceRoot":"","sources":["../../src/generated/releaseMetadata.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,uBAAuB,GAAoC,MAAM,CAAC,MAAM,CAAC;IACpF,eAAe,EAAE,CAAC;IAClB,mBAAmB,EAAE,OAAO;IAC5B,iBAAiB,EAAE,gBAAgB;IACnC,cAAc,EAAE,wBAAwB;IACxC,cAAc,EAAE,0CAA0C;IAC1D,gBAAgB,EAAE,IAAI;IACtB,mBAAmB,EAAE,IAAI;CAC1B,CAAC,CAAA","sourcesContent":["/** Generated by release CI. Do not edit in a release checkout. */\nexport interface EngineReleaseMetadata {\n schemaVersion: 1\n familyBaseVersion: string | null\n releaseIdentity: string | null\n releaseSetId: string | null\n sourceCommit: string | null\n otaManifestUrl: string | null\n otaManifestSha256: string | null\n}\n\nexport const ENGINE_RELEASE_METADATA: Readonly<EngineReleaseMetadata> = Object.freeze({\n \"schemaVersion\": 1,\n \"familyBaseVersion\": \"0.4.0\",\n \"releaseIdentity\": \"0.4.0-dev.1017\",\n \"releaseSetId\": \"glassly-0.4.0-dev.1017\",\n \"sourceCommit\": \"2d95873e90b2de55f29df33e0e361469fc2b58f8\",\n \"otaManifestUrl\": null,\n \"otaManifestSha256\": null\n})\n"]}
1
+ {"version":3,"file":"releaseMetadata.js","sourceRoot":"","sources":["../../src/generated/releaseMetadata.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,uBAAuB,GAAoC,MAAM,CAAC,MAAM,CAAC;IACpF,eAAe,EAAE,CAAC;IAClB,mBAAmB,EAAE,OAAO;IAC5B,iBAAiB,EAAE,OAAO;IAC1B,cAAc,EAAE,eAAe;IAC/B,cAAc,EAAE,0CAA0C;IAC1D,gBAAgB,EAAE,IAAI;IACtB,mBAAmB,EAAE,IAAI;CAC1B,CAAC,CAAA","sourcesContent":["/** Generated by release CI. Do not edit in a release checkout. */\nexport interface EngineReleaseMetadata {\n schemaVersion: 1\n familyBaseVersion: string | null\n releaseIdentity: string | null\n releaseSetId: string | null\n sourceCommit: string | null\n otaManifestUrl: string | null\n otaManifestSha256: string | null\n}\n\nexport const ENGINE_RELEASE_METADATA: Readonly<EngineReleaseMetadata> = Object.freeze({\n \"schemaVersion\": 1,\n \"familyBaseVersion\": \"0.4.0\",\n \"releaseIdentity\": \"0.4.0\",\n \"releaseSetId\": \"glassly-0.4.0\",\n \"sourceCommit\": \"b0de6d1f62b32238f0b7e916113ecc5164c4bd28\",\n \"otaManifestUrl\": null,\n \"otaManifestSha256\": null\n})\n"]}
@@ -12,7 +12,7 @@ export interface LlmRouteInputs {
12
12
  /**
13
13
  * Whether the primary path is currently believed usable: a saved user key
14
14
  * for the resolved provider, or cloud connected + not disabled in Privacy
15
- * + monthly AI credit not exhausted.
15
+ * + AI credits not exhausted.
16
16
  */
17
17
  primaryUp: boolean;
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"LlmRouting.js","sourceRoot":"","sources":["../../src/services/LlmRouting.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAuBH,MAAM,UAAU,cAAc,CAAC,EAAC,UAAU,EAAE,aAAa,EAAE,SAAS,EAAiB;IACnF,IAAI,UAAU;QAAE,OAAO,OAAO,CAAA;IAC9B,IAAI,CAAC,aAAa;QAAE,OAAO,SAAS,CAAA;IACpC,OAAO,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,OAAO,CAAA;AACnD,CAAC;AAKD,MAAM,UAAU,cAAc,CAAC,MAK9B;IACC,IAAI,MAAM,CAAC,UAAU;QAAE,OAAO,aAAa,CAAA;IAC3C,IAAI,MAAM,CAAC,aAAa;QAAE,OAAO,gBAAgB,CAAA;IACjD,IAAI,MAAM,CAAC,YAAY;QAAE,OAAO,WAAW,CAAA;IAC3C,IAAI,CAAC,MAAM,CAAC,cAAc;QAAE,OAAO,oBAAoB,CAAA;IACvD,OAAO,gBAAgB,CAAA;AACzB,CAAC","sourcesContent":["/**\n * LlmRouting — pure decision logic for where one session.ai.complete call\n * runs: the PRIMARY path (vendor-direct on a user key, or the cloud relay) or\n * the on-device model. Same shape as TranscriptionRouting.ts so the rules are\n * unit-testable; LocalMiniappRuntime supplies the inputs and does the work.\n */\n\nexport interface LlmRouteInputs {\n /** Request asked for on-device only (`forceLocal: true`). */\n forceLocal: boolean\n /** Request accepts on-device when the primary is down (`localFallback: true`). */\n localFallback: boolean\n /**\n * Whether the primary path is currently believed usable: a saved user key\n * for the resolved provider, or cloud connected + not disabled in Privacy\n * + monthly AI credit not exhausted.\n */\n primaryUp: boolean\n}\n\n/**\n * - \"local\": run on-device, never touch the primary.\n * - \"primary\": primary only; failures surface as today.\n * - \"primary_then_local\": try the primary, and on any failure serve the same\n * request on-device.\n */\nexport type LlmRoute = \"local\" | \"primary\" | \"primary_then_local\"\n\nexport function decideLlmRoute({forceLocal, localFallback, primaryUp}: LlmRouteInputs): LlmRoute {\n if (forceLocal) return \"local\"\n if (!localFallback) return \"primary\"\n return primaryUp ? \"primary_then_local\" : \"local\"\n}\n\n/** Why a request landed on-device; reported in logs and the result's `model` line. */\nexport type LocalLlmReason = \"force_local\" | \"cloud_disconnected\" | \"cloud_disabled\" | \"llm_quota\" | \"primary_failed\"\n\nexport function localLlmReason(inputs: {\n forceLocal: boolean\n cloudDisabled: boolean\n cloudConnected: boolean\n quotaBlocked: boolean\n}): LocalLlmReason {\n if (inputs.forceLocal) return \"force_local\"\n if (inputs.cloudDisabled) return \"cloud_disabled\"\n if (inputs.quotaBlocked) return \"llm_quota\"\n if (!inputs.cloudConnected) return \"cloud_disconnected\"\n return \"primary_failed\"\n}\n"]}
1
+ {"version":3,"file":"LlmRouting.js","sourceRoot":"","sources":["../../src/services/LlmRouting.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAuBH,MAAM,UAAU,cAAc,CAAC,EAAC,UAAU,EAAE,aAAa,EAAE,SAAS,EAAiB;IACnF,IAAI,UAAU;QAAE,OAAO,OAAO,CAAA;IAC9B,IAAI,CAAC,aAAa;QAAE,OAAO,SAAS,CAAA;IACpC,OAAO,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,OAAO,CAAA;AACnD,CAAC;AAKD,MAAM,UAAU,cAAc,CAAC,MAK9B;IACC,IAAI,MAAM,CAAC,UAAU;QAAE,OAAO,aAAa,CAAA;IAC3C,IAAI,MAAM,CAAC,aAAa;QAAE,OAAO,gBAAgB,CAAA;IACjD,IAAI,MAAM,CAAC,YAAY;QAAE,OAAO,WAAW,CAAA;IAC3C,IAAI,CAAC,MAAM,CAAC,cAAc;QAAE,OAAO,oBAAoB,CAAA;IACvD,OAAO,gBAAgB,CAAA;AACzB,CAAC","sourcesContent":["/**\n * LlmRouting — pure decision logic for where one session.ai.complete call\n * runs: the PRIMARY path (vendor-direct on a user key, or the cloud relay) or\n * the on-device model. Same shape as TranscriptionRouting.ts so the rules are\n * unit-testable; LocalMiniappRuntime supplies the inputs and does the work.\n */\n\nexport interface LlmRouteInputs {\n /** Request asked for on-device only (`forceLocal: true`). */\n forceLocal: boolean\n /** Request accepts on-device when the primary is down (`localFallback: true`). */\n localFallback: boolean\n /**\n * Whether the primary path is currently believed usable: a saved user key\n * for the resolved provider, or cloud connected + not disabled in Privacy\n * + AI credits not exhausted.\n */\n primaryUp: boolean\n}\n\n/**\n * - \"local\": run on-device, never touch the primary.\n * - \"primary\": primary only; failures surface as today.\n * - \"primary_then_local\": try the primary, and on any failure serve the same\n * request on-device.\n */\nexport type LlmRoute = \"local\" | \"primary\" | \"primary_then_local\"\n\nexport function decideLlmRoute({forceLocal, localFallback, primaryUp}: LlmRouteInputs): LlmRoute {\n if (forceLocal) return \"local\"\n if (!localFallback) return \"primary\"\n return primaryUp ? \"primary_then_local\" : \"local\"\n}\n\n/** Why a request landed on-device; reported in logs and the result's `model` line. */\nexport type LocalLlmReason = \"force_local\" | \"cloud_disconnected\" | \"cloud_disabled\" | \"llm_quota\" | \"primary_failed\"\n\nexport function localLlmReason(inputs: {\n forceLocal: boolean\n cloudDisabled: boolean\n cloudConnected: boolean\n quotaBlocked: boolean\n}): LocalLlmReason {\n if (inputs.forceLocal) return \"force_local\"\n if (inputs.cloudDisabled) return \"cloud_disabled\"\n if (inputs.quotaBlocked) return \"llm_quota\"\n if (!inputs.cloudConnected) return \"cloud_disconnected\"\n return \"primary_failed\"\n}\n"]}
@@ -291,7 +291,7 @@ function directLlmProvider(name) {
291
291
  directLlmProviders.set(name, built);
292
292
  return built;
293
293
  }
294
- const QUOTA_EXCEEDED_MESSAGE = "Monthly AI credit is used up. Upgrade in Settings > Membership, or add your own API key in Settings > API Keys.";
294
+ const QUOTA_EXCEEDED_MESSAGE = "AI credits are used up. Get more in Settings > Membership, or add your own API key in Settings > API Keys.";
295
295
  /** The user's saved key (Settings > API Keys) for an LLM provider, "" if none. */
296
296
  function userLlmKey(provider) {
297
297
  const raw = useSettingsStore.getState().getSetting(MINIAPP_READABLE_API_KEYS[provider]);
@@ -3740,8 +3740,8 @@ class LocalMiniappRuntime {
3740
3740
  this.sendResult(packageName, requestId, true, result);
3741
3741
  }
3742
3742
  catch (err) {
3743
- // 402 quota_exceeded from the runtime: the account's monthly AI credit
3744
- // is spent. Distinct code (miniapps may fall back to a local path) and
3743
+ // 402 quota_exceeded from the runtime: the account's AI credits are
3744
+ // spent. Distinct code (miniapps may fall back to a local path) and
3745
3745
  // a host hook so the app can offer the upgrade paywall — the miniapp
3746
3746
  // itself must never own that conversation.
3747
3747
  const quotaExceeded = err instanceof HttpError && (err.code === "quota_exceeded" || err.status === 402);
@@ -3874,7 +3874,7 @@ class LocalMiniappRuntime {
3874
3874
  this.onQuotaExceeded?.("llm");
3875
3875
  this.sendResult(packageName, requestId, false, undefined, {
3876
3876
  code: MiniappErrorCode.QUOTA_EXCEEDED,
3877
- message: "Monthly AI credit is used up. Upgrade in Settings > Membership, or add your own API key in Settings > API Keys.",
3877
+ message: "AI credits are used up. Get more in Settings > Membership, or add your own API key in Settings > API Keys.",
3878
3878
  });
3879
3879
  return;
3880
3880
  }