@glasser-ai/cli 0.1.41 → 0.1.42

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.
Files changed (2) hide show
  1. package/dist/glasser.js +18 -2
  2. package/package.json +1 -1
package/dist/glasser.js CHANGED
@@ -64303,7 +64303,13 @@ var ERROR_STATUS = {
64303
64303
  var CurrentAuth = class extends Context_exports.Service()("CurrentAuth") {
64304
64304
  };
64305
64305
  var Authentication = class extends HttpApiMiddleware_exports.Service()("Authentication", {
64306
- error: ERROR_WIRE.Unauthorized,
64306
+ // 两种拒绝,调用方的正确反应不同:
64307
+ // 401 unauthorized —— Key 不对(格式、hash 查不到、已吊销),换一把 Key。
64308
+ // 403 forbidden —— Key 对,但它的 Workspace 或创建它的 User 处于 Suspension
64309
+ // (`control: "workspace.suspended"` / `"user.suspended"`)。
64310
+ // 换 Key 没用,重试也没用,要找我们。
64311
+ // 用数组而不是 Schema.Union,理由同下面 SchemaErrors 的注释。
64312
+ error: [ERROR_WIRE.Unauthorized, ERROR_WIRE.Forbidden],
64307
64313
  security: { bearer: HttpApiSecurity_exports.bearer }
64308
64314
  }) {
64309
64315
  };
@@ -65522,6 +65528,14 @@ function pollUntilDone(options4) {
65522
65528
  message: "This authorization was already redeemed elsewhere. If that was not you, revoke the Key in the console; then run `glasser login` again."
65523
65529
  });
65524
65530
  }
65531
+ if (response.status === 403) {
65532
+ const refusal = yield* response.json.pipe(Effect_exports.catch(() => Effect_exports.succeed(null)));
65533
+ const message = refusal?.error?.message;
65534
+ return yield* new LoginFailed({
65535
+ code: "login_forbidden",
65536
+ message: typeof message === "string" ? message : "The server refused to create a Key for this sign-in."
65537
+ });
65538
+ }
65525
65539
  if (response.status !== 200) return null;
65526
65540
  const body = yield* decodeJson(PollResponse, response).pipe(
65527
65541
  Effect_exports.catch(() => Effect_exports.succeed(null))
@@ -66005,7 +66019,7 @@ var runs2 = Command_exports.make("runs").pipe(
66005
66019
  // package.json
66006
66020
  var package_default = {
66007
66021
  name: "@glasser-ai/cli",
66008
- version: "0.1.41",
66022
+ version: "0.1.42",
66009
66023
  description: "Search, inspect and run paid API endpoints with one Key \u2014 the Glasser CLI",
66010
66024
  license: "MIT",
66011
66025
  type: "module",
@@ -66160,6 +66174,7 @@ function renderJson(failure) {
66160
66174
  message: failure.message,
66161
66175
  // 只省略 undefined:null 是 API 明确说的"没有可退避的时长",要照传。
66162
66176
  ...failure.retryAfterMs === void 0 ? {} : { retry_after_ms: failure.retryAfterMs },
66177
+ ...failure.control === void 0 ? {} : { control: failure.control },
66163
66178
  ...failure.details === void 0 ? {} : { details: failure.details },
66164
66179
  ...failure.hint === void 0 ? {} : { hint: failure.hint }
66165
66180
  },
@@ -66227,6 +66242,7 @@ function describeApiCause(cause, requestId) {
66227
66242
  // 这里逐字段重建,信封上不搬过来的字段就丢了 —— API 的 429 消息说"看
66228
66243
  // retry_after_ms",数字必须跟着到达。
66229
66244
  ...envelope.retry_after_ms === void 0 ? {} : { retryAfterMs: envelope.retry_after_ms },
66245
+ ...typeof envelope.control === "string" ? { control: envelope.control } : {},
66230
66246
  ...envelope.details === void 0 ? {} : { details: envelope.details },
66231
66247
  ...hintFor(envelope),
66232
66248
  exitCode: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasser-ai/cli",
3
- "version": "0.1.41",
3
+ "version": "0.1.42",
4
4
  "description": "Search, inspect and run paid API endpoints with one Key \u2014 the Glasser CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",