pyric 0.1.0-alpha.32 → 0.1.0-alpha.34
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/dist/ai/app-check-gate.d.ts +24 -11
- package/dist/ai/app-check-gate.d.ts.map +1 -1
- package/dist/ai/app-check-gate.js +19 -8
- package/dist/ai/app-check-gate.js.map +1 -1
- package/dist/ai/broker/broker.d.ts +2 -2
- package/dist/ai/broker/broker.js +2 -2
- package/dist/ai/broker/gemini-engine.d.ts +7 -0
- package/dist/ai/broker/gemini-engine.d.ts.map +1 -1
- package/dist/ai/broker/gemini-engine.js +19 -1
- package/dist/ai/broker/gemini-engine.js.map +1 -1
- package/dist/ai/broker/gemini-upstream.d.ts.map +1 -1
- package/dist/ai/broker/gemini-upstream.js +11 -9
- package/dist/ai/broker/gemini-upstream.js.map +1 -1
- package/dist/ai/broker/upstream-error-redaction.d.ts.map +1 -1
- package/dist/ai/broker/upstream-error-redaction.js +10 -7
- package/dist/ai/broker/upstream-error-redaction.js.map +1 -1
- package/dist/ai/generation-enums.d.ts +0 -21
- package/dist/ai/generation-enums.d.ts.map +1 -1
- package/dist/ai/generation-enums.js +0 -18
- package/dist/ai/generation-enums.js.map +1 -1
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +1 -1
- package/dist/ai/index.js.map +1 -1
- package/dist/app/diagnostics.d.ts +1 -1
- package/dist/app/diagnostics.js +1 -1
- package/dist/app/registry.d.ts.map +1 -1
- package/dist/app/registry.js +13 -6
- package/dist/app/registry.js.map +1 -1
- package/dist/app-check/index.d.ts.map +1 -1
- package/dist/app-check/index.js +5 -2
- package/dist/app-check/index.js.map +1 -1
- package/dist/app-check/state.d.ts.map +1 -1
- package/dist/app-check/state.js +5 -3
- package/dist/app-check/state.js.map +1 -1
- package/dist/auth/instances.d.ts.map +1 -1
- package/dist/auth/instances.js +41 -7
- package/dist/auth/instances.js.map +1 -1
- package/dist/auth/internal.d.ts +3 -1
- package/dist/auth/internal.d.ts.map +1 -1
- package/dist/auth/internal.js +3 -1
- package/dist/auth/internal.js.map +1 -1
- package/dist/auth/reauth.js +6 -2
- package/dist/auth/reauth.js.map +1 -1
- package/dist/auth/sandbox/driver.d.ts +10 -1
- package/dist/auth/sandbox/driver.d.ts.map +1 -1
- package/dist/auth/sandbox/driver.js +12 -2
- package/dist/auth/sandbox/driver.js.map +1 -1
- package/dist/auth/sandbox/persistence.d.ts +2 -1
- package/dist/auth/sandbox/persistence.d.ts.map +1 -1
- package/dist/auth/sandbox/persistence.js +30 -5
- package/dist/auth/sandbox/persistence.js.map +1 -1
- package/dist/auth/sandbox/project-store.d.ts +76 -0
- package/dist/auth/sandbox/project-store.d.ts.map +1 -1
- package/dist/auth/sandbox/project-store.js +106 -0
- package/dist/auth/sandbox/project-store.js.map +1 -1
- package/dist/auth/sandbox/session-ledger.d.ts +57 -0
- package/dist/auth/sandbox/session-ledger.d.ts.map +1 -0
- package/dist/auth/sandbox/session-ledger.js +80 -0
- package/dist/auth/sandbox/session-ledger.js.map +1 -0
- package/dist/auth/sandbox-backend-types.d.ts +13 -0
- package/dist/auth/sandbox-backend-types.d.ts.map +1 -1
- package/dist/auth/sandbox-backend.d.ts +43 -9
- package/dist/auth/sandbox-backend.d.ts.map +1 -1
- package/dist/auth/sandbox-backend.js +209 -32
- package/dist/auth/sandbox-backend.js.map +1 -1
- package/dist/auth/sandbox-token.d.ts +10 -13
- package/dist/auth/sandbox-token.d.ts.map +1 -1
- package/dist/auth/sandbox-token.js +14 -12
- package/dist/auth/sandbox-token.js.map +1 -1
- package/dist/auth/tokens.d.ts +24 -14
- package/dist/auth/tokens.d.ts.map +1 -1
- package/dist/auth/tokens.js +48 -58
- package/dist/auth/tokens.js.map +1 -1
- package/dist/auth/types.d.ts +8 -7
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js.map +1 -1
- package/dist/firestore/lite.d.ts +2 -2
- package/dist/firestore/lite.d.ts.map +1 -1
- package/dist/firestore/lite.js +2 -2
- package/dist/firestore/lite.js.map +1 -1
- package/dist/firestore/sandbox/wire-encoder.d.ts.map +1 -1
- package/dist/firestore/sandbox/wire-encoder.js +7 -4
- package/dist/firestore/sandbox/wire-encoder.js.map +1 -1
- package/dist/rules/grammar/compile-limits.d.ts +1 -1
- package/dist/rules/grammar/compile-limits.d.ts.map +1 -1
- package/dist/rules/grammar/compile-limits.js +31 -0
- package/dist/rules/grammar/compile-limits.js.map +1 -1
- package/dist/rules/internal/index.d.ts +1 -0
- package/dist/rules/internal/index.d.ts.map +1 -1
- package/dist/rules/internal/index.js +2 -0
- package/dist/rules/internal/index.js.map +1 -1
- package/dist/rules/simulator/conversions.d.ts.map +1 -1
- package/dist/rules/simulator/conversions.js +18 -27
- package/dist/rules/simulator/conversions.js.map +1 -1
- package/dist/rules/simulator/evaluation-builtins.d.ts.map +1 -1
- package/dist/rules/simulator/evaluation-builtins.js +19 -13
- package/dist/rules/simulator/evaluation-builtins.js.map +1 -1
- package/dist/rules/simulator/evaluator.d.ts.map +1 -1
- package/dist/rules/simulator/evaluator.js +65 -35
- package/dist/rules/simulator/evaluator.js.map +1 -1
- package/dist/rules/simulator/firestore-values.d.ts +7 -2
- package/dist/rules/simulator/firestore-values.d.ts.map +1 -1
- package/dist/rules/simulator/firestore-values.js +12 -6
- package/dist/rules/simulator/firestore-values.js.map +1 -1
- package/dist/rules/simulator/handler.d.ts.map +1 -1
- package/dist/rules/simulator/handler.js +2 -1
- package/dist/rules/simulator/handler.js.map +1 -1
- package/dist/rules/simulator/hashing-builtins.d.ts +2 -0
- package/dist/rules/simulator/hashing-builtins.d.ts.map +1 -1
- package/dist/rules/simulator/hashing-builtins.js +2 -1
- package/dist/rules/simulator/hashing-builtins.js.map +1 -1
- package/dist/rules/simulator/host-value.d.ts +14 -0
- package/dist/rules/simulator/host-value.d.ts.map +1 -0
- package/dist/rules/simulator/host-value.js +60 -0
- package/dist/rules/simulator/host-value.js.map +1 -0
- package/dist/rules/simulator/index-access.d.ts +1 -1
- package/dist/rules/simulator/index-access.d.ts.map +1 -1
- package/dist/rules/simulator/index-access.js +22 -16
- package/dist/rules/simulator/index-access.js.map +1 -1
- package/dist/rules/simulator/mapdiff.d.ts +2 -0
- package/dist/rules/simulator/mapdiff.d.ts.map +1 -1
- package/dist/rules/simulator/mapdiff.js +6 -0
- package/dist/rules/simulator/mapdiff.js.map +1 -1
- package/dist/rules/simulator/math-builtins.d.ts.map +1 -1
- package/dist/rules/simulator/math-builtins.js +19 -27
- package/dist/rules/simulator/math-builtins.js.map +1 -1
- package/dist/rules/simulator/rules-int.d.ts +122 -0
- package/dist/rules/simulator/rules-int.d.ts.map +1 -0
- package/dist/rules/simulator/rules-int.js +241 -0
- package/dist/rules/simulator/rules-int.js.map +1 -0
- package/dist/rules/simulator/rules-type.d.ts.map +1 -1
- package/dist/rules/simulator/rules-type.js +4 -1
- package/dist/rules/simulator/rules-type.js.map +1 -1
- package/dist/rules/simulator/slice-bounds.d.ts +5 -2
- package/dist/rules/simulator/slice-bounds.d.ts.map +1 -1
- package/dist/rules/simulator/slice-bounds.js +6 -3
- package/dist/rules/simulator/slice-bounds.js.map +1 -1
- package/dist/rules/simulator/trace-recorder.d.ts +2 -0
- package/dist/rules/simulator/trace-recorder.d.ts.map +1 -1
- package/dist/rules/simulator/trace-recorder.js +5 -1
- package/dist/rules/simulator/trace-recorder.js.map +1 -1
- package/dist/rules/simulator/value-equality.d.ts +2 -1
- package/dist/rules/simulator/value-equality.d.ts.map +1 -1
- package/dist/rules/simulator/value-equality.js +18 -11
- package/dist/rules/simulator/value-equality.js.map +1 -1
- package/dist/rules/simulator/wrappers/duration.d.ts +18 -7
- package/dist/rules/simulator/wrappers/duration.d.ts.map +1 -1
- package/dist/rules/simulator/wrappers/duration.js +45 -25
- package/dist/rules/simulator/wrappers/duration.js.map +1 -1
- package/dist/rules/simulator/wrappers/float.d.ts +7 -9
- package/dist/rules/simulator/wrappers/float.d.ts.map +1 -1
- package/dist/rules/simulator/wrappers/float.js +24 -17
- package/dist/rules/simulator/wrappers/float.js.map +1 -1
- package/dist/sandbox/branches/promotion.d.ts.map +1 -1
- package/dist/sandbox/branches/promotion.js +38 -1
- package/dist/sandbox/branches/promotion.js.map +1 -1
- package/dist/sandbox/branches/state-diff.d.ts +9 -0
- package/dist/sandbox/branches/state-diff.d.ts.map +1 -1
- package/dist/sandbox/branches/state-diff.js +29 -0
- package/dist/sandbox/branches/state-diff.js.map +1 -1
- package/dist/sandbox/checkpoints/validation.d.ts.map +1 -1
- package/dist/sandbox/checkpoints/validation.js +9 -1
- package/dist/sandbox/checkpoints/validation.js.map +1 -1
- package/dist/sandbox/full-state.d.ts +11 -0
- package/dist/sandbox/full-state.d.ts.map +1 -1
- package/dist/sandbox/full-state.js +22 -5
- package/dist/sandbox/full-state.js.map +1 -1
- package/dist/sandbox/index.d.ts +1 -1
- package/dist/sandbox/index.d.ts.map +1 -1
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/internal/app-check-token.d.ts +24 -18
- package/dist/sandbox/internal/app-check-token.d.ts.map +1 -1
- package/dist/sandbox/internal/app-check-token.js +12 -79
- package/dist/sandbox/internal/app-check-token.js.map +1 -1
- package/dist/sandbox/internal/auth-accounts.d.ts +72 -0
- package/dist/sandbox/internal/auth-accounts.d.ts.map +1 -0
- package/dist/sandbox/internal/auth-accounts.js +50 -0
- package/dist/sandbox/internal/auth-accounts.js.map +1 -0
- package/dist/sandbox/internal/auth-token-claims.d.ts +4 -2
- package/dist/sandbox/internal/auth-token-claims.d.ts.map +1 -1
- package/dist/sandbox/internal/auth-token-claims.js +6 -4
- package/dist/sandbox/internal/auth-token-claims.js.map +1 -1
- package/dist/sandbox/internal/base64url.d.ts +16 -0
- package/dist/sandbox/internal/base64url.d.ts.map +1 -0
- package/dist/sandbox/internal/base64url.js +55 -0
- package/dist/sandbox/internal/base64url.js.map +1 -0
- package/dist/sandbox/internal/caller-source.d.ts +24 -0
- package/dist/sandbox/internal/caller-source.d.ts.map +1 -0
- package/dist/sandbox/internal/caller-source.js +30 -0
- package/dist/sandbox/internal/caller-source.js.map +1 -0
- package/dist/sandbox/internal/custom-token.d.ts +45 -0
- package/dist/sandbox/internal/custom-token.d.ts.map +1 -0
- package/dist/sandbox/internal/custom-token.js +95 -0
- package/dist/sandbox/internal/custom-token.js.map +1 -0
- package/dist/sandbox/internal/id-token.d.ts +56 -0
- package/dist/sandbox/internal/id-token.d.ts.map +1 -0
- package/dist/sandbox/internal/id-token.js +71 -0
- package/dist/sandbox/internal/id-token.js.map +1 -0
- package/dist/sandbox/internal/index.d.ts +9 -0
- package/dist/sandbox/internal/index.d.ts.map +1 -1
- package/dist/sandbox/internal/index.js +10 -0
- package/dist/sandbox/internal/index.js.map +1 -1
- package/dist/sandbox/internal/live-status-poller.d.ts +36 -0
- package/dist/sandbox/internal/live-status-poller.d.ts.map +1 -0
- package/dist/sandbox/internal/live-status-poller.js +93 -0
- package/dist/sandbox/internal/live-status-poller.js.map +1 -0
- package/dist/sandbox/internal/live-status.d.ts +64 -0
- package/dist/sandbox/internal/live-status.d.ts.map +1 -0
- package/dist/sandbox/internal/live-status.js +127 -0
- package/dist/sandbox/internal/live-status.js.map +1 -0
- package/dist/sandbox/internal/observed-call.d.ts +37 -0
- package/dist/sandbox/internal/observed-call.d.ts.map +1 -0
- package/dist/sandbox/internal/observed-call.js +149 -0
- package/dist/sandbox/internal/observed-call.js.map +1 -0
- package/dist/sandbox/internal/provenance.d.ts.map +1 -1
- package/dist/sandbox/internal/provenance.js +7 -0
- package/dist/sandbox/internal/provenance.js.map +1 -1
- package/dist/sandbox/internal/provider-email-verification.d.ts +3 -0
- package/dist/sandbox/internal/provider-email-verification.d.ts.map +1 -0
- package/dist/sandbox/internal/provider-email-verification.js +22 -0
- package/dist/sandbox/internal/provider-email-verification.js.map +1 -0
- package/dist/sandbox/internal/sandbox-jwt.d.ts +51 -0
- package/dist/sandbox/internal/sandbox-jwt.d.ts.map +1 -0
- package/dist/sandbox/internal/sandbox-jwt.js +108 -0
- package/dist/sandbox/internal/sandbox-jwt.js.map +1 -0
- package/dist/sandbox/persistence/controller.d.ts.map +1 -1
- package/dist/sandbox/persistence/controller.js +7 -4
- package/dist/sandbox/persistence/controller.js.map +1 -1
- package/dist/sandbox/types/events.d.ts +5 -1
- package/dist/sandbox/types/events.d.ts.map +1 -1
- package/dist/sandbox/types/index.d.ts +2 -1
- package/dist/sandbox/types/index.d.ts.map +1 -1
- package/dist/sandbox/types/observed-call.d.ts +65 -0
- package/dist/sandbox/types/observed-call.d.ts.map +1 -0
- package/dist/sandbox/types/observed-call.js +11 -0
- package/dist/sandbox/types/observed-call.js.map +1 -0
- package/dist/sandbox/types/operation.d.ts +22 -0
- package/dist/sandbox/types/operation.d.ts.map +1 -1
- package/dist/sandbox/types/persistence.d.ts +9 -2
- package/dist/sandbox/types/persistence.d.ts.map +1 -1
- package/dist/storage/sandbox/rules-bindings.d.ts.map +1 -1
- package/dist/storage/sandbox/rules-bindings.js +3 -1
- package/dist/storage/sandbox/rules-bindings.js.map +1 -1
- package/dist/storage/sandbox/rules-evaluator.d.ts.map +1 -1
- package/dist/storage/sandbox/rules-evaluator.js +78 -20
- package/dist/storage/sandbox/rules-evaluator.js.map +1 -1
- package/dist/storage/sandbox/rules-firestore-lookup.d.ts.map +1 -1
- package/dist/storage/sandbox/rules-firestore-lookup.js +9 -28
- package/dist/storage/sandbox/rules-firestore-lookup.js.map +1 -1
- package/dist/storage/sandbox/rules-latlng.d.ts.map +1 -1
- package/dist/storage/sandbox/rules-latlng.js +2 -9
- package/dist/storage/sandbox/rules-latlng.js.map +1 -1
- package/dist/storage/sandbox/rules-methods.d.ts +5 -5
- package/dist/storage/sandbox/rules-methods.d.ts.map +1 -1
- package/dist/storage/sandbox/rules-methods.js +11 -11
- package/dist/storage/sandbox/rules-methods.js.map +1 -1
- package/dist/storage/sandbox/rules-operators.d.ts +14 -11
- package/dist/storage/sandbox/rules-operators.d.ts.map +1 -1
- package/dist/storage/sandbox/rules-operators.js +44 -55
- package/dist/storage/sandbox/rules-operators.js.map +1 -1
- package/dist/storage/sandbox/rules-path.d.ts +21 -0
- package/dist/storage/sandbox/rules-path.d.ts.map +1 -1
- package/dist/storage/sandbox/rules-path.js +47 -2
- package/dist/storage/sandbox/rules-path.js.map +1 -1
- package/dist/storage/sandbox/rules-time-methods.d.ts.map +1 -1
- package/dist/storage/sandbox/rules-time-methods.js +8 -8
- package/dist/storage/sandbox/rules-time-methods.js.map +1 -1
- package/dist/storage/sandbox/rules-values.d.ts +0 -1
- package/dist/storage/sandbox/rules-values.d.ts.map +1 -1
- package/dist/storage/sandbox/rules-values.js +0 -8
- package/dist/storage/sandbox/rules-values.js.map +1 -1
- package/dist/storage/sandbox/rules.d.ts +1 -1
- package/dist/storage/sandbox/rules.d.ts.map +1 -1
- package/dist/storage/sandbox/rules.js +5 -12
- package/dist/storage/sandbox/rules.js.map +1 -1
- package/dist/storage/service.d.ts +3 -1
- package/dist/storage/service.d.ts.map +1 -1
- package/dist/storage/service.js +3 -0
- package/dist/storage/service.js.map +1 -1
- package/package.json +4 -3
- package/src/ai/app-check-gate.ts +33 -15
- package/src/ai/broker/broker.ts +2 -2
- package/src/ai/broker/gemini-engine.ts +21 -1
- package/src/ai/broker/gemini-upstream.ts +11 -8
- package/src/ai/broker/upstream-error-redaction.ts +9 -6
- package/src/ai/generation-enums.ts +0 -24
- package/src/ai/index.ts +0 -3
- package/src/app/diagnostics.test.ts +1 -1
- package/src/app/diagnostics.ts +1 -1
- package/src/app/registry.ts +21 -8
- package/src/app-check/index.ts +5 -2
- package/src/app-check/state.ts +5 -3
- package/src/auth/instances.ts +48 -7
- package/src/auth/internal.ts +3 -1
- package/src/auth/reauth.ts +5 -2
- package/src/auth/sandbox/driver.ts +14 -3
- package/src/auth/sandbox/persistence.ts +42 -5
- package/src/auth/sandbox/project-store.ts +150 -0
- package/src/auth/sandbox/session-ledger.ts +109 -0
- package/src/auth/sandbox-backend-types.ts +10 -2
- package/src/auth/sandbox-backend.ts +208 -33
- package/src/auth/sandbox-token.ts +14 -13
- package/src/auth/tokens.ts +48 -59
- package/src/auth/types.ts +8 -7
- package/src/firestore/lite.ts +2 -2
- package/src/firestore/sandbox/wire-encoder.ts +7 -4
- package/src/rules/grammar/compile-limits.ts +35 -1
- package/src/rules/internal/index.ts +3 -0
- package/src/rules/simulator/conversions.ts +15 -21
- package/src/rules/simulator/evaluation-builtins.ts +18 -14
- package/src/rules/simulator/evaluator.ts +71 -28
- package/src/rules/simulator/firestore-values.ts +10 -4
- package/src/rules/simulator/handler.ts +2 -1
- package/src/rules/simulator/hashing-builtins.ts +2 -1
- package/src/rules/simulator/host-value.ts +57 -0
- package/src/rules/simulator/index-access.ts +23 -17
- package/src/rules/simulator/mapdiff.ts +7 -0
- package/src/rules/simulator/math-builtins.ts +26 -25
- package/src/rules/simulator/rules-int.ts +250 -0
- package/src/rules/simulator/rules-type.ts +3 -1
- package/src/rules/simulator/slice-bounds.ts +7 -4
- package/src/rules/simulator/trace-recorder.ts +5 -1
- package/src/rules/simulator/value-equality.ts +23 -9
- package/src/rules/simulator/wrappers/duration.ts +50 -29
- package/src/rules/simulator/wrappers/float.ts +22 -16
- package/src/sandbox/branches/promotion.ts +39 -0
- package/src/sandbox/branches/state-diff.ts +29 -0
- package/src/sandbox/checkpoints/validation.ts +9 -1
- package/src/sandbox/full-state.ts +32 -5
- package/src/sandbox/index.ts +6 -0
- package/src/sandbox/internal/app-check-token.ts +24 -87
- package/src/sandbox/internal/auth-accounts.ts +96 -0
- package/src/sandbox/internal/auth-token-claims.ts +6 -3
- package/src/sandbox/internal/base64url.ts +54 -0
- package/src/sandbox/internal/caller-source.ts +42 -0
- package/src/sandbox/internal/custom-token.ts +125 -0
- package/src/sandbox/internal/id-token.ts +79 -0
- package/src/sandbox/internal/index.ts +39 -0
- package/src/sandbox/internal/live-status-poller.ts +118 -0
- package/src/sandbox/internal/live-status.ts +180 -0
- package/src/sandbox/internal/observed-call.ts +182 -0
- package/src/sandbox/internal/provenance.ts +6 -0
- package/src/sandbox/internal/provider-email-verification.ts +22 -0
- package/src/sandbox/internal/sandbox-jwt.ts +131 -0
- package/src/sandbox/persistence/controller.ts +17 -7
- package/src/sandbox/types/events.ts +11 -0
- package/src/sandbox/types/index.ts +8 -0
- package/src/sandbox/types/observed-call.ts +66 -0
- package/src/sandbox/types/operation.ts +23 -0
- package/src/sandbox/types/persistence.ts +10 -2
- package/src/storage/sandbox/rules-bindings.ts +3 -1
- package/src/storage/sandbox/rules-evaluator.ts +81 -20
- package/src/storage/sandbox/rules-firestore-lookup.ts +7 -26
- package/src/storage/sandbox/rules-latlng.ts +2 -8
- package/src/storage/sandbox/rules-methods.ts +12 -11
- package/src/storage/sandbox/rules-operators.ts +56 -51
- package/src/storage/sandbox/rules-path.ts +45 -2
- package/src/storage/sandbox/rules-time-methods.ts +10 -10
- package/src/storage/sandbox/rules-values.ts +0 -8
- package/src/storage/sandbox/rules.ts +7 -9
- package/src/storage/service.ts +6 -1
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Firebase AI Logic's App Check gate, as the sandbox plays it.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* What AI Logic answers a request without a valid App Check token depends on
|
|
5
|
+
* the project. Enforcement is required from a date each project can set, up to
|
|
6
|
+
* January 21, 2027, and an unenforced project may answer 200 until then. The
|
|
7
|
+
* sandbox always refuses, as an enforced project does, so an app finds the
|
|
8
|
+
* missing token before production does: a request with no `X-Firebase-AppCheck`
|
|
9
|
+
* header, a malformed one, the web SDK's placeholder token, or a token whose
|
|
10
|
+
* signature fails gets HTTP 401 `UNAUTHENTICATED`, the envelope an enforced
|
|
11
|
+
* project answered (capture `app-check-ai-gate-wire`, enforcement `ENFORCED`),
|
|
12
|
+
* before any engine runs. A valid token answers. The 403 `PERMISSION_DENIED`
|
|
13
|
+
* the sandbox sent before came from an unenforced project and is kept in
|
|
14
|
+
* `earlier-captures/ai-logic-refusal-unenforced.json`. See #1300.
|
|
10
15
|
*
|
|
11
16
|
* The App Check claim a request carries comes from the handle: `getAI(app)`
|
|
12
17
|
* reads the app's App Check activation when it builds the handle, as the SDK's
|
|
@@ -27,13 +32,21 @@
|
|
|
27
32
|
*/
|
|
28
33
|
import type { FirebaseApp } from '../app/types.js';
|
|
29
34
|
import type { AppCheckClaim, WireErrorEnvelope } from './broker/types.js';
|
|
30
|
-
/**
|
|
31
|
-
export declare const APP_CHECK_REQUIRED_MESSAGE = "Firebase
|
|
35
|
+
/** An enforced project's message for a refused request (capture `app-check-ai-gate-wire`), verbatim. */
|
|
36
|
+
export declare const APP_CHECK_REQUIRED_MESSAGE = "Firebase App Check token is invalid.";
|
|
37
|
+
/**
|
|
38
|
+
* The refusal sentence both hints open with. Enforcement is a per-project
|
|
39
|
+
* setting in production, and the sandbox plays an enforced project (#1834).
|
|
40
|
+
* Keep it short: the dev server cuts terminal text at 512 characters
|
|
41
|
+
* (`AI_TERMINAL_TEXT_MAX` in the CLI's `ai-terminal-text.ts`), and
|
|
42
|
+
* {@link APP_CHECK_HINT} must fit whole.
|
|
43
|
+
*/
|
|
44
|
+
export declare const APP_CHECK_REFUSAL_NOTE = "The sandbox refuses AI Logic requests without an App Check token with a 401, like an enforced project. In production, enforcement is set per project; one that delayed it answers without a token until January 21, 2027.";
|
|
32
45
|
/** Pyric's guidance for a page, printed beside production's error, never in place of it. */
|
|
33
|
-
export declare const APP_CHECK_HINT = "
|
|
46
|
+
export declare const APP_CHECK_HINT = "The sandbox refuses AI Logic requests without an App Check token with a 401, like an enforced project. In production, enforcement is set per project; one that delayed it answers without a token until January 21, 2027. Call initializeAppCheck(app, { provider }) before getAI(app). For local development, set self.FIREBASE_APPCHECK_DEBUG_TOKEN = true before initializeAppCheck to use the debug provider; the sandbox accepts its tokens. https://firebase.google.com/docs/ai-logic/app-check";
|
|
34
47
|
/** Pyric's guidance for a server process, where reCAPTCHA throws and `self` does not exist. */
|
|
35
|
-
export declare const APP_CHECK_SERVER_HINT = "
|
|
36
|
-
/** The
|
|
48
|
+
export declare const APP_CHECK_SERVER_HINT = "The sandbox refuses AI Logic requests without an App Check token with a 401, like an enforced project. In production, enforcement is set per project; one that delayed it answers without a token until January 21, 2027. This process has no document, so the reCAPTCHA providers throw here. For local development, set globalThis.FIREBASE_APPCHECK_DEBUG_TOKEN = true, then call initializeAppCheck(app, { provider: new CustomProvider({ getToken }) }) before getAI(app). The sandbox does not call getToken while the debug token is set. Without the debug token, getToken returns { token, expireTimeMillis: Date.now() + ttlMillis } from a token your server mints with firebase-admin's getAppCheck().createToken(appId). https://firebase.google.com/docs/ai-logic/app-check";
|
|
49
|
+
/** The refusal envelope an enforced project answered (capture `app-check-ai-gate-wire`). */
|
|
37
50
|
export declare function appCheckRequired(): WireErrorEnvelope;
|
|
38
51
|
/**
|
|
39
52
|
* Whether AI Logic would accept this token: one the sandbox signed (the web
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-check-gate.d.ts","sourceRoot":"","sources":["../../src/ai/app-check-gate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"app-check-gate.d.ts","sourceRoot":"","sources":["../../src/ai/app-check-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGnD,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG1E,wGAAwG;AACxG,eAAO,MAAM,0BAA0B,yCAAyC,CAAC;AAMjF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,8NAC0L,CAAC;AAE9N,4FAA4F;AAC5F,eAAO,MAAM,cAAc,0eAC8Q,CAAC;AAE1S,+FAA+F;AAC/F,eAAO,MAAM,qBAAqB,8vBAC2hB,CAAC;AAgB9jB,4FAA4F;AAC5F,wBAAgB,gBAAgB,IAAI,iBAAiB,CAEpD;AAOD;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,GAAE,MAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,CAOhH;AAED,oGAAoG;AACpG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CASzD;AAED,2DAA2D;AAC3D,MAAM,WAAW,kBAAkB;IACjC,mFAAmF;IACnF,KAAK,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,0FAA0F;IAC1F,WAAW,IAAI,IAAI,CAAC;CACrB;AAwBD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,GAAG,kBAAkB,CAM/F"}
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { appCheckActivationOf, appCheckTokenFor } from '../sandbox/internal/app-check-activation.js';
|
|
2
2
|
import { APP_CHECK_PLACEHOLDER_TOKEN, checkAppCheckToken } from '../sandbox/internal/app-check-token.js';
|
|
3
3
|
import { RequestHeadersFailure } from './errors.js';
|
|
4
|
-
/**
|
|
5
|
-
export const APP_CHECK_REQUIRED_MESSAGE = 'Firebase
|
|
4
|
+
/** An enforced project's message for a refused request (capture `app-check-ai-gate-wire`), verbatim. */
|
|
5
|
+
export const APP_CHECK_REQUIRED_MESSAGE = 'Firebase App Check token is invalid.';
|
|
6
|
+
/** An enforced project's HTTP status and status for a refused request (capture `app-check-ai-gate-wire`). */
|
|
7
|
+
const APP_CHECK_REQUIRED_CODE = 401;
|
|
8
|
+
const APP_CHECK_REQUIRED_STATUS = 'UNAUTHENTICATED';
|
|
9
|
+
/**
|
|
10
|
+
* The refusal sentence both hints open with. Enforcement is a per-project
|
|
11
|
+
* setting in production, and the sandbox plays an enforced project (#1834).
|
|
12
|
+
* Keep it short: the dev server cuts terminal text at 512 characters
|
|
13
|
+
* (`AI_TERMINAL_TEXT_MAX` in the CLI's `ai-terminal-text.ts`), and
|
|
14
|
+
* {@link APP_CHECK_HINT} must fit whole.
|
|
15
|
+
*/
|
|
16
|
+
export const APP_CHECK_REFUSAL_NOTE = 'The sandbox refuses AI Logic requests without an App Check token with a 401, like an enforced project. In production, enforcement is set per project; one that delayed it answers without a token until January 21, 2027.';
|
|
6
17
|
/** Pyric's guidance for a page, printed beside production's error, never in place of it. */
|
|
7
|
-
export const APP_CHECK_HINT =
|
|
18
|
+
export const APP_CHECK_HINT = `${APP_CHECK_REFUSAL_NOTE} Call initializeAppCheck(app, { provider }) before getAI(app). For local development, set self.FIREBASE_APPCHECK_DEBUG_TOKEN = true before initializeAppCheck to use the debug provider; the sandbox accepts its tokens. https://firebase.google.com/docs/ai-logic/app-check`;
|
|
8
19
|
/** Pyric's guidance for a server process, where reCAPTCHA throws and `self` does not exist. */
|
|
9
|
-
export const APP_CHECK_SERVER_HINT =
|
|
20
|
+
export const APP_CHECK_SERVER_HINT = `${APP_CHECK_REFUSAL_NOTE} This process has no document, so the reCAPTCHA providers throw here. For local development, set globalThis.FIREBASE_APPCHECK_DEBUG_TOKEN = true, then call initializeAppCheck(app, { provider: new CustomProvider({ getToken }) }) before getAI(app). The sandbox does not call getToken while the debug token is set. Without the debug token, getToken returns { token, expireTimeMillis: Date.now() + ttlMillis } from a token your server mints with firebase-admin's getAppCheck().createToken(appId). https://firebase.google.com/docs/ai-logic/app-check`;
|
|
10
21
|
/**
|
|
11
22
|
* The guidance for the realm the app runs in. A page has a `document`, and a
|
|
12
23
|
* page's Web Worker, SharedWorker or service worker has `WorkerGlobalScope`:
|
|
@@ -21,9 +32,9 @@ function appCheckHintForThisRealm() {
|
|
|
21
32
|
return APP_CHECK_HINT;
|
|
22
33
|
return APP_CHECK_SERVER_HINT;
|
|
23
34
|
}
|
|
24
|
-
/** The
|
|
35
|
+
/** The refusal envelope an enforced project answered (capture `app-check-ai-gate-wire`). */
|
|
25
36
|
export function appCheckRequired() {
|
|
26
|
-
return { error: { code:
|
|
37
|
+
return { error: { code: APP_CHECK_REQUIRED_CODE, message: APP_CHECK_REQUIRED_MESSAGE, status: APP_CHECK_REQUIRED_STATUS } };
|
|
27
38
|
}
|
|
28
39
|
function expiresAfter(claims, nowMillis) {
|
|
29
40
|
const exp = claims.exp;
|
|
@@ -48,11 +59,11 @@ export async function admitsAppCheckToken(token, nowMillis = Date.now()) {
|
|
|
48
59
|
/** Whether an error is this gate's refusal, as the broker throws it or the SDK error it becomes. */
|
|
49
60
|
export function isAppCheckRefusal(error) {
|
|
50
61
|
const envelope = error?.envelope;
|
|
51
|
-
const isBrokerRefusal = envelope?.error.code ===
|
|
62
|
+
const isBrokerRefusal = envelope?.error.code === APP_CHECK_REQUIRED_CODE && envelope.error.message === APP_CHECK_REQUIRED_MESSAGE;
|
|
52
63
|
if (isBrokerRefusal)
|
|
53
64
|
return true;
|
|
54
65
|
const sdkError = error;
|
|
55
|
-
const isSdkRefusal = sdkError?.customErrorData?.status ===
|
|
66
|
+
const isSdkRefusal = sdkError?.customErrorData?.status === APP_CHECK_REQUIRED_CODE
|
|
56
67
|
&& typeof sdkError.message === 'string'
|
|
57
68
|
&& sdkError.message.includes(APP_CHECK_REQUIRED_MESSAGE);
|
|
58
69
|
return isSdkRefusal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-check-gate.js","sourceRoot":"","sources":["../../src/ai/app-check-gate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-check-gate.js","sourceRoot":"","sources":["../../src/ai/app-check-gate.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AACrG,OAAO,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAEzG,OAAO,EAAE,qBAAqB,EAAE,MAAM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B,EAAE,UAAmB;IAClE,IAAI,CAAC;QACH,OAAO,MAAM,gBAAgB,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,MAAM,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAgB,EAAE,UAAmB;IACzE,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC;IACjE,OAAO;QACL,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,MAAM,eAAe,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAChG,WAAW,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -119,8 +119,8 @@ export declare class AiBroker {
|
|
|
119
119
|
private emitRejectionIfBrokerError;
|
|
120
120
|
/**
|
|
121
121
|
* AI Logic's App Check gate (`app-check-gate.ts`), before any engine runs:
|
|
122
|
-
* a request whose claim has no valid sandbox token is refused with
|
|
123
|
-
*
|
|
122
|
+
* a request whose claim has no valid sandbox token is refused with the
|
|
123
|
+
* 401 envelope an enforced project answers. A request with no claim comes from a handle
|
|
124
124
|
* with no app, which production has no counterpart for, and passes.
|
|
125
125
|
*/
|
|
126
126
|
admitAppCheck(model: string, appCheck: AppCheckClaim | undefined): Promise<void>;
|
package/dist/ai/broker/broker.js
CHANGED
|
@@ -197,8 +197,8 @@ export class AiBroker {
|
|
|
197
197
|
}
|
|
198
198
|
/**
|
|
199
199
|
* AI Logic's App Check gate (`app-check-gate.ts`), before any engine runs:
|
|
200
|
-
* a request whose claim has no valid sandbox token is refused with
|
|
201
|
-
*
|
|
200
|
+
* a request whose claim has no valid sandbox token is refused with the
|
|
201
|
+
* 401 envelope an enforced project answers. A request with no claim comes from a handle
|
|
202
202
|
* with no app, which production has no counterpart for, and passes.
|
|
203
203
|
*/
|
|
204
204
|
async admitAppCheck(model, appCheck) {
|
|
@@ -48,6 +48,13 @@ export declare class GeminiEngine implements AnswerEngine {
|
|
|
48
48
|
* (`upstream-error-redaction.ts`, #1660).
|
|
49
49
|
*/
|
|
50
50
|
private checkStatus;
|
|
51
|
+
/**
|
|
52
|
+
* One read of an upstream stream. A read that fails mid-stream becomes an
|
|
53
|
+
* {@link AiBrokerError} whose message has the request's credentials masked,
|
|
54
|
+
* as a failed fetch's does (#1737): the broker logs the message and the
|
|
55
|
+
* caller receives it, and a read error can quote upstream text.
|
|
56
|
+
*/
|
|
57
|
+
private readStream;
|
|
51
58
|
generateContent(req: GenerateContentRequest, model: string): Promise<WireResponse>;
|
|
52
59
|
streamGenerateContent(req: GenerateContentRequest, model: string): AsyncIterable<WireChunk>;
|
|
53
60
|
countTokens(req: CountTokensRequest, model: string): Promise<CountTokensResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-engine.d.ts","sourceRoot":"","sources":["../../../src/ai/broker/gemini-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAElF,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,SAAS,EACT,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAuCnF,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAExD,qBAAa,YAAa,YAAW,YAAY;IAC/C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;gBAE9B,OAAO,CAAC,EAAE,mBAAmB;IAIzC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mBAAmB,CAAC;CAIxF"}
|
|
@@ -103,6 +103,24 @@ export class GeminiEngine {
|
|
|
103
103
|
}
|
|
104
104
|
throw new AiBrokerError(errorEnvelope(response.status, `Gemini API returned status ${response.status}: ${redactUpstreamText(errorText, credentials)}`, 'INTERNAL'));
|
|
105
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* One read of an upstream stream. A read that fails mid-stream becomes an
|
|
108
|
+
* {@link AiBrokerError} whose message has the request's credentials masked,
|
|
109
|
+
* as a failed fetch's does (#1737): the broker logs the message and the
|
|
110
|
+
* caller receives it, and a read error can quote upstream text.
|
|
111
|
+
*/
|
|
112
|
+
async readStream(reader, credentials) {
|
|
113
|
+
try {
|
|
114
|
+
return await reader.read();
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
if (err instanceof AiBrokerError)
|
|
118
|
+
throw err;
|
|
119
|
+
const rawMessage = err instanceof Error ? err.message : String(err);
|
|
120
|
+
const message = `Gemini API stream aborted mid-response: ${redactUpstreamText(rawMessage, credentials)}`;
|
|
121
|
+
throw new AiBrokerError(errorEnvelope(502, message, 'UNAVAILABLE'));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
106
124
|
async generateContent(req, model) {
|
|
107
125
|
const { response } = await this.send(model, 'generateContent', req);
|
|
108
126
|
return (await response.json());
|
|
@@ -118,7 +136,7 @@ export class GeminiEngine {
|
|
|
118
136
|
let buffer = '';
|
|
119
137
|
try {
|
|
120
138
|
while (true) {
|
|
121
|
-
const { done, value } = await
|
|
139
|
+
const { done, value } = await this.readStream(reader, credentials);
|
|
122
140
|
const isDone = done === true;
|
|
123
141
|
if (isDone) {
|
|
124
142
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-engine.js","sourceRoot":"","sources":["../../../src/ai/broker/gemini-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB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,CAAC;YACT,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,GAAuB,EAAE,KAAa;QACtD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC;QAChE,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAwB,CAAC;IACxD,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-upstream.d.ts","sourceRoot":"","sources":["../../../src/ai/broker/gemini-upstream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"gemini-upstream.d.ts","sourceRoot":"","sources":["../../../src/ai/broker/gemini-upstream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH;;gDAEgD;AAChD,eAAO,MAAM,uBAAuB,8CAA8C,CAAC;AAqBnF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAG3E;AAyDD,MAAM,WAAW,qBAAqB;IACpC,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uFAAuF;IACvF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB;gEAC4D;IAC5D,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACtC,iFAAiF;IACjF,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB;oEACgE;IAChE,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAmBD,qBAAa,cAAc;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsE;IAChG,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAwB;IACtD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAmD;IACnE,OAAO,CAAC,SAAS,CAA8B;gBAEnC,OAAO,CAAC,EAAE,qBAAqB;IAS3C;;;;;OAKG;IACH,gBAAgB,IAAI,OAAO;IAI3B;;;;;;OAMG;IACG,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIvG;;;;;OAKG;IACG,mBAAmB,CACvB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,GACrC,OAAO,CAAC;QAAE,QAAQ,EAAE,QAAQ,CAAC;QAAC,WAAW,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAgBzD;;;;OAIG;YACW,gBAAgB;IAyB9B;;;;;OAKG;IACH,OAAO,CAAC,cAAc;YAkBR,cAAc;IAa5B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;YAuBf,IAAI;CAyBnB"}
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* `/__pyric/ai-proxy/gemini`, which attaches the credentials itself, so none
|
|
13
13
|
* are sent and the browser never holds the key.
|
|
14
14
|
*/
|
|
15
|
-
import { AiBrokerError, errorEnvelope
|
|
15
|
+
import { AiBrokerError, errorEnvelope } from './synthesizer.js';
|
|
16
|
+
import { redactUpstreamText } from './upstream-error-redaction.js';
|
|
16
17
|
/** Where the gemini engine talks when no `baseUrl` overrides it. Published
|
|
17
18
|
* through `pyric/ai/internal` so the CLI's startup banner can name the same
|
|
18
19
|
* endpoint instead of keeping its own copy. */
|
|
@@ -150,14 +151,14 @@ export class GeminiUpstream {
|
|
|
150
151
|
const auth = await this.resolveAuthToken();
|
|
151
152
|
const credentials = credentialsOf(auth);
|
|
152
153
|
const first = this.formatUpstreamRequest(resource, action, auth);
|
|
153
|
-
const response = await this.post(first.url, first.headers, body);
|
|
154
|
+
const response = await this.post(first.url, first.headers, body, credentials);
|
|
154
155
|
if (response.status === 401 && auth.isAdc) {
|
|
155
156
|
await response.body?.cancel().catch(() => { });
|
|
156
157
|
this.adcToken = undefined;
|
|
157
158
|
const retryAuth = await this.resolveAuthToken();
|
|
158
159
|
credentials.push(...credentialsOf(retryAuth));
|
|
159
160
|
const retry = this.formatUpstreamRequest(resource, action, retryAuth);
|
|
160
|
-
return { response: await this.post(retry.url, retry.headers, body), credentials };
|
|
161
|
+
return { response: await this.post(retry.url, retry.headers, body, credentials), credentials };
|
|
161
162
|
}
|
|
162
163
|
return { response, credentials };
|
|
163
164
|
}
|
|
@@ -241,17 +242,18 @@ export class GeminiUpstream {
|
|
|
241
242
|
const separator = url.includes('?') ? '&' : '?';
|
|
242
243
|
return { url: `${url}${separator}key=${encodeURIComponent(auth.token)}`, headers };
|
|
243
244
|
}
|
|
244
|
-
async post(url, headers, body) {
|
|
245
|
+
async post(url, headers, body, credentials) {
|
|
245
246
|
try {
|
|
246
247
|
return await this.fetchImpl(url, { method: 'POST', headers, body });
|
|
247
248
|
}
|
|
248
249
|
catch (err) {
|
|
249
|
-
//
|
|
250
|
-
// (
|
|
251
|
-
//
|
|
250
|
+
// Mask both with the request's exact credentials, as an error body is
|
|
251
|
+
// masked (#1737): `url` carries a static key, and a fetch error can
|
|
252
|
+
// quote the URL or a header, such as Node's refusal of an invalid
|
|
253
|
+
// `Authorization` value, which quotes the bearer token.
|
|
252
254
|
const rawMessage = err instanceof Error ? err.message : String(err);
|
|
253
|
-
const safeUrl =
|
|
254
|
-
const safeMessage =
|
|
255
|
+
const safeUrl = redactUpstreamText(url, credentials);
|
|
256
|
+
const safeMessage = redactUpstreamText(rawMessage, credentials);
|
|
255
257
|
throw new AiBrokerError(errorEnvelope(502, `Failed to connect to Gemini API at ${safeUrl}: ${safeMessage}`, 'UNAVAILABLE'));
|
|
256
258
|
}
|
|
257
259
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-upstream.js","sourceRoot":"","sources":["../../../src/ai/broker/gemini-upstream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"gemini-upstream.js","sourceRoot":"","sources":["../../../src/ai/broker/gemini-upstream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;gDAEgD;AAChD,MAAM,CAAC,MAAM,uBAAuB,GAAG,2CAA2C,CAAC;AAEnF,MAAM,aAAa,GAAG,CAAC,gBAAgB,EAAE,sBAAsB,CAAU,CAAC;AAE1E;6DAC6D;AAC7D,SAAS,OAAO,CAAC,IAAY;IAC3B,MAAM,GAAG,GAAI,UAAyE,CAAC,OAAO,EAAE,GAAG,CAAC;IACpG,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC;AAED,qEAAqE;AACrE,SAAS,aAAa,CAAC,WAA+B;IACpD,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,WAAW,CAAC;IAClD,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QACjC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;IACxC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAA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C,OAAO,KAAK,WAAW,EAAE,EAC/D,aAAa,CACd,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upstream-error-redaction.d.ts","sourceRoot":"","sources":["../../../src/ai/broker/upstream-error-redaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upstream-error-redaction.d.ts","sourceRoot":"","sources":["../../../src/ai/broker/upstream-error-redaction.ts"],"names":[],"mappings":"AAkCA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAIvF;AAqBD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAIxF"}
|
|
@@ -19,9 +19,14 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { redactUrl } from './synthesizer.js';
|
|
21
21
|
const MASK = '***';
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Every form every credential can appear in, raw and percent-encoded,
|
|
24
|
+
* longest first. One credential can contain another, such as an ADC token
|
|
25
|
+
* and the refreshed token that extends it, so the longer is masked first:
|
|
26
|
+
* masking the shorter first would leave the rest of the longer behind.
|
|
27
|
+
*/
|
|
28
|
+
function quotedForms(credentials) {
|
|
29
|
+
const forms = new Set(credentials.flatMap((credential) => [encodeURIComponent(credential), credential]));
|
|
25
30
|
return [...forms].sort((a, b) => b.length - a.length);
|
|
26
31
|
}
|
|
27
32
|
/**
|
|
@@ -31,10 +36,8 @@ function quotedForms(credential) {
|
|
|
31
36
|
*/
|
|
32
37
|
export function redactUpstreamText(text, credentials) {
|
|
33
38
|
let masked = text;
|
|
34
|
-
for (const
|
|
35
|
-
|
|
36
|
-
masked = masked.split(form).join(MASK);
|
|
37
|
-
}
|
|
39
|
+
for (const form of quotedForms(credentials))
|
|
40
|
+
masked = masked.split(form).join(MASK);
|
|
38
41
|
return redactUrl(masked);
|
|
39
42
|
}
|
|
40
43
|
function redactValue(value, credentials) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upstream-error-redaction.js","sourceRoot":"","sources":["../../../src/ai/broker/upstream-error-redaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,IAAI,GAAG,KAAK,CAAC;AAEnB
|
|
1
|
+
{"version":3,"file":"upstream-error-redaction.js","sourceRoot":"","sources":["../../../src/ai/broker/upstream-error-redaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,IAAI,GAAG,KAAK,CAAC;AAEnB;;;;;GAKG;AACH,SAAS,WAAW,CAAC,WAA8B;IACjD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACzG,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,WAA8B;IAC7E,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,WAAW,CAAC;QAAE,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpF,OAAO,SAAS,CAAC,MAA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AC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -1,25 +1,4 @@
|
|
|
1
1
|
/** Runtime values from the installed Firebase SDK. */
|
|
2
|
-
export declare const ImagenAspectRatio: {
|
|
3
|
-
readonly SQUARE: "1:1";
|
|
4
|
-
readonly LANDSCAPE_3x4: "3:4";
|
|
5
|
-
readonly PORTRAIT_4x3: "4:3";
|
|
6
|
-
readonly LANDSCAPE_16x9: "16:9";
|
|
7
|
-
readonly PORTRAIT_9x16: "9:16";
|
|
8
|
-
};
|
|
9
|
-
export type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof ImagenAspectRatio];
|
|
10
|
-
export declare const ImagenPersonFilterLevel: {
|
|
11
|
-
readonly BLOCK_ALL: "dont_allow";
|
|
12
|
-
readonly ALLOW_ADULT: "allow_adult";
|
|
13
|
-
readonly ALLOW_ALL: "allow_all";
|
|
14
|
-
};
|
|
15
|
-
export type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[keyof typeof ImagenPersonFilterLevel];
|
|
16
|
-
export declare const ImagenSafetyFilterLevel: {
|
|
17
|
-
readonly BLOCK_LOW_AND_ABOVE: "block_low_and_above";
|
|
18
|
-
readonly BLOCK_MEDIUM_AND_ABOVE: "block_medium_and_above";
|
|
19
|
-
readonly BLOCK_ONLY_HIGH: "block_only_high";
|
|
20
|
-
readonly BLOCK_NONE: "block_none";
|
|
21
|
-
};
|
|
22
|
-
export type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[keyof typeof ImagenSafetyFilterLevel];
|
|
23
2
|
export declare const InferenceMode: {
|
|
24
3
|
readonly PREFER_ON_DEVICE: "prefer_on_device";
|
|
25
4
|
readonly ONLY_ON_DEVICE: "only_on_device";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generation-enums.d.ts","sourceRoot":"","sources":["../../src/ai/generation-enums.ts"],"names":[],"mappings":"AAAA,sDAAsD;AAEtD,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"generation-enums.d.ts","sourceRoot":"","sources":["../../src/ai/generation-enums.ts"],"names":[],"mappings":"AAAA,sDAAsD;AAEtD,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE/E,eAAO,MAAM,eAAe;;;CAGlB,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAErF,eAAO,MAAM,gBAAgB;;;;;;CAMnB,CAAC;AACX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -1,22 +1,4 @@
|
|
|
1
1
|
/** Runtime values from the installed Firebase SDK. */
|
|
2
|
-
export const ImagenAspectRatio = {
|
|
3
|
-
SQUARE: "1:1",
|
|
4
|
-
LANDSCAPE_3x4: "3:4",
|
|
5
|
-
PORTRAIT_4x3: "4:3",
|
|
6
|
-
LANDSCAPE_16x9: "16:9",
|
|
7
|
-
PORTRAIT_9x16: "9:16",
|
|
8
|
-
};
|
|
9
|
-
export const ImagenPersonFilterLevel = {
|
|
10
|
-
BLOCK_ALL: "dont_allow",
|
|
11
|
-
ALLOW_ADULT: "allow_adult",
|
|
12
|
-
ALLOW_ALL: "allow_all",
|
|
13
|
-
};
|
|
14
|
-
export const ImagenSafetyFilterLevel = {
|
|
15
|
-
BLOCK_LOW_AND_ABOVE: "block_low_and_above",
|
|
16
|
-
BLOCK_MEDIUM_AND_ABOVE: "block_medium_and_above",
|
|
17
|
-
BLOCK_ONLY_HIGH: "block_only_high",
|
|
18
|
-
BLOCK_NONE: "block_none",
|
|
19
|
-
};
|
|
20
2
|
export const InferenceMode = {
|
|
21
3
|
PREFER_ON_DEVICE: "prefer_on_device",
|
|
22
4
|
ONLY_ON_DEVICE: "only_on_device",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generation-enums.js","sourceRoot":"","sources":["../../src/ai/generation-enums.ts"],"names":[],"mappings":"AAAA,sDAAsD;AAEtD,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"generation-enums.js","sourceRoot":"","sources":["../../src/ai/generation-enums.ts"],"names":[],"mappings":"AAAA,sDAAsD;AAEtD,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,gBAAgB,EAAE,kBAAkB;IACpC,cAAc,EAAE,gBAAgB;IAChC,aAAa,EAAE,eAAe;IAC9B,eAAe,EAAE,iBAAiB;CAC1B,CAAC;AAGX,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;CACZ,CAAC;AAGX,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,cAAc,EAAE,eAAe;IAC/B,SAAS,EAAE,UAAU;IACrB,sBAAsB,EAAE,sBAAsB;IAC9C,iBAAiB,EAAE,iBAAiB;IACpC,yBAAyB,EAAE,yBAAyB;CAC5C,CAAC"}
|
package/dist/ai/index.d.ts
CHANGED
|
@@ -28,5 +28,5 @@ export type { GenerateContentResult, GenerateContentStreamResult, SingleRequestO
|
|
|
28
28
|
export { BlockReason, FinishReason, FunctionCallingMode, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, ImageConfigAspectRatio, ImageConfigImageSize, Language, Modality, Outcome, POSSIBLE_ROLES, ResponseModality, SchemaType, ThinkingLevel, URLRetrievalStatus, } from './enums.js';
|
|
29
29
|
export type { Role } from './enums.js';
|
|
30
30
|
export type { Citation, CitationMetadata, CodeExecutionResult, CodeExecutionResultPart, CodeExecutionTool, Content, CountTokensRequest, CountTokensResponse, Date, EnhancedGenerateContentResponse, ErrorDetails, ExecutableCode, ExecutableCodePart, FileData, FileDataPart, FunctionCall, FunctionCallingConfig, FunctionCallPart, FunctionDeclaration, FunctionDeclarationsTool, FunctionResponse, FunctionResponsePart, GenerateContentCandidate, GenerateContentRequest, GenerateContentResponse, GenerationConfig, GenerativeContentBlob, GoogleMaps, GoogleMapsGroundingChunk, GoogleMapsTool, GoogleSearch, GoogleSearchTool, GroundingChunk, GroundingMetadata, GroundingSupport, ImageConfig, InlineDataPart, LatLng, ModalityTokenCount, ObjectSchemaRequest, Part, PromptFeedback, RetrievalConfig, SafetyRating, SafetySetting, SchemaInterface, SchemaRequest, SchemaShared, SearchEntrypoint, Segment, TextPart, ThinkingConfig, Tool, ToolConfig, URLContext, URLContextMetadata, URLContextTool, URLMetadata, UsageMetadata, VideoMetadata, WebGroundingChunk, AI, AIOptions, } from './types.js';
|
|
31
|
-
export {
|
|
31
|
+
export { InferenceMode, InferenceSource, LiveResponseType, } from './generation-enums.js';
|
|
32
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/ai/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACzG,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC5F,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAA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EACV,aAAa,EACb,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAQvC,YAAY,EACV,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,IAAI,EACJ,+BAA+B,EAC/B,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACV,wBAAwB,EACxB,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,MAAM,EACN,kBAAkB,EAClB,mBAAmB,EACnB,IAAI,EACJ,cAAc,EACd,eAAe,EACf,YAAY,EACZ,aAAa,EACb,eAAe,EACf,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,cAAc,EACd,IAAI,EACJ,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,EAAE,EACF,SAAS,GACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,GACjB,MAAM,uBAAuB,CAAC"}
|
package/dist/ai/index.js
CHANGED
|
@@ -24,5 +24,5 @@ export { AnyOfSchema, ArraySchema, BooleanSchema, IntegerSchema, NumberSchema, O
|
|
|
24
24
|
export { TARGET_SYMBOL } from './target.js';
|
|
25
25
|
// ─── Re-exports: enums (const/type pairs, values verbatim from 2.12.0) ─
|
|
26
26
|
export { BlockReason, FinishReason, FunctionCallingMode, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, ImageConfigAspectRatio, ImageConfigImageSize, Language, Modality, Outcome, POSSIBLE_ROLES, ResponseModality, SchemaType, ThinkingLevel, URLRetrievalStatus, } from './enums.js';
|
|
27
|
-
export {
|
|
27
|
+
export { InferenceMode, InferenceSource, LiveResponseType, } from './generation-enums.js';
|
|
28
28
|
//# sourceMappingURL=index.js.map
|
package/dist/ai/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,yEAAyE;AAEzE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEzG,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAO5C,0EAA0E;AAE1E,OAAO,EACL,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,sBAAsB,EACtB,oBAAoB,EACpB,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,kBAAkB,GACnB,MAAM,YAAY,CAAC;AA2EpB,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,yEAAyE;AAEzE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEzG,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAO5C,0EAA0E;AAE1E,OAAO,EACL,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,sBAAsB,EACtB,oBAAoB,EACpB,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,kBAAkB,GACnB,MAAM,YAAY,CAAC;AA2EpB,OAAO,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,GACjB,MAAM,uBAAuB,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Firebase JS SDK version whose public app behavior the current oracle records.
|
|
3
3
|
* The app conformance replay makes this pin fail visibly when observations move.
|
|
4
4
|
*/
|
|
5
|
-
export declare const SDK_VERSION = "12.
|
|
5
|
+
export declare const SDK_VERSION = "12.19.0";
|
|
6
6
|
export type LogLevel = 'debug' | 'verbose' | 'info' | 'warn' | 'error' | 'silent';
|
|
7
7
|
export interface LogEntry {
|
|
8
8
|
level: LogLevel;
|
package/dist/app/diagnostics.js
CHANGED
|
@@ -3,7 +3,7 @@ import { FirebaseError } from '../sandbox/internal/firebase-error.js';
|
|
|
3
3
|
* Firebase JS SDK version whose public app behavior the current oracle records.
|
|
4
4
|
* The app conformance replay makes this pin fail visibly when observations move.
|
|
5
5
|
*/
|
|
6
|
-
export const SDK_VERSION = '12.
|
|
6
|
+
export const SDK_VERSION = '12.19.0';
|
|
7
7
|
const LOGGER_NAME = '@firebase/app';
|
|
8
8
|
const LEVELS = {
|
|
9
9
|
debug: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/app/registry.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAQpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAkBxD,iFAAiF;AACjF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,GAAG,IAAI,CAK1F;AAED,sFAAsF;AACtF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,KAAK,GAAG,IAAI,CAKjE;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/app/registry.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAQpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAkBxD,iFAAiF;AACjF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,GAAG,IAAI,CAK1F;AAED,sFAAsF;AACtF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,KAAK,GAAG,IAAI,CAKjE;AAyGD,wBAAgB,aAAa,CAC3B,OAAO,CAAC,EAAE,eAAe,EACzB,WAAW,CAAC,EAAE,MAAM,GAAG,mBAAmB,GACzC,WAAW,CA0Cb;AAED,wBAAgB,MAAM,CAAC,IAAI,GAAE,MAAyB,GAAG,WAAW,CAInE;AAED,wBAAgB,OAAO,IAAI,WAAW,EAAE,CAEvC;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAO/D;AAED,8EAA8E;AAC9E,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC,CAO9D"}
|
package/dist/app/registry.js
CHANGED
|
@@ -29,8 +29,13 @@ function appError(code, message) {
|
|
|
29
29
|
function noAppError(name) {
|
|
30
30
|
return appError('no-app', `No Firebase App '${name}' has been created - call initializeApp() first`);
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
/**
|
|
33
|
+
* firebase/app 12.19.0 names the mismatched parameter and embeds both values,
|
|
34
|
+
* each serialized with JSON.stringify, in the duplicate-app message.
|
|
35
|
+
*/
|
|
36
|
+
function duplicateAppError(name, mismatchedParam, oldValue, newValue) {
|
|
37
|
+
const values = `Existing: '${JSON.stringify(oldValue)}'. New: '${JSON.stringify(newValue)}'.`;
|
|
38
|
+
return appError('duplicate-app', `Firebase App named '${name}' already exists with different ${mismatchedParam}. ${values}`);
|
|
34
39
|
}
|
|
35
40
|
function appDeletedError(name) {
|
|
36
41
|
return appError('app-deleted', `Firebase App named '${name}' already deleted`);
|
|
@@ -104,11 +109,13 @@ export function initializeApp(options, rawSettings) {
|
|
|
104
109
|
const optionsSnapshot = cloneValue(options);
|
|
105
110
|
const existing = appRegistry.get(settings.name);
|
|
106
111
|
if (existing) {
|
|
107
|
-
if (firebaseOptionsEqual(existing.options, optionsSnapshot)
|
|
108
|
-
|
|
109
|
-
return existing.app;
|
|
112
|
+
if (!firebaseOptionsEqual(existing.options, optionsSnapshot)) {
|
|
113
|
+
throw duplicateAppError(settings.name, 'options', existing.options, optionsSnapshot);
|
|
110
114
|
}
|
|
111
|
-
|
|
115
|
+
if (!firebaseOptionsEqual(existing.settings, settings)) {
|
|
116
|
+
throw duplicateAppError(settings.name, 'config', existing.settings, settings);
|
|
117
|
+
}
|
|
118
|
+
return existing.app;
|
|
112
119
|
}
|
|
113
120
|
const refusal = backendRefusal;
|
|
114
121
|
const isRefused = refusal !== undefined;
|