@cartanova/qgrid-cli 2.12.0 → 2.14.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.
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/bundle/dist/_virtual/{_@oxc-project_runtime@0.140.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/decorate.js +1 -1
- package/bundle/dist/_virtual/{_@oxc-project_runtime@0.140.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/decorateMetadata.js +1 -1
- package/bundle/dist/_virtual/_rolldown/runtime.js +2 -2
- package/bundle/dist/application/monit/monit.frame.js +2 -2
- package/bundle/dist/application/qgrid/qgrid-run-lifecycle.js +3 -3
- package/bundle/dist/application/qgrid/qgrid.dispatcher.js +1 -1
- package/bundle/dist/application/qgrid/qgrid.frame.js +11 -7
- package/bundle/dist/application/qgrid/qgrid.types.js +8 -8
- package/bundle/dist/application/qgrid/token-death.js +3 -2
- package/bundle/dist/application/qgrid/token-subscriber.js +2 -2
- package/bundle/dist/application/qgrid/token-window-keepalive.js +2 -2
- package/bundle/dist/application/qgrid/tool-emulation-schema.js +5 -3
- package/bundle/dist/application/qgrid/tool-emulation.js +2 -2
- package/bundle/dist/application/request-log/request-log.model.js +9 -7
- package/bundle/dist/application/request-log-step/request-log-step.model.js +11 -7
- package/bundle/dist/application/setting/setting.model.js +11 -7
- package/bundle/dist/application/token/token.model.js +15 -11
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/names.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +7 -5
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/data.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/schema.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js +15 -11
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft2020.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/index.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/next.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/index.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitContains.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js +1 -1
- package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +1 -1
- package/bundle/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +1 -1
- package/bundle/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js +18 -12
- package/bundle/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js +1 -1
- package/bundle/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js +16 -13
- package/bundle/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +1 -1
- package/bundle/dist/sonamu.config.js +11 -11
- package/bundle/dist/startup-migrations.js +1 -1
- package/bundle/dist/utils/providers/anthropic/anthropic-dispatcher.js +3 -2
- package/bundle/dist/utils/providers/anthropic/anthropic-quota.js +3 -3
- package/bundle/dist/utils/providers/anthropic/anthropic-thinking.js +5 -2
- package/bundle/dist/utils/providers/anthropic/stream-json-adapter.js +9 -7
- package/bundle/dist/utils/providers/common/model-cost.js +37 -11
- package/bundle/dist/utils/providers/common/schema-validation.js +3 -3
- package/bundle/dist/utils/providers/grok/grok-constants.js +2 -2
- package/bundle/dist/utils/providers/grok/grok-dispatcher.js +5 -3
- package/bundle/dist/utils/providers/grok/grok-media-client.js +5 -5
- package/bundle/dist/utils/providers/grok/grok-oauth.js +2 -2
- package/bundle/dist/utils/providers/openai/openai-dispatcher.js +8 -6
- package/bundle/dist/utils/providers/openai/openai-image-generation.js +4 -4
- package/bundle/src/application/qgrid/qgrid.frame.test.ts +25 -10
- package/bundle/src/application/qgrid/qgrid.frame.ts +6 -1
- package/bundle/src/application/qgrid/qgrid.types.ts +5 -5
- package/bundle/src/application/request-log/request-log.model.ts +1 -1
- package/bundle/src/sonamu.config.ts +14 -14
- package/bundle/src/utils/providers/anthropic/anthropic-quota.test.ts +20 -1
- package/bundle/src/utils/providers/anthropic/anthropic-quota.ts +2 -2
- package/bundle/src/utils/providers/common/model-cost.test.ts +26 -4
- package/bundle/src/utils/providers/common/model-cost.ts +52 -17
- package/bundle/src/utils/providers/grok/grok-constants.ts +9 -10
- package/bundle/src/utils/providers/grok/grok-media-client.test.ts +6 -6
- package/bundle/src/utils/providers/grok/grok-types.test.ts +4 -4
- package/bundle/web-dist/client/assets/clsx-DB0hHKMi.js +1 -0
- package/bundle/web-dist/client/assets/cost-CZzlCFS2.js +1 -0
- package/bundle/web-dist/client/assets/index-Cj7ZXipM.js +104 -0
- package/bundle/web-dist/client/assets/index-DLo1QCw7.css +1 -0
- package/bundle/web-dist/client/assets/logs-DSuoyKRh.js +1 -0
- package/bundle/web-dist/client/assets/monit-BwLPgwHG.js +1 -0
- package/bundle/web-dist/client/assets/plus-Bab0ACnC.js +1 -0
- package/bundle/web-dist/client/assets/refresh-cw-BtYoFHVw.js +1 -0
- package/bundle/web-dist/client/assets/request-model-Dl31cZdf.js +1 -0
- package/bundle/web-dist/client/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/bundle/web-dist/client/assets/routes-_R4-gxLV.js +5 -0
- package/bundle/web-dist/client/assets/settings-ZBCgAZaZ.js +1 -0
- package/bundle/web-dist/client/assets/show-DFFBtBqe.js +2 -0
- package/bundle/web-dist/client/assets/tokens-DYSfYz8A.js +1 -0
- package/bundle/web-dist/client/assets/use-oauth-login-flow-CN8nxeAR.js +1 -0
- package/bundle/web-dist/client/assets/use-update-token-mutation-B-N8fFUm.js +1 -0
- package/bundle/web-dist/client/assets/vendor-react-8xo7RSum.js +9 -0
- package/bundle/web-dist/client/assets/vendor-tanstack-6B86itGS.js +2 -0
- package/bundle/web-dist/client/index.html +5 -7
- package/bundle/web-dist/server/assets/{logs-B5M5B7pN.js → logs-C0md5rmp.js} +48 -36
- package/bundle/web-dist/server/assets/monit-YVvwJuAF.js +479 -0
- package/bundle/web-dist/server/assets/plus-z5Hy__3C.js +26 -0
- package/bundle/web-dist/server/assets/refresh-cw-CNm0CERy.js +30 -0
- package/bundle/web-dist/server/assets/{request-model-Cp6h5EuP.js → request-model-DIuPZZwu.js} +14 -7
- package/bundle/web-dist/server/assets/{routes-rIXpkI-t.js → routes-CjWxvHAO.js} +1741 -1101
- package/bundle/web-dist/server/assets/{services.generated-CMJ8AHbO.js → services.generated-CqS8DCjT.js} +11973 -6081
- package/bundle/web-dist/server/assets/{settings-_MoaFGxj.js → settings-CXwnKiMG.js} +40 -19
- package/bundle/web-dist/server/assets/{show-Cfm9UeDr.js → show-G1t8dOEh.js} +268 -213
- package/bundle/web-dist/server/assets/{tokens-DMSHDg9D.js → tokens-C4D67FBX.js} +41 -18
- package/bundle/web-dist/server/assets/{use-oauth-login-flow-jkAkT3X6.js → use-oauth-login-flow-CFzShQtp.js} +1569 -38
- package/bundle/web-dist/server/assets/{use-update-token-mutation-Sm6kh02m.js → use-update-token-mutation-oH0O0n-g.js} +1 -1
- package/bundle/web-dist/server/entry-server.generated.js +11595 -5045
- package/dist/cli.js +20 -11
- package/package.json +24 -24
- package/skills/qgrid/references/ai-sdk-provider-contract.md +4 -4
- package/skills/qgrid/references/anthropic-claude-code-runtime.md +2 -2
- package/skills/qgrid/references/decision-rationale.md +6 -2
- package/skills/qgrid/references/grok-runtime.md +6 -0
- package/skills/qgrid/references/repo-map.md +1 -1
- package/skills/qgrid/references/request-log-run-lifecycle.md +1 -1
- package/skills/qgrid/references/token-auth-quota-lifecycle.md +3 -2
- package/skills/qgrid/references/tool-calling-and-multiturn.md +2 -2
- package/bundle/web-dist/client/assets/clsx-5XM_pHvN.js +0 -1
- package/bundle/web-dist/client/assets/cost-DB3HbU7T.js +0 -1
- package/bundle/web-dist/client/assets/index-Be2qCZmI.css +0 -1
- package/bundle/web-dist/client/assets/index-CK9LwGNV.js +0 -32
- package/bundle/web-dist/client/assets/logs-DjQcEivP.js +0 -1
- package/bundle/web-dist/client/assets/monit-RTxpU7oZ.js +0 -1
- package/bundle/web-dist/client/assets/plus-DDvVTvQP.js +0 -1
- package/bundle/web-dist/client/assets/preload-helper-DWTEM3RW.js +0 -1
- package/bundle/web-dist/client/assets/refresh-cw-CTQsNddA.js +0 -1
- package/bundle/web-dist/client/assets/request-model-DliRuPcw.js +0 -1
- package/bundle/web-dist/client/assets/rolldown-runtime-Dw2cE7zH.js +0 -1
- package/bundle/web-dist/client/assets/routes-DVHoo-YF.js +0 -5
- package/bundle/web-dist/client/assets/services.generated-B5lc3aIC.js +0 -51
- package/bundle/web-dist/client/assets/settings-BQUz6UFr.js +0 -1
- package/bundle/web-dist/client/assets/show-CalQG1Ew.js +0 -2
- package/bundle/web-dist/client/assets/tokens-DU4fWXI9.js +0 -1
- package/bundle/web-dist/client/assets/use-oauth-login-flow-BfxYI4Oh.js +0 -1
- package/bundle/web-dist/client/assets/use-update-token-mutation-qKBC2sn7.js +0 -1
- package/bundle/web-dist/client/assets/vendor-react-DH4kUfK2.js +0 -9
- package/bundle/web-dist/client/assets/vendor-tanstack-DRPs09ai.js +0 -1
- package/bundle/web-dist/server/assets/lazyRouteComponent-AKiHfZWp.js +0 -1983
- package/bundle/web-dist/server/assets/monit-p6JM8MMl.js +0 -1652
- package/bundle/web-dist/server/assets/plus-I0FfLVgU.js +0 -19
- package/bundle/web-dist/server/assets/react-dom-Cv23mm1K.js +0 -335
- package/bundle/web-dist/server/assets/refresh-cw-DYsnffRC.js +0 -23
- /package/bundle/web-dist/server/assets/{clsx-D_N5PN_2.js → clsx-DgIEfj3H.js} +0 -0
- /package/bundle/web-dist/server/assets/{cost-BC9yzyA9.js → cost-oNK0T4Jo.js} +0 -0
|
@@ -43,6 +43,20 @@ const oauthCallbackQuerySchema = z.looseObject({
|
|
|
43
43
|
state: z.string().optional(),
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
+
async function oauthCallback(request: FastifyRequest, reply: FastifyReply) {
|
|
47
|
+
const { code, state } = oauthCallbackQuerySchema.safeParse(request.query).data ?? {};
|
|
48
|
+
|
|
49
|
+
if (!code || !state) {
|
|
50
|
+
return reply.redirect("/?oauth=error&reason=missing_params");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
return QgridFrame.handleOAuthCallback(code, state, reply);
|
|
55
|
+
} catch {
|
|
56
|
+
return reply.redirect("/?oauth=error&reason=callback_failed");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
46
60
|
const host = process.env.HOST ?? "localhost";
|
|
47
61
|
const port = Number(process.env.PORT ?? 44900);
|
|
48
62
|
|
|
@@ -121,20 +135,6 @@ export default defineConfig({
|
|
|
121
135
|
prefix: "/api/public",
|
|
122
136
|
},
|
|
123
137
|
custom: (server) => {
|
|
124
|
-
const oauthCallback = async (request: FastifyRequest, reply: FastifyReply) => {
|
|
125
|
-
const { code, state } = oauthCallbackQuerySchema.safeParse(request.query).data ?? {};
|
|
126
|
-
|
|
127
|
-
if (!code || !state) {
|
|
128
|
-
return reply.redirect("/?oauth=error&reason=missing_params");
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
try {
|
|
132
|
-
return QgridFrame.handleOAuthCallback(code, state, reply);
|
|
133
|
-
} catch {
|
|
134
|
-
return reply.redirect("/?oauth=error&reason=callback_failed");
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
|
|
138
138
|
server.get("/callback", oauthCallback);
|
|
139
139
|
server.get("/auth/callback", oauthCallback);
|
|
140
140
|
},
|
|
@@ -34,6 +34,25 @@ describe("readAnthropicQuotaUsage", () => {
|
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
+
it.each([
|
|
38
|
+
{ fiveHour: 0, sevenDay: 100, expected: 100 },
|
|
39
|
+
{ fiveHour: 80, sevenDay: 20, expected: 80 },
|
|
40
|
+
{ fiveHour: null, sevenDay: 100, expected: 100 },
|
|
41
|
+
])("includes shared weekly usage in Opus eligibility: %j", async ({ fiveHour, sevenDay, expected }) => {
|
|
42
|
+
fetchUsageWithMetaMock.mockResolvedValueOnce({
|
|
43
|
+
data: {
|
|
44
|
+
five_hour: { utilization: fiveHour, resets_at: null },
|
|
45
|
+
seven_day: { utilization: sevenDay, resets_at: null },
|
|
46
|
+
},
|
|
47
|
+
cachedAt: Date.now(),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
await expect(readAnthropicQuotaUsage("access-token", "claude-opus-5-5")).resolves.toMatchObject({
|
|
51
|
+
kind: "ok",
|
|
52
|
+
utilizationPct: expected,
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
37
56
|
it("uses the separate Fable 7-day limit only for Fable family requests", async () => {
|
|
38
57
|
const usage = {
|
|
39
58
|
data: {
|
|
@@ -104,7 +123,7 @@ describe("readAnthropicQuotaUsage", () => {
|
|
|
104
123
|
});
|
|
105
124
|
});
|
|
106
125
|
|
|
107
|
-
it("treats missing
|
|
126
|
+
it("treats missing usage across applicable windows as lookup_failed", async () => {
|
|
108
127
|
fetchUsageWithMetaMock.mockResolvedValueOnce({
|
|
109
128
|
data: { five_hour: { utilization: null, resets_at: null } },
|
|
110
129
|
cachedAt: Date.now(),
|
|
@@ -19,7 +19,7 @@ export async function readAnthropicQuotaUsage(
|
|
|
19
19
|
|
|
20
20
|
if (data.error) return { kind: "lookup_failed", reason: data.error };
|
|
21
21
|
|
|
22
|
-
const utilizations = [data.five_hour?.utilization];
|
|
22
|
+
const utilizations = [data.five_hour?.utilization, data.seven_day?.utilization];
|
|
23
23
|
|
|
24
24
|
// Fable 계열(5, 5.1)은 5시간 창과 별개로 usage credits 기반 7일 버킷도 소진될 수 있다.
|
|
25
25
|
if (isFableFamilyModel(model)) {
|
|
@@ -33,7 +33,7 @@ export async function readAnthropicQuotaUsage(
|
|
|
33
33
|
);
|
|
34
34
|
|
|
35
35
|
if (!Number.isFinite(utilization)) {
|
|
36
|
-
return { kind: "lookup_failed", reason: "
|
|
36
|
+
return { kind: "lookup_failed", reason: "quota utilization unavailable" };
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
return {
|
|
@@ -30,17 +30,39 @@ describe("Grok cost", () => {
|
|
|
30
30
|
);
|
|
31
31
|
|
|
32
32
|
it("prefers reported image ticks and falls back to the catalog per-image price", () => {
|
|
33
|
-
expect(grokImageCost("grok/grok-imagine-image-
|
|
33
|
+
expect(grokImageCost("grok/grok-imagine-image-2.0", 2, 700_000_000)).toEqual({
|
|
34
34
|
costUsd: 0.07,
|
|
35
35
|
costSource: "provider",
|
|
36
36
|
ticks: 700_000_000,
|
|
37
37
|
});
|
|
38
|
-
expect(grokImageCost("grok-imagine-image-
|
|
39
|
-
costUsd: 0.
|
|
38
|
+
expect(grokImageCost("grok-imagine-image-2.0", 2)).toEqual({
|
|
39
|
+
costUsd: 0.08,
|
|
40
40
|
costSource: "pricing_table",
|
|
41
|
-
ticks:
|
|
41
|
+
ticks: 800_000_000,
|
|
42
42
|
});
|
|
43
43
|
expect(grokImageCost("grok-imagine-image-unknown", 1)).toBeUndefined();
|
|
44
|
+
expect(grokImageCost("grok-imagine-image-quality", 1)).toBeUndefined();
|
|
45
|
+
expect(grokImageCost("grok-imagine-image-2.0", 1, 0)?.costUsd).toBe(0);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it.each([
|
|
49
|
+
["1k", "low", 0.04],
|
|
50
|
+
["1.5k", "low", 0.05],
|
|
51
|
+
["2k", "low", 0.06],
|
|
52
|
+
["1k", "medium", 0.06],
|
|
53
|
+
["1.5k", "medium", 0.07],
|
|
54
|
+
["2k", "medium", 0.08],
|
|
55
|
+
])("estimates 2.0 output at %s/%s", (resolution, quality, expected) => {
|
|
56
|
+
expect(grokImageCost("grok-imagine-image-2.0", 1, undefined, { resolution, quality })?.costUsd).toBe(expected);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("estimates auto edits with medium output and reference-image charges", () => {
|
|
60
|
+
expect(grokImageCost("grok-imagine-image-2.0", 2, undefined, {
|
|
61
|
+
resolution: "2k", quality: "auto", inputImageCount: 2,
|
|
62
|
+
})?.costUsd).toBe(0.18);
|
|
63
|
+
expect(grokImageCost("grok-imagine-image-2.0", 1, undefined, { inputImageCount: 1 })?.costUsd).toBe(0.07);
|
|
64
|
+
expect(grokImageCost("grok-imagine-image", 2, undefined, { resolution: "2k", inputImageCount: 1 })?.costUsd).toBe(0.042);
|
|
65
|
+
expect(grokImageCost("grok-imagine-image-2.0", 1, undefined, { quality: "high" })).toBeUndefined();
|
|
44
66
|
});
|
|
45
67
|
|
|
46
68
|
it("reports video/voice cost only when xAI reported it", () => {
|
|
@@ -249,14 +249,16 @@ export function usdFromGrokTicks(ticks: number): number {
|
|
|
249
249
|
return ticks / GROK_TICKS_PER_USD;
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
252
|
+
// ticks per token -> USD per 1M tokens.
|
|
253
|
+
function usdPerMillionFromGrokTicks(ticks: number): number {
|
|
254
|
+
return (ticks * 1_000_000) / GROK_TICKS_PER_USD;
|
|
255
|
+
}
|
|
255
256
|
|
|
257
|
+
function grokTokenCosts(input: number, cached: number, output: number): ModelCosts {
|
|
256
258
|
return {
|
|
257
|
-
inputTokens:
|
|
258
|
-
cachedInputTokens:
|
|
259
|
-
outputTokens:
|
|
259
|
+
inputTokens: usdPerMillionFromGrokTicks(input),
|
|
260
|
+
cachedInputTokens: usdPerMillionFromGrokTicks(cached),
|
|
261
|
+
outputTokens: usdPerMillionFromGrokTicks(output),
|
|
260
262
|
};
|
|
261
263
|
}
|
|
262
264
|
|
|
@@ -268,13 +270,33 @@ const GROK_COSTS = new Map<string, ModelCosts>(
|
|
|
268
270
|
}),
|
|
269
271
|
);
|
|
270
272
|
|
|
271
|
-
//
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
273
|
+
// Per-image ticks from https://docs.x.ai/developers/pricing (2026-10-25).
|
|
274
|
+
const GROK_IMAGE_PRICE_TICKS = new Map<
|
|
275
|
+
string,
|
|
276
|
+
{ input: number; output: Readonly<Record<string, number>> }
|
|
277
|
+
>([
|
|
278
|
+
[
|
|
279
|
+
"grok-imagine-image",
|
|
280
|
+
{
|
|
281
|
+
input: 20_000_000,
|
|
282
|
+
output: { "1k": 200_000_000, "2k": 200_000_000 },
|
|
283
|
+
},
|
|
284
|
+
],
|
|
285
|
+
[
|
|
286
|
+
"grok-imagine-image-2.0",
|
|
287
|
+
{
|
|
288
|
+
input: 100_000_000,
|
|
289
|
+
output: {
|
|
290
|
+
"1k:low": 400_000_000,
|
|
291
|
+
"1.5k:low": 500_000_000,
|
|
292
|
+
"2k:low": 600_000_000,
|
|
293
|
+
"1k:medium": 600_000_000,
|
|
294
|
+
"1.5k:medium": 700_000_000,
|
|
295
|
+
"2k:medium": 800_000_000,
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
],
|
|
299
|
+
]);
|
|
278
300
|
|
|
279
301
|
export interface GrokMediaCost {
|
|
280
302
|
costUsd: number;
|
|
@@ -284,19 +306,32 @@ export interface GrokMediaCost {
|
|
|
284
306
|
}
|
|
285
307
|
|
|
286
308
|
/**
|
|
287
|
-
*
|
|
288
|
-
*
|
|
309
|
+
* Prefer reported ticks; otherwise price output quality/resolution and input images separately.
|
|
310
|
+
* Unknown models or price combinations have no estimate.
|
|
289
311
|
*/
|
|
290
312
|
export function grokImageCost(
|
|
291
313
|
model: string,
|
|
292
314
|
imageCount: number,
|
|
293
315
|
reportedTicks?: number,
|
|
316
|
+
options: { resolution?: string; quality?: string; inputImageCount?: number } = {},
|
|
294
317
|
): GrokMediaCost | undefined {
|
|
295
318
|
if (reportedTicks !== undefined) return grokReportedCost(reportedTicks);
|
|
296
|
-
const
|
|
319
|
+
const id = model.split("/").pop() ?? model;
|
|
320
|
+
const prices = GROK_IMAGE_PRICE_TICKS.get(id);
|
|
321
|
+
|
|
322
|
+
if (!prices) return undefined;
|
|
323
|
+
const inputImageCount = options.inputImageCount ?? 0;
|
|
324
|
+
const resolution = options.resolution ?? "1k";
|
|
325
|
+
const defaultQuality = inputImageCount > 0 ? "medium" : "low";
|
|
326
|
+
|
|
327
|
+
const quality = options.quality && options.quality !== "auto" ? options.quality : defaultQuality;
|
|
328
|
+
|
|
329
|
+
const priceKey = id === "grok-imagine-image-2.0" ? `${resolution}:${quality}` : resolution;
|
|
330
|
+
|
|
331
|
+
const perImage = Object.hasOwn(prices.output, priceKey) ? prices.output[priceKey] : undefined;
|
|
297
332
|
|
|
298
333
|
if (perImage === undefined) return undefined;
|
|
299
|
-
const ticks = perImage * imageCount;
|
|
334
|
+
const ticks = perImage * imageCount + prices.input * inputImageCount;
|
|
300
335
|
|
|
301
336
|
return { costUsd: usdFromGrokTicks(ticks), costSource: "pricing_table", ticks };
|
|
302
337
|
}
|
|
@@ -55,8 +55,8 @@ export const GROK_CLIENT_MODE = "headless";
|
|
|
55
55
|
// U0 capture 2026-10-16 (GET /models default and /settings default_model)
|
|
56
56
|
export const GROK_DEFAULT_MODEL = "grok-4.7";
|
|
57
57
|
|
|
58
|
-
//
|
|
59
|
-
export const GROK_IMAGE_DEFAULT_MODEL = "grok-imagine-image-
|
|
58
|
+
// https://docs.x.ai/developers/migration/imagine-image-quality-nov-2
|
|
59
|
+
export const GROK_IMAGE_DEFAULT_MODEL = "grok-imagine-image-2.0";
|
|
60
60
|
|
|
61
61
|
// grok-build 1.0.45 video_gen/mod.rs:36-40
|
|
62
62
|
export const GROK_VIDEO_DEFAULT_MODEL = "grok-imagine-video-1.5";
|
|
@@ -81,14 +81,13 @@ export interface GrokSeedModel {
|
|
|
81
81
|
|
|
82
82
|
// U0 capture 2026-10-16 (GET /models: four ids, context_window 256000, default effort high)
|
|
83
83
|
export const GROK_SEED_MODELS: readonly GrokSeedModel[] = Object.freeze(
|
|
84
|
-
["grok-4.7", "grok-4.7-build-fast", "grok-4.6", "grok-4.5"].map(
|
|
85
|
-
(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}),
|
|
84
|
+
["grok-4.7", "grok-4.7-build-fast", "grok-4.6", "grok-4.5"].map((id): GrokSeedModel =>
|
|
85
|
+
Object.freeze({
|
|
86
|
+
id,
|
|
87
|
+
contextWindow: 256_000,
|
|
88
|
+
reasoningEfforts: GROK_REASONING_EFFORTS,
|
|
89
|
+
defaultEffort: "high",
|
|
90
|
+
}),
|
|
92
91
|
),
|
|
93
92
|
);
|
|
94
93
|
|
|
@@ -92,7 +92,7 @@ describe("GrokMediaClient images", () => {
|
|
|
92
92
|
// Key order matters for byte-level parity with grok-build.
|
|
93
93
|
expect(JSON.stringify(sent?.body)).toBe(
|
|
94
94
|
JSON.stringify({
|
|
95
|
-
model: "grok-imagine-image-
|
|
95
|
+
model: "grok-imagine-image-2.0",
|
|
96
96
|
prompt: "red square",
|
|
97
97
|
n: 1,
|
|
98
98
|
aspect_ratio: "1:1",
|
|
@@ -106,20 +106,20 @@ describe("GrokMediaClient images", () => {
|
|
|
106
106
|
it("maps SDK option names and keeps response_format b64_json", async () => {
|
|
107
107
|
const { impl, calls } = fakeFetch(async () => json(imageResponse));
|
|
108
108
|
await new GrokMediaClient({ fetch: impl }).generateImages(AUTH, {
|
|
109
|
-
model: "grok-imagine-image-
|
|
109
|
+
model: "grok-imagine-image-2.0",
|
|
110
110
|
prompt: "p",
|
|
111
111
|
n: 3,
|
|
112
112
|
resolution: "2k",
|
|
113
|
-
quality: "
|
|
113
|
+
quality: "medium",
|
|
114
114
|
outputFormat: "png",
|
|
115
115
|
});
|
|
116
116
|
expect(calls[0]?.body).toEqual({
|
|
117
|
-
model: "grok-imagine-image-
|
|
117
|
+
model: "grok-imagine-image-2.0",
|
|
118
118
|
prompt: "p",
|
|
119
119
|
n: 3,
|
|
120
120
|
resolution: "2k",
|
|
121
121
|
response_format: "b64_json",
|
|
122
|
-
quality: "
|
|
122
|
+
quality: "medium",
|
|
123
123
|
output_format: "png",
|
|
124
124
|
});
|
|
125
125
|
});
|
|
@@ -255,7 +255,7 @@ describe("GrokMediaClient images", () => {
|
|
|
255
255
|
]);
|
|
256
256
|
expect(calls[0]?.headers["content-type"]).toBe("application/json");
|
|
257
257
|
expect(calls[0]?.body).toEqual({
|
|
258
|
-
model: "grok-imagine-image-
|
|
258
|
+
model: "grok-imagine-image-2.0",
|
|
259
259
|
prompt: "make it blue",
|
|
260
260
|
n: 1,
|
|
261
261
|
resolution: "1k",
|
|
@@ -205,13 +205,13 @@ describe("api.x.ai schemas", () => {
|
|
|
205
205
|
const catalog = GrokApiImageModelCatalog.parse({
|
|
206
206
|
models: [
|
|
207
207
|
{
|
|
208
|
-
id: "grok-imagine-image-
|
|
209
|
-
image_price:
|
|
210
|
-
pricing: [{ quality: "
|
|
208
|
+
id: "grok-imagine-image-2.0",
|
|
209
|
+
image_price: 400000000,
|
|
210
|
+
pricing: [{ quality: "low", resolution: "1k", price_per_image: 400000000 }],
|
|
211
211
|
},
|
|
212
212
|
],
|
|
213
213
|
});
|
|
214
|
-
expect(grokCatalogModels(catalog)[0]?.pricing?.[0]?.price_per_image).toBe(
|
|
214
|
+
expect(grokCatalogModels(catalog)[0]?.pricing?.[0]?.price_per_image).toBe(400000000);
|
|
215
215
|
});
|
|
216
216
|
|
|
217
217
|
it("parses image, video, STT and TTS shapes", () => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(t){var n,r,i=``;if(typeof t==`string`||typeof t==`number`)i+=t;else if(typeof t==`object`){if(Array.isArray(t)){var a=t.length;for(n=0;n<a;n++)t[n]&&(r=e(t[n]))&&(i&&(i+=` `),i+=r)}else for(r in t)t[r]&&(i&&(i+=` `),i+=r)}return i}function t(){for(var t,n,r=0,i=``,a=arguments.length;r<a;r++)(t=arguments[r])&&(n=e(t))&&(i&&(i+=` `),i+=n);return i}export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return e/1e6}function t(e){return`$${e.toFixed(4)}`}function n(n){return t(e(n))}function r(n){return n.cost_usd===null&&n.image_cost_usd===null?`—`:t(e((n.cost_usd??0)+(n.image_cost_usd??0)))}function i(e){return e.input_tokens<=0?`—`:`${Math.round(e.cache_read_tokens/e.input_tokens*100)}%`}export{t as i,n,r,i as t};
|