@cartanova/qgrid-cli 2.11.1 → 2.13.1
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-response-format.js +9 -1
- package/bundle/dist/application/qgrid/qgrid-run-lifecycle.js +30 -6
- package/bundle/dist/application/qgrid/qgrid.dispatcher.js +7 -4
- package/bundle/dist/application/qgrid/qgrid.frame.js +30 -9
- 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 +13 -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 +9 -3
- package/bundle/dist/utils/providers/anthropic/anthropic-thinking.js +5 -2
- package/bundle/dist/utils/providers/anthropic/claude-session.js +10 -2
- package/bundle/dist/utils/providers/anthropic/stream-json-adapter.js +9 -7
- package/bundle/dist/utils/providers/common/model-cost.js +7 -5
- package/bundle/dist/utils/providers/common/schema-validation.js +3 -3
- package/bundle/dist/utils/providers/grok/grok-backend-protocol.js +1 -1
- package/bundle/dist/utils/providers/grok/grok-constants.js +1 -1
- package/bundle/dist/utils/providers/grok/grok-dispatcher.js +47 -14
- package/bundle/dist/utils/providers/grok/grok-media-client.js +4 -4
- package/bundle/dist/utils/providers/grok/grok-oauth.js +2 -2
- package/bundle/dist/utils/providers/grok/grok-types.js +2 -2
- package/bundle/dist/utils/providers/openai/openai-dispatcher.js +16 -8
- package/bundle/dist/utils/providers/openai/openai-image-generation.js +4 -4
- package/bundle/src/application/qgrid/qgrid-response-format.ts +9 -0
- package/bundle/src/application/qgrid/qgrid-run-lifecycle.test.ts +63 -0
- package/bundle/src/application/qgrid/qgrid-run-lifecycle.ts +49 -7
- package/bundle/src/application/qgrid/qgrid.dispatcher.ts +6 -0
- package/bundle/src/application/qgrid/qgrid.frame.test.ts +12 -4
- package/bundle/src/application/qgrid/qgrid.frame.ts +39 -3
- package/bundle/src/application/qgrid/qgrid.types.ts +5 -5
- package/bundle/src/application/request-log/request-log.model.ts +12 -1
- package/bundle/src/sonamu.config.ts +14 -14
- package/bundle/src/utils/providers/anthropic/anthropic-dispatcher.ts +2 -0
- package/bundle/src/utils/providers/anthropic/claude-session.ts +15 -1
- package/bundle/src/utils/providers/common/model-cost.ts +8 -6
- package/bundle/src/utils/providers/common/provider-dispatcher.ts +10 -0
- package/bundle/src/utils/providers/grok/grok-backend-protocol.ts +6 -1
- package/bundle/src/utils/providers/grok/grok-constants.ts +7 -8
- package/bundle/src/utils/providers/grok/grok-dispatcher.test.ts +74 -3
- package/bundle/src/utils/providers/grok/grok-dispatcher.ts +66 -18
- package/bundle/src/utils/providers/grok/grok-quota.test.ts +18 -0
- package/bundle/src/utils/providers/grok/grok-types.ts +2 -1
- package/bundle/src/utils/providers/openai/openai-dispatcher.test.ts +18 -0
- package/bundle/src/utils/providers/openai/openai-dispatcher.ts +10 -2
- 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-DLo1QCw7.css +1 -0
- package/bundle/web-dist/client/assets/index-DplV-wqZ.js +104 -0
- package/bundle/web-dist/client/assets/logs-st46aRba.js +1 -0
- package/bundle/web-dist/client/assets/monit-BMXR2tY2.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-BWPjgvhg.js +5 -0
- package/bundle/web-dist/client/assets/settings-DTXZjDAw.js +1 -0
- package/bundle/web-dist/client/assets/show-CdWNFPyS.js +2 -0
- package/bundle/web-dist/client/assets/tokens-eA34Gw5f.js +1 -0
- package/bundle/web-dist/client/assets/use-oauth-login-flow-CcUdLsa7.js +1 -0
- package/bundle/web-dist/client/assets/use-update-token-mutation-D2r5K5Bz.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-B7QmGJq3.js → logs-C0md5rmp.js} +67 -37
- 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-DIuPZZwu.js +38 -0
- package/bundle/web-dist/server/assets/{routes-_Y-PJfgO.js → routes-CjWxvHAO.js} +1745 -1120
- package/bundle/web-dist/server/assets/{services.generated-CMJ8AHbO.js → services.generated-CqS8DCjT.js} +11973 -6081
- package/bundle/web-dist/server/assets/{settings-JwJKxn2e.js → settings-CXwnKiMG.js} +40 -19
- package/bundle/web-dist/server/assets/{show-BEv6z1v_.js → show-G1t8dOEh.js} +274 -213
- package/bundle/web-dist/server/assets/{tokens-CNT4mI-f.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 +11641 -5075
- package/dist/cli.js +20 -11
- package/package.json +24 -24
- package/skills/qgrid/references/ai-sdk-provider-contract.md +5 -5
- package/skills/qgrid/references/cli-env-and-server-boot.md +4 -3
- package/skills/qgrid/references/decision-rationale.md +5 -1
- package/skills/qgrid/references/grok-runtime.md +7 -1
- package/skills/qgrid/references/repo-map.md +2 -0
- package/skills/qgrid/references/request-log-run-lifecycle.md +6 -1
- package/skills/qgrid/references/tool-calling-and-multiturn.md +2 -2
- package/skills/qgrid/references/verification-and-debugging.md +24 -5
- 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-C96h3feE.js +0 -32
- package/bundle/web-dist/client/assets/logs-DBM6U0QD.js +0 -1
- package/bundle/web-dist/client/assets/monit-BBjXa7vB.js +0 -1
- package/bundle/web-dist/client/assets/plus-BsQdY7PS.js +0 -1
- package/bundle/web-dist/client/assets/preload-helper-DWTEM3RW.js +0 -1
- package/bundle/web-dist/client/assets/refresh-cw-D9IUmT23.js +0 -1
- package/bundle/web-dist/client/assets/request-model-Bpp_rkK8.js +0 -1
- package/bundle/web-dist/client/assets/rolldown-runtime-Dw2cE7zH.js +0 -1
- package/bundle/web-dist/client/assets/routes-Crz_PQzi.js +0 -5
- package/bundle/web-dist/client/assets/services.generated-B5lc3aIC.js +0 -51
- package/bundle/web-dist/client/assets/settings-Cdwm3OBB.js +0 -1
- package/bundle/web-dist/client/assets/show-DBUhALT1.js +0 -2
- package/bundle/web-dist/client/assets/tokens-CVQAVJTo.js +0 -1
- package/bundle/web-dist/client/assets/total-cost-MnfKU8IN.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-DFt7x3bh.js +0 -1652
- package/bundle/web-dist/server/assets/plus-DaYQRpBt.js +0 -19
- package/bundle/web-dist/server/assets/react-dom-Cv23mm1K.js +0 -335
- package/bundle/web-dist/server/assets/refresh-cw-BpXNsAy-.js +0 -23
- package/bundle/web-dist/server/assets/request-model-eHE6YbaF.js +0 -31
- package/bundle/web-dist/server/assets/total-cost-fTE9Xy82.js +0 -18
- /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
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { execFileSync, execSync, spawnSync } from "node:child_process";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
-
import { delimiter,
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { delimiter, join } from "node:path";
|
|
6
5
|
import { Command } from "commander";
|
|
6
|
+
import { z } from "zod";
|
|
7
7
|
//#region src/database-env.ts
|
|
8
8
|
const DATABASE_ENV_DEFAULTS = {
|
|
9
9
|
HOST: "localhost",
|
|
@@ -136,13 +136,22 @@ function selfUpdateInstallCommand(packageManager, packageName, version) {
|
|
|
136
136
|
}
|
|
137
137
|
function resolveQgridRestartCommand(packageManager, globalBinDir) {
|
|
138
138
|
if (packageManager !== "pnpm" || !globalBinDir) return "qgrid";
|
|
139
|
-
const
|
|
139
|
+
const executable = process.platform === "win32" ? "qgrid.cmd" : "qgrid";
|
|
140
|
+
const candidate = join(globalBinDir, executable);
|
|
140
141
|
return existsSync(candidate) ? candidate : "qgrid";
|
|
141
142
|
}
|
|
142
143
|
//#endregion
|
|
143
144
|
//#region src/cli.ts
|
|
144
|
-
const
|
|
145
|
-
|
|
145
|
+
const cliPackageSchema = z.object({ version: z.string() });
|
|
146
|
+
function readCliPackage() {
|
|
147
|
+
const packageJsonPath = join(import.meta.dirname, "..", "package.json");
|
|
148
|
+
try {
|
|
149
|
+
return cliPackageSchema.parse(JSON.parse(readFileSync(packageJsonPath, "utf-8")));
|
|
150
|
+
} catch (error) {
|
|
151
|
+
throw new Error(`qgrid CLI cannot read its version from ${packageJsonPath}`, { cause: error });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const pkg = readCliPackage();
|
|
146
155
|
const RUNTIME_CLI_DEPENDENCIES = [{
|
|
147
156
|
command: "claude",
|
|
148
157
|
packageName: "@anthropic-ai/claude-code",
|
|
@@ -202,16 +211,16 @@ function ensureLatestRuntimeCliDependencies() {
|
|
|
202
211
|
let installedOutput = commandVersion(dep.command);
|
|
203
212
|
try {
|
|
204
213
|
const installed = parseVersion(installedOutput);
|
|
205
|
-
if (
|
|
206
|
-
console.log(`Updating ${dep.label}: installing latest`);
|
|
207
|
-
installRuntimeCliDependency(dep);
|
|
208
|
-
installedOutput = commandVersion(dep.command);
|
|
209
|
-
} else {
|
|
214
|
+
if (installed) {
|
|
210
215
|
const latest = packageLatestVersion(dep.packageName);
|
|
211
216
|
if (installed === latest) continue;
|
|
212
217
|
console.log(`Updating ${dep.label}: ${installed} → ${latest}`);
|
|
213
218
|
installRuntimeCliDependency(dep);
|
|
214
219
|
installedOutput = commandVersion(dep.command);
|
|
220
|
+
} else {
|
|
221
|
+
console.log(`Updating ${dep.label}: installing latest`);
|
|
222
|
+
installRuntimeCliDependency(dep);
|
|
223
|
+
installedOutput = commandVersion(dep.command);
|
|
215
224
|
}
|
|
216
225
|
} catch (e) {
|
|
217
226
|
console.warn(`Warning: failed to update ${dep.label}: ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -278,7 +287,7 @@ program.name("qgrid").version(pkg.version).description("Qgrid — LLM subscripti
|
|
|
278
287
|
console.error(`Error: Packaged qgrid supports NODE_ENV=staging or production, received "${process.env.NODE_ENV}"`);
|
|
279
288
|
process.exit(1);
|
|
280
289
|
}
|
|
281
|
-
const bundlePath = join(
|
|
290
|
+
const bundlePath = join(import.meta.dirname, "..", "bundle");
|
|
282
291
|
const serverEntry = join(bundlePath, "dist", "index.js");
|
|
283
292
|
if (!existsSync(serverEntry)) {
|
|
284
293
|
console.error(`Error: Server bundle not found at ${serverEntry}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cartanova/qgrid-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/cartanova-ai/qgrid"
|
|
@@ -17,39 +17,39 @@
|
|
|
17
17
|
],
|
|
18
18
|
"type": "module",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@ai-sdk/anthropic": "^
|
|
21
|
-
"@ai-sdk/provider": "^
|
|
22
|
-
"@ai-sdk/provider-utils": "^
|
|
23
|
-
"@better-auth/core": "~1.
|
|
24
|
-
"@better-auth/passkey": "~1.
|
|
25
|
-
"@better-auth/sso": "~1.
|
|
26
|
-
"@logtape/logtape": "2.
|
|
27
|
-
"@logtape/pretty": "2.
|
|
28
|
-
"@oxc-project/runtime": "^0.
|
|
29
|
-
"ai": "^
|
|
30
|
-
"better-auth": "~1.
|
|
20
|
+
"@ai-sdk/anthropic": "^4.0.0",
|
|
21
|
+
"@ai-sdk/provider": "^4.0.0",
|
|
22
|
+
"@ai-sdk/provider-utils": "^5.0.0",
|
|
23
|
+
"@better-auth/core": "~1.7.11",
|
|
24
|
+
"@better-auth/passkey": "~1.7.11",
|
|
25
|
+
"@better-auth/sso": "~1.7.11",
|
|
26
|
+
"@logtape/logtape": "2.4.2",
|
|
27
|
+
"@logtape/pretty": "2.4.2",
|
|
28
|
+
"@oxc-project/runtime": "^0.155.0",
|
|
29
|
+
"ai": "^7.0.0",
|
|
30
|
+
"better-auth": "~1.7.11",
|
|
31
31
|
"commander": "^13.0.0",
|
|
32
|
-
"dotenv": "^
|
|
33
|
-
"fastify": "^
|
|
34
|
-
"ioredis": "^
|
|
32
|
+
"dotenv": "^18.0.8",
|
|
33
|
+
"fastify": "^5.12.7",
|
|
34
|
+
"ioredis": "^6.0.0",
|
|
35
35
|
"json-schema-to-zod": "^2.8.1",
|
|
36
|
-
"knex": "^3.
|
|
37
|
-
"pg": "^8.
|
|
36
|
+
"knex": "^3.3.0",
|
|
37
|
+
"pg": "^8.23.1",
|
|
38
38
|
"pngjs": "^7.0.0",
|
|
39
|
-
"sonamu": "0.
|
|
39
|
+
"sonamu": "0.13.0",
|
|
40
40
|
"typescript": "7.1.0-dev.20260831.1",
|
|
41
41
|
"ws": "8.20.0",
|
|
42
|
-
"zod": "^4.
|
|
42
|
+
"zod": "^4.6.7"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@types/node": "
|
|
46
|
-
"@types/pg": "^8.
|
|
47
|
-
"semver": "^7.
|
|
48
|
-
"tsdown": "^0.
|
|
45
|
+
"@types/node": "26.6.5",
|
|
46
|
+
"@types/pg": "^8.23.1",
|
|
47
|
+
"semver": "^7.8.5",
|
|
48
|
+
"tsdown": "^0.23.1",
|
|
49
49
|
"yaml": "^2.8.2"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
|
-
"node": ">=
|
|
52
|
+
"node": ">=22"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"bundle": "cd ../api && pnpm build && cd ../cli && pnpm run bundle:copy",
|
|
@@ -18,7 +18,7 @@ Reference editing uses AI SDK `prompt: { text, images }`, with up to five refere
|
|
|
18
18
|
|
|
19
19
|
Use `QgridImageProviderOptions` with `satisfies` on `providerOptions.qgrid`. Options are flat: `quality`, `background`, `outputFormat: "png"`, `tokenName`, and `logger`. Standard `size` belongs at the `generateImage` top level. Do not send chat effort, thinking, tools, or structured output to the image model.
|
|
20
20
|
|
|
21
|
-
Map image response usage into standard `generateImage().usage`. Preserve per-image generation metadata and request-log IDs under `providerMetadata.qgrid.images[]`: AI SDK
|
|
21
|
+
Map image response usage into standard `generateImage().usage`. Preserve per-image generation metadata and request-log IDs under `providerMetadata.qgrid.images[]`: AI SDK merges that array and discards arbitrary provider-level keys. The raw query's top-level usage/cost remain zero chat-driver accounting; server logs price the separate image usage using the existing API-price estimator. Do not duplicate image price calculation in the SDK or count aggregate usage once per output. Without reported image usage, keep standard usage unknown and preserve the server's existing per-image cost fallback. `logger: false`, token targeting, project labeling, and cancellation still apply.
|
|
22
22
|
|
|
23
23
|
For tool calling, qgrid intentionally follows the AI SDK interface while implementing provider calls through qgrid structured-output emulation. Read `tool-calling-and-multiturn.md` before changing tool behavior, `stopWhen`/multi-step behavior, or tool-call request logs.
|
|
24
24
|
|
|
@@ -81,7 +81,7 @@ Language-model `providerOptions.qgrid` supports:
|
|
|
81
81
|
- `verbosity`: OpenAI/Codex route only.
|
|
82
82
|
- `reasoningSummary`: OpenAI/Codex route only.
|
|
83
83
|
- `serviceTier`: OpenAI/Codex route only.
|
|
84
|
-
- `timeoutMs`: Anthropic server-side Claude Code process timeout in milliseconds. It must be a positive integer no greater than 30 minutes and defaults to 240 seconds. For non-stream `generateText`, the SDK derives request-scoped Undici `headersTimeout` and `bodyTimeout` values as `timeoutMs + 60_000` without changing the process-global dispatcher.
|
|
84
|
+
- `timeoutMs`: Anthropic server-side Claude Code process timeout in milliseconds. It must be a positive integer no greater than 30 minutes and defaults to 240 seconds. For non-stream `generateText`, the SDK derives request-scoped Undici `headersTimeout` and `bodyTimeout` values as `timeoutMs + 60_000` without changing the process-global dispatcher. That request goes through undici's own `fetch`, from the same package as its `Agent`; see `references/decision-rationale.md`.
|
|
85
85
|
- `fallbackModels`: deprecated, ignored compatibility field. The provider emits a standard unsupported-option warning when supplied; remove it from callers. It is not Claude Code's upstream Fable safety-refusal fallback.
|
|
86
86
|
|
|
87
87
|
`imageGeneration` and `imageGenerationOptions` are not public SDK options. Language-model generation and streaming reject either key before transport, directing callers to `generateImage` with `qgrid.image()`. Use flat `QgridImageProviderOptions`; do not add deprecated language-model shims for the removed fields.
|
|
@@ -167,7 +167,7 @@ Payload responsibilities:
|
|
|
167
167
|
- Preserve and resend `runContext` for tool-call follow-ups.
|
|
168
168
|
- Let the server infer single-turn completion versus an open tool-call run. Logging-disabled tool calls still use the SDK's local pending-call correlation and continue without a request-log id.
|
|
169
169
|
- Derive/store/resend opaque OpenAI affinity coordinates by `sessionKey`.
|
|
170
|
-
- For `openai/` language models, send user-message image/file parts as image input: the current turn goes in qgrid `input` (text + image data/HTTP URLs) and earlier user turns as history `input_image`. The same JSON-transport size guard applies. Drop assistant image parts, and all image parts for `anthropic/` models (the Claude Code path is text-only), and report each drop as an AI SDK `unsupported` warning (`feature: "image input"`) in `warnings`, not only on the console.
|
|
170
|
+
- For `openai/` and `grok/` language models, send user-message image/file parts as image input: the current turn goes in qgrid `input` (text + image data/HTTP URLs) and earlier user turns as history `input_image`. The same JSON-transport size guard applies. `grok/` keeps only `https:` and `data:` URLs (the backend cannot fetch `http:`) and sniffs bytes sent as `image/*`; other providers use the shared extractor. Drop assistant image parts, and all image parts for `anthropic/` models (the Claude Code path is text-only), and report each drop as an AI SDK `unsupported` warning (`feature: "image input"`) in `warnings`, not only on the console.
|
|
171
171
|
- The separate image provider converts `generateImage` prompt references to qgrid `input` and rejects oversized inline reference images before transport. Callers should compress/resize large reference photos, preferably to WebP/JPEG.
|
|
172
172
|
|
|
173
173
|
Tools and `jsonSchema` can be used together as of qgrid 2.5.4. On OpenAI the
|
|
@@ -213,7 +213,7 @@ SDK image generation uses `ImageModelV3`, independently of AI SDK language-model
|
|
|
213
213
|
|
|
214
214
|
Cancelling the returned provider stream aborts its HTTP request and releases the SSE reader; caller abort signals propagate through the same request-local cancellation path. Normal completion and error events also release the reader. OpenAI affinity coordinates are swept for expiration on insertion and bounded to the most recently issued 1,000 entries; eviction keeps full-history generation functional.
|
|
215
215
|
|
|
216
|
-
Since 2.10.0, `generateText` exposes the parent request-log ID at `result.providerMetadata?.qgrid?.requestLogId`. For `streamText`, consume the stream first, then read `(await result.providerMetadata
|
|
216
|
+
Since 2.10.0, `generateText` exposes the parent request-log ID at `result.finalStep.providerMetadata?.qgrid?.requestLogId`. For `streamText`, consume the stream first, then read `(await result.finalStep).providerMetadata?.qgrid?.requestLogId`. AI SDK 7 keeps top-level `providerMetadata` only as a deprecated alias. The raw query response and stream `done` event carry optional top-level `requestLogId`.
|
|
217
217
|
|
|
218
218
|
Update both server and SDK to use this metadata. The field is omitted when logging is disabled or an older server does not return it. Tool-run steps share the parent ID; `runContext.requestLogId` remains separate continuation state. This does not expose external-provider telemetry logger IDs or add IDs to stream delta/error events.
|
|
219
219
|
|
|
@@ -255,6 +255,6 @@ Do not store or replay `sessionKey` affinity coordinates for `anthropic/*` model
|
|
|
255
255
|
|
|
256
256
|
## Logger integration
|
|
257
257
|
|
|
258
|
-
`createQgridLogger` records external provider calls into qgrid request logs. It skips qgrid provider calls to avoid double-logging, and it skips any external-provider generation whose `providerOptions.qgrid.logger` is `false`. This makes `logger: false` a single opt-out that produces zero native or telemetry request logs without changing the model call itself. When changing logger behavior, preserve stale-run fallback
|
|
258
|
+
`createQgridLogger` records external provider calls into qgrid request logs. Callers pass it as AI SDK 7's `telemetry` option. It skips qgrid provider calls to avoid double-logging, and it skips any external-provider generation whose `providerOptions.qgrid.logger` is `false`. This makes `logger: false` a single opt-out that produces zero native or telemetry request logs without changing the model call itself. Runs are keyed by the AI SDK `callId` and finish on `onEnd`, `onError` (an `AbortError` is recorded as `aborted`), or `onAbort`. When changing logger behavior, preserve the stale-run fallback for generations that never report a terminal event, such as an unconsumed stream.
|
|
259
259
|
|
|
260
260
|
For external providers, the logger reads AI SDK's provider-neutral `onStart.output.responseFormat`. JSON output modes send `isStructured: true` plus the serialized schema when present; ordinary text sends `isStructured: false` and `jsonSchema: null`. A succeeded structured run also sends `responseJsonOk`, based only on whether the final response text parses as JSON. Qgrid does not duplicate caller-side Zod/schema validation. These lifecycle fields are optional on the server so older SDK clients remain compatible.
|
|
@@ -47,9 +47,10 @@ Sonamu's native `SONAMU_DB_HOST`, `SONAMU_DB_PORT`, `SONAMU_DB_USER`,
|
|
|
47
47
|
|
|
48
48
|
Do not treat CLI bundle bootstrapping internals as user-facing qgrid configuration.
|
|
49
49
|
The packaged CLI accepts only `staging` and `production`; `development` and `test`
|
|
50
|
-
require the source workspace. Sonamu 0.10.3 also requires `.env` or
|
|
51
|
-
`.env.<NODE_ENV>` to exist at the API root
|
|
52
|
-
|
|
50
|
+
require the source workspace. Sonamu (0.10.3 and later, including 0.11) also requires `.env` or
|
|
51
|
+
`.env.<NODE_ENV>` to exist at the API root, even for `sonamu build`, which reads no values from it.
|
|
52
|
+
Source deployments and CI builds must provide one of those files (an empty file is enough), while
|
|
53
|
+
the npm CLI bundle carries an empty `.env` marker itself.
|
|
53
54
|
|
|
54
55
|
## SDK/client env vars
|
|
55
56
|
|
|
@@ -32,6 +32,8 @@ Key decisions:
|
|
|
32
32
|
- qgrid-specific options live under `providerOptions.qgrid`, not under provider-specific namespaces such as `providerOptions.openai`. Consumers should not need to branch on Codex versus Claude internals.
|
|
33
33
|
- AI SDK exposes the outer `providerOptions` as a generic JSON record. `QgridProviderOptions` intentionally types the nested `providerOptions.qgrid` value, and examples should apply `satisfies` there to restore qgrid-specific inference without replacing AI SDK's outer contract.
|
|
34
34
|
- AI SDK's standard `timeout` owns the client-side total budget and reaches custom providers only as an `AbortSignal`. `providerOptions.qgrid.timeoutMs` separately owns the Anthropic server-side Claude process timer. For non-stream calls, the qgrid SDK may derive its own request-scoped Undici header/body budget from that explicit qgrid value (`timeoutMs + 60s`), but must not mutate the global dispatcher or pretend the original AI SDK timeout number is available.
|
|
35
|
+
- A request-scoped undici `Agent` is always sent through undici's own `fetch` from the same package, never through the runtime's built-in `fetch`. The built-in `fetch` uses the undici bundled with Node, and dispatchers from another undici major fail its handler check: Node 26 (undici 8) rejected the SDK's undici 6 `Agent` with `UND_ERR_INVALID_ARG` ("invalid onError method"), and undici 8 dispatchers fail the same way on Node 22 and 24 (`docs/plans/2026-10-22-ai-sdk-v7-node26-migration-plan.md`).
|
|
36
|
+
- The SDK targets AI SDK 7 but keeps its V3 model implementations, which AI SDK 7 adapts. `createQgridLogger` keys runs by the AI SDK 7 telemetry `callId`, which replaced the v6-era `metadata.qgridRunId` keying and overlap quarantine. Since Sonamu 0.13 the api and cli packages are on AI SDK 7 too.
|
|
35
37
|
- `projectName` is provider config/payload camelCase. `project_name` is the Sonamu/database request-log column. Prefer `QGRID_PROJECT_NAME` as the project-wide default so request logs and metrics remain filterable at volume.
|
|
36
38
|
- `fallbackModels` may exist as a typed future option, but it is not a server wire contract until the server implements fallback routing. Do not forward it as behavior just because the type exists.
|
|
37
39
|
- Fable refusal fallback is an upstream Claude Code safety path to another Opus model (currently Opus 5 or Opus 4.8 by refusal category), not qgrid's reserved `fallbackModels` feature or Claude Code's overload-only `--fallback-model` flag. qgrid observes and reports the actual route and provider cost; it must not retry again or hardcode the target.
|
|
@@ -241,6 +243,8 @@ Key decisions:
|
|
|
241
243
|
- The CLI checks runtime CLIs (`codex`, `claude`) because qgrid delegates provider execution to those local binaries.
|
|
242
244
|
- The dashboard version should follow the CLI package version because the dashboard is shipped by the CLI bundle, not as an independently versioned web product.
|
|
243
245
|
- qgrid skills ship with the CLI package, not a separate skills package. qgrid cannot be used with the AI SDK alone; a local qgrid CLI server is required, so CLI install is the right moment to sync `.agents/skills/qgrid` and `.claude/skills/qgrid` into the consuming project.
|
|
246
|
+
- Sonamu 0.11 (2.11.0) keeps qgrid-side workarounds instead of pinning back: the API build sets `NODE_ENV=production` (SON-567), CI creates an empty `packages/api/.env`, and `.oxlintrc.json` disables `no-unnecessary-type-assertion` for Sonamu's lint temp files (SON-564). Remove each workaround once the matching Sonamu issue ships. Peer ranges that upstream packages have not widened yet are allowed per parent in `pnpm-workspace.yaml` `peerDependencyRules.allowedVersions`, with the reason next to each entry.
|
|
247
|
+
- Sonamu 0.13: the workspace catalog mirrors Sonamu's `catalog` and `catalogs` exactly; qgrid-only entries sit in a marked block after it. `ioredis` stays a cli/api dependency because `sonamu/cache` statically imports bentocache's Redis driver even for memory-only caching. With Sonamu 0.13's `ioredis@^6` against bentocache's `^5` peer, npm never finishes a project-local install of the CLI tarball, while `npm i -g` (users, release image) resolves in seconds, so the CI smoke test installs globally (`docs/plans/2026-10-22-ai-sdk-v7-node26-migration-plan.md`).
|
|
244
248
|
|
|
245
249
|
## Image Generation
|
|
246
250
|
|
|
@@ -258,7 +262,7 @@ Key decisions:
|
|
|
258
262
|
- It is non-stream only. Codex returns completed base64 image payloads, not useful image deltas.
|
|
259
263
|
- Image turns send full input directly and retain no provider conversation state. This prevents base64 payloads from entering reusable state.
|
|
260
264
|
- qgrid performs preflight capability/model gates. Raw `imageGeneration: true` requires an image; `"auto"` allows normal text replies but still rejects attempted image generation without a completed image. Public `generateImage` requires one direct Images output per provider call; AI SDK batches requests for `n` outputs.
|
|
261
|
-
- Raw returned images are inline base64 content parts. The image SDK maps them to AI SDK `image`/`images` and takes references through standard `prompt: { text, images }`, with JSON data URL size guarding and HTTPS reference URL support. The language SDK forwards user-message images to `openai/` models as image input (image→text) and drops other image parts with an AI SDK `unsupported` warning.
|
|
265
|
+
- Raw returned images are inline base64 content parts. The image SDK maps them to AI SDK `image`/`images` and takes references through standard `prompt: { text, images }`, with JSON data URL size guarding and HTTPS reference URL support. The language SDK forwards user-message images to `openai/` and `grok/` models as image input (image→text) and drops other image parts with an AI SDK `unsupported` warning.
|
|
262
266
|
- Raw/server `imageGenerationOptions` supports quality, size, and background. The public image SDK uses flat `QgridImageProviderOptions` and standard top-level `size`. The subscription backend can ignore size and quality hints. Put desired ratios in the prompt, report observed output settings, and never silently resize. Reported image usage is priced at public token rates; without it, use the requested quality/size table with a default-size price for auto/custom hints. Preserve observed settings separately from pricing assumptions. No background-removal fallback is allowed.
|
|
263
267
|
- qgrid does not manage generated or reference images as durable assets through a `generated_images` table or object-storage layer. Current request logs can still contain inline image data URLs for inspection and synthetic `image_generation` tool-call steps; current-turn input images (image→text and image references) live in `request_logs.input_images`; older image-generation logs keep them only in the first synthetic step's `tool_args.inputImages`.
|
|
264
268
|
- Image cost is stored separately in `request_logs.image_cost_usd`; `request_logs.cost_usd` remains the Codex driver model token cost. Image costs use reported image usage at public token rates, or per-image quality/size estimates when usage is absent. Auto/custom sizes fall back to the 1536x1024 price; omitted quality uses medium. Rows and totals display combined costs as dollar amounts without Cost labels, without Known/Estimated labels or pricing disclaimers. Existing stored null costs are not backfilled; `totalCost.unknownImageCostCount` remains for API compatibility.
|
|
@@ -45,6 +45,10 @@ Refresh starts 300 seconds plus stable 0–60 second per-account jitter before e
|
|
|
45
45
|
|
|
46
46
|
`/billing?format=credits` is camelCase: qgrid reads `config.creditUsagePercent`, `config.currentPeriod`, and `config.prepaidBalance.val`. The observed period was seven days anchored at subscription start. Results are cached for 60 seconds; lookup failure fails open (`grok-quota.ts`, `grok-dispatcher.ts`, `docs/diagnosis/2026-10-16-grok-live-probe.md`).
|
|
47
47
|
|
|
48
|
+
The response is protobuf JSON, which omits zero-valued scalars: a period without measurable usage arrives without `creditUsagePercent`, so qgrid reads the missing field as 0%. Observed on a Free account on 2026-10-21, where the field stayed absent even after a small request. The period is fixed (it existed before the token's first request and did not move after one), so token-window keepalive does not apply to Grok; xAI documents one weekly pool and no short rolling window.
|
|
49
|
+
|
|
50
|
+
Dashboard usage (`QgridFrame.usage`) calls the dispatcher's `refreshUsage`, which runs the same prefetch with billing included even when no quota threshold is set, and waits up to 3 seconds for it. Without this, a token that never routed a request since boot reported no usage. The 60-second lookup cache bounds the extra xAI calls.
|
|
51
|
+
|
|
48
52
|
D6 excludes accounts when `/settings.on_demand_enabled` is `true`; `null`, `false`, or absence allows routing. Billing does not carry this field. D7 selects eligible accounts through the shared `SmoothWeightedRoundRobin`, using `tokens.weight`; a valid cache-affinity token remains preferred. `QGRID_GROK_MAX_INFLIGHT_PER_TOKEN` optionally excludes accounts at the cap, while omission leaves Grok uncapped (`grok-quota.ts`, `grok-dispatcher.ts`, `packages/api/src/utils/providers/common/smooth-weighted-round-robin.ts`).
|
|
49
53
|
|
|
50
54
|
## Failure and failover rules
|
|
@@ -74,9 +78,11 @@ Provider `cost_in_usd_ticks` is authoritative, including zero; one tick is `1e-1
|
|
|
74
78
|
|
|
75
79
|
Qgrid exposes image generation/editing, asynchronous video start/status, transcription, and speech through `api.x.ai`. Reference images select `/images/edits`; video uses `/videos/generations` and `/videos/{request_id}`; voice uses multipart `/stt` and JSON `/tts` (`grok-media-client.ts`, `grok-voice-client.ts`, `packages/api/src/application/qgrid/qgrid.frame.ts`).
|
|
76
80
|
|
|
81
|
+
Chat turns also accept `imageGeneration` (the dashboard chat sends `"auto"`): the dispatcher adds the proxy's server-side `{ "type": "image_generation" }` tool, and completed `image_generation_call` items (base64 JPEG, Grok Imagine) become `GenerateResult.images`, so generation and edits of earlier images work inside a conversation. `imageGenerationOptions` (OpenAI quality/size/background) is rejected. The turn's provider-reported cost already includes the image, so the request log stores `image_cost_usd = 0` with `image_cost_method = "included:grok-provider-cost"`. Verified 2026-10-21 through the subscription proxy; the model occasionally answers "I'll do it" without calling the tool (1 of 5 edit attempts).
|
|
82
|
+
|
|
77
83
|
Inline audio, each inline image, and the aggregate inline images in one request are capped at 7 MiB decoded. The server maps Fastify's oversized-body error to HTTP 413 (`packages/api/src/application/qgrid/qgrid.types.ts`, `qgrid.frame.ts`).
|
|
78
84
|
|
|
79
|
-
Video starts return a random 128-bit in-memory job handle. Handles expire after 24 hours, polling stays pinned to the starting token, and `projectName` must match the owner supplied at start. D4 returns the upstream `api.x.ai` video URL unchanged; qgrid does not fetch, proxy, or store the bytes (`qgrid.frame.ts`, `grok-media-client.ts`, `packages/ai-sdk/README.md`).
|
|
85
|
+
Video starts return a random 128-bit in-memory job handle. Handles expire after 24 hours, polling stays pinned to the starting token, and `projectName` must match the owner supplied at start. A started job is already admitted and billed, so `getVideo` polls with `ungated: true`: it checks only credential state (inactive, reauth, refresh failure) and skips the quota-threshold, cooldown, in-flight, on-demand, and ZDR gates that admit new requests. After the upstream poll returns, `videoStatus` re-checks `job.final`, so overlapping polls of a finished job write the request log once and return the same result. D4 returns the upstream `api.x.ai` video URL unchanged; qgrid does not fetch, proxy, or store the bytes (`qgrid.frame.ts`, `grok-media-client.ts`, `packages/ai-sdk/README.md`).
|
|
80
86
|
|
|
81
87
|
**ZDR and video.** xAI refuses `POST /v1/videos/generations` for Zero Data Retention accounts with HTTP 400 `invalid_request`: "Zero Data Retention teams must provide output.upload_url for video generation." The dispatcher therefore keeps a per-token `zdr` state and excludes `zdr === true` tokens from video only; chat, image, STT, and TTS still route. The primary signal is `codingDataRetentionOptOut` on `GET /user?include=subscription`, re-read on the 60 s prefetch with settings; `x-zero-data-retention: true` on a chat-proxy response confirms it, but its absence never clears it. Unknown state, or a failed `/user` read with no prior value, routes (fail open). If a video start still gets the ZDR 400, the token is marked ZDR, video is entitlement-blocked for an hour, and the start fails over under the media rules. With no eligible video token the caller gets `GrokZdrVideoUnavailableError` (HTTP 503) naming the tokens; usage exposes `zdrVideoExcluded`. Both signals were inferred from one account (plan §11). grok-build's remedy, a user-owned S3 presigned `output.upload_url`, is not implemented (`grok-dispatcher.ts`, `grok-quota.ts`).
|
|
82
88
|
|
|
@@ -9,6 +9,8 @@ Use this map to orient qgrid work quickly.
|
|
|
9
9
|
- `packages/web`: dashboard UI. Usually depends on Sonamu-generated API clients and API model shape.
|
|
10
10
|
- `packages/cli`: global `qgrid` command, bundled server boot, dependency checks, DB preflight, and qgrid Codex/Claude Code skill sync. The CLI package ships `skills/qgrid` and its `postinstall` links it into consuming projects.
|
|
11
11
|
- `scripts` and `packages/api/scripts`: smoke tests, debug scripts, runtime probes.
|
|
12
|
+
- `tools/oxlint/anti-slop`: vendored anti-slop oxlint JS plugin, loaded from `.oxlintrc.json` and enforced by `mise run check`. `@oxlint/plugins` must match the installed `oxlint` version.
|
|
13
|
+
- Toolchain: Sonamu 0.13 (CLI in `@sonamu-kit/cli`, Fastify 5) and its required TypeScript `7.1.0-dev.20260831.1` in the root, api, cli, and web packages. `packages/ai-sdk` uses TypeScript 6.0.2 from the `ts-node-compat` named catalog (synced from Sonamu) because tsdown needs the TypeScript JS API to emit its `.d.ts`; `packages/cli` disables dts because it ships only a binary. Web `tsconfig.json` is a references-only solution file pointing at `tsconfig.app.json`, because Sonamu's web typecheck runs each project reference.
|
|
12
14
|
- `docs`: local planning, diagnosis, and solution history. `docs/WORKFLOW.md` is the collaboration convention.
|
|
13
15
|
|
|
14
16
|
## Deprecated/context-only package
|
|
@@ -31,6 +31,8 @@ A tool-result follow-up carries the returned `runContext` and tool results. The
|
|
|
31
31
|
|
|
32
32
|
Errors and client aborts finish the same parent as `error` or `aborted` and roll up usage, cost, fallback count, and cost provenance from every generate step that completed before termination. SSE client closure is authoritative regardless of the provider's abort error text; if a provider result arrives after closure, record its step usage and then leave the parent `aborted` without publishing `done`.
|
|
33
33
|
|
|
34
|
+
While the provider runs, dispatchers report facts as soon as they are known through `GenerateRequest.onProgress`, and `runProgressRecorder` writes them onto the parent only while it is still `running` (`RequestLogModel.recordRunProgress`): `token_name` after token selection (again on failover), `model_name` when the provider names the serving model (Grok `response.created`; Anthropic records the requested model at selection; OpenAI reports its model only at completion), and `ttft_ms` at the first delta of the run's first step. Writes are ordered and best-effort: a failure only logs. Usage, tokens, cost, and duration arrive with the final usage and stay at their defaults until then. The dashboard shows running rows with the requested → serving model and a running badge, and the list and detail pages poll every 3 seconds while a run is in progress.
|
|
35
|
+
|
|
34
36
|
Creating the initial `running` row is a precondition for a logger-enabled provider call. Once the provider has succeeded, however, a failure while appending or finalizing logs is best-effort: report the logging error and preserve the generated text/stream result instead of making logging failure replace a successful model result.
|
|
35
37
|
|
|
36
38
|
Stale cleanup must target old runs that still have unresolved tool-call steps; a long provider request with no pending tool call is not stale merely because its parent row is still running. Cleanup and arriving tool follow-ups share a PostgreSQL transaction advisory lock per request-log id and recheck the unresolved step after acquiring it, so cleanup cannot overwrite an in-flight follow-up across server processes.
|
|
@@ -128,11 +130,14 @@ TTFT is tracked by wrapping the first provider delta:
|
|
|
128
130
|
|
|
129
131
|
- OpenAI: first `response.output_text.delta` from the direct Responses stream.
|
|
130
132
|
- Anthropic: first text or structured partial JSON delta.
|
|
133
|
+
- Grok: first text delta of the chat attempt.
|
|
134
|
+
|
|
135
|
+
The same first-delta value is reported as run progress, so a running row shows TTFT before the response completes; the final value replaces it.
|
|
131
136
|
|
|
132
137
|
If missing, qgrid maps TTFT to `0` in `QueryOutput` and nullable/optional places as appropriate.
|
|
133
138
|
|
|
134
139
|
## Logger integration
|
|
135
140
|
|
|
136
|
-
`packages/ai-sdk/src/logger.ts` lets non-qgrid providers write logs into qgrid through the public lifecycle endpoints. It skips model provider `qgrid` to avoid double logging and skips any generation with `providerOptions.qgrid.logger: false`. Therefore one disabled generation produces neither native qgrid logs nor `createQgridLogger` telemetry logs. Preserve its stale-run fallback
|
|
141
|
+
`packages/ai-sdk/src/logger.ts` lets non-qgrid providers write logs into qgrid through the public lifecycle endpoints. It skips model provider `qgrid` to avoid double logging and skips any generation with `providerOptions.qgrid.logger: false`. Therefore one disabled generation produces neither native qgrid logs nor `createQgridLogger` telemetry logs. Each run is keyed by the AI SDK 7 telemetry `callId` and finishes on exactly one of `onEnd`, `onError`, or `onAbort`. Preserve its stale-run fallback for generations that start but never report a terminal event, such as an unconsumed stream.
|
|
137
142
|
|
|
138
143
|
External structured output is detected from AI SDK telemetry's `output.responseFormat`, before provider-specific request projection. The logger sends optional `isStructured` and serialized `jsonSchema` fields on `createRun`; the server stores them in the existing `is_structured` and `json_schema` columns. On a succeeded structured run, `finishRun` may also carry `responseJsonOk`, which records JSON parseability only. Omitted fields retain the legacy unstructured defaults, and the native qgrid provider continues to own its existing server-side lifecycle without telemetry duplication.
|
|
@@ -34,9 +34,9 @@ that the client has not produced yet. Drain the upstream response to preserve us
|
|
|
34
34
|
errors, and cancellation. Never split concatenated JSON inside a single message or
|
|
35
35
|
recover malformed envelopes. Ordinary text requests keep their existing aggregation.
|
|
36
36
|
|
|
37
|
-
`generateText` and `streamText` default to `
|
|
37
|
+
`generateText` and `streamText` default to `isStepCount(1)`. When an executable
|
|
38
38
|
tool can run before the final answer, callers must set a bounded `stopWhen`
|
|
39
|
-
(for example `
|
|
39
|
+
(for example `isStepCount(3)`) or the AI SDK stops after the first tool-call
|
|
40
40
|
step and cannot produce the final text or `Output.object` value.
|
|
41
41
|
|
|
42
42
|
Do not describe this as OpenAI native function calling, Claude native tool use, or Codex/Claude executing client tools. The tools are client-side AI SDK tools requested through structured-output emulation.
|
|
@@ -23,7 +23,7 @@ project, use that project's configured task and tool runner.
|
|
|
23
23
|
|
|
24
24
|
Root:
|
|
25
25
|
|
|
26
|
-
- `mise run check`: qgrid docs consistency, oxlint, and oxfmt check for the repo.
|
|
26
|
+
- `mise run check`: qgrid docs consistency, oxlint (including the vendored anti-slop rules in `tools/oxlint/anti-slop`, loaded by `.oxlintrc.json`), and oxfmt check for the repo. `mise run format` applies the auto-fixable rules, such as the blank-line spacing rule.
|
|
27
27
|
- `mise run test`: DB-free API tests, SDK tests, and CLI packaging tests. No provider credentials are needed; the OAuth relay test opens a local loopback listener.
|
|
28
28
|
- `mise run build`: recursive package build.
|
|
29
29
|
- `mise run dev`: parallel package dev servers.
|
|
@@ -35,8 +35,15 @@ API package `qgrid-api`:
|
|
|
35
35
|
- `mise exec -- pnpm --filter qgrid-api test`: both suites, unit first.
|
|
36
36
|
- `mise exec -- pnpm --filter qgrid-api test:watch`: DB-free watch mode; use `test:db --watch` for DB tests.
|
|
37
37
|
- `mise exec -- pnpm --filter qgrid-api test:coverage`: both suites, with separate `coverage/unit` and `coverage/db` reports.
|
|
38
|
-
- `mise exec -- pnpm --filter qgrid-api build`: Sonamu build.
|
|
39
|
-
- `mise exec -- pnpm --filter qgrid-api sonamu`: run Sonamu CLI.
|
|
38
|
+
- `mise exec -- pnpm --filter qgrid-api build`: Sonamu build, run as `NODE_ENV=production sonamu build`. Sonamu 0.11 sets `NODE_ENV=development` when it is unset and the web `vite build` child inherits it, which produced a development-mode dashboard bundle in 2.11.0 (SON-567). Keep the explicit `NODE_ENV` until Sonamu fixes it.
|
|
39
|
+
- `mise exec -- pnpm --filter qgrid-api sonamu`: run Sonamu CLI. Since Sonamu 0.11 the `sonamu` binary comes from the `@sonamu-kit/cli` devDependency, not from `sonamu` itself.
|
|
40
|
+
|
|
41
|
+
Sonamu sync after changing models, types, entities, or i18n:
|
|
42
|
+
|
|
43
|
+
1. Build first (`mise run build` or `sonamu build api`). `sonamu sync` reads models from `dist`, so a stale `dist` silently drops newer `@api` methods from generated services, queries, validators, and `.http` (SON-566).
|
|
44
|
+
2. Run `HOT=yes mise exec -- pnpm --dir packages/api sonamu sync`. `HOT=yes` loads `src/sonamu.config.ts`; without it Sonamu needs `dist/sonamu.config.js`, which a failed build deletes. Add `--force` only when `sonamu.lock` cannot be trusted, for example right after a merge.
|
|
45
|
+
3. `sync --force` always prints the "자동 생성한 파일에 대한 변경이 감지되었습니다" drift warning for generated files, even when nothing drifted (SON-565). Re-run plain `sync`; it should print `All files are synced!`.
|
|
46
|
+
4. Sonamu lints generated code with type-aware autofix in a temp file at the API root, where relative imports do not resolve. That fix strips the required `as unknown as SDReturnType<K>` casts from `sd.generated.ts` (SON-564). The `.oxlintrc.json` override for `**/.sonamu-oxlint-*.ts` turns that rule off; keep it until Sonamu fixes the temp-file location.
|
|
40
47
|
|
|
41
48
|
AI SDK package `@cartanova/qgrid-ai-sdk`:
|
|
42
49
|
|
|
@@ -154,7 +161,19 @@ Other scripts under `scripts/smoke-test-*` and `scripts/debug-*` are ad hoc prob
|
|
|
154
161
|
Generated SSE handlers missing a newly added event field:
|
|
155
162
|
|
|
156
163
|
- Sonamu's service generator reads runtime stream-decorator schemas. A stale API `dist` can keep the old event shape even with `sonamu sync --force`.
|
|
157
|
-
- Run `mise exec -- pnpm --dir packages/api sonamu build api`, then `mise exec -- pnpm --dir packages/api sonamu sync --force`. Check the generated handler type and web typecheck; do not hand-edit generated services.
|
|
164
|
+
- Run `mise exec -- pnpm --dir packages/api sonamu build api`, then `HOT=yes mise exec -- pnpm --dir packages/api sonamu sync --force`. Check the generated handler type and web typecheck; do not hand-edit generated services.
|
|
165
|
+
|
|
166
|
+
Dashboard throws `Module "" has been externalized for browser compatibility. Cannot access ".custom"` on load:
|
|
167
|
+
|
|
168
|
+
- The web bundle was built in development mode. `qs` → `side-channel` → `object-inspect` reads `require("./util.inspect").custom`; its `browser` field maps that file to `false`, which Vite turns into a throwing proxy outside production. Rebuild with `NODE_ENV=production` (the API `build` script sets it). A correct client bundle has no "externalized for browser compatibility" string.
|
|
169
|
+
|
|
170
|
+
`Missing Sonamu dotenv file`:
|
|
171
|
+
|
|
172
|
+
- Sonamu 0.11 refuses to start, including `sonamu build`, unless `packages/api/.env` or `.env.<NODE_ENV>` exists. The contents may be empty. CI creates an empty `packages/api/.env` before `mise run build`.
|
|
173
|
+
|
|
174
|
+
`sd.generated.ts` fails `tsc` with `Partial<MergedDictionary>[K] & {}` not assignable to `SDReturnType<K>`:
|
|
175
|
+
|
|
176
|
+
- The generated casts were stripped by Sonamu's post-generation lint (SON-564). Confirm the `.oxlintrc.json` override is present and re-run `HOT=yes ... sonamu sync --force`.
|
|
158
177
|
|
|
159
178
|
`NO_OPENAI_WORKERS`:
|
|
160
179
|
|
|
@@ -204,7 +223,7 @@ Generated SSE handlers missing a newly added event field:
|
|
|
204
223
|
|
|
205
224
|
`unsupported` warning with `feature: "image input"`:
|
|
206
225
|
|
|
207
|
-
- The language adapter dropped image parts: all of them on `anthropic/` models, and assistant-message images on any model. User-message images on `openai/` models are sent as image input. Reference-image editing belongs in `generateImage`'s `prompt: { text, images }`.
|
|
226
|
+
- The language adapter dropped image parts: all of them on `anthropic/` models, and assistant-message images on any model. User-message images on `openai/` and `grok/` models are sent as image input; `grok/` also drops `http:` URLs. Reference-image editing belongs in `generateImage`'s `prompt: { text, images }`.
|
|
208
227
|
|
|
209
228
|
`image generation is not supported on the Anthropic route`:
|
|
210
229
|
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=1e6,t=4;function n(t){return t/e}function r(e){return`$${e.toFixed(t)}`}function i(e){return r(n(e))}function a(e){return e.cost_usd===null&&e.image_cost_usd===null?`—`:r(n((e.cost_usd??0)+(e.image_cost_usd??0)))}function o(e){return e.input_tokens<=0?`—`:`${Math.round(e.cache_read_tokens/e.input_tokens*100)}%`}export{r as i,i as n,a as r,o as t};
|