@humain/humain-code 0.5.0 → 0.5.3

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 (120) hide show
  1. package/CHANGELOG.md +37 -1
  2. package/README.md +3 -1
  3. package/dist/agent-monitor/client.d.ts +2 -2
  4. package/dist/agent-monitor/client.d.ts.map +1 -1
  5. package/dist/agent-monitor/client.js +3 -2
  6. package/dist/agent-monitor/client.js.map +1 -1
  7. package/dist/bundle/chunks/anthropic.js +10 -9
  8. package/dist/bundle/chunks/{chunk-DR37WKFZ.js → chunk-AO6FF5JL.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-Q3SFYT2X.js → chunk-EY3LZOUP.js} +1356 -1358
  10. package/dist/bundle/chunks/{chunk-T3HXWZG4.js → chunk-L2VKM23Q.js} +76 -2
  11. package/dist/bundle/chunks/{chunk-5C4VL2AR.js → chunk-ODJUBJK2.js} +2 -2
  12. package/dist/bundle/chunks/{chunk-A6YBWW4T.js → chunk-UJLCKIMZ.js} +646 -495
  13. package/dist/bundle/chunks/{chunk-476XBL3W.js → chunk-Y3OPKKDR.js} +3 -77
  14. package/dist/bundle/chunks/{cli-VXU7OWFU.js → cli-ENEFJH2B.js} +1 -1
  15. package/dist/bundle/chunks/{compat-S2IBVV6V.js → compat-CJBWWYHE.js} +1 -1
  16. package/dist/bundle/chunks/{dist-645GFIWH.js → dist-RKNCFFGM.js} +2 -2
  17. package/dist/bundle/chunks/github-copilot.js +28 -26
  18. package/dist/bundle/chunks/openai-chatgpt.js +2 -2
  19. package/dist/bundle/chunks/openai-codex.js +10 -9
  20. package/dist/bundle/chunks/openrouter.js +10 -9
  21. package/dist/bundle/chunks/radius.js +9 -8
  22. package/dist/bundle/chunks/{runtime-5VFZTMWL.js → runtime-K3F2QDQP.js} +1 -1
  23. package/dist/bundle/chunks/{virtual-modules-GU6AW5ZK.js → virtual-modules-5D6QIJPN.js} +2 -2
  24. package/dist/bundle/cli-runtime.js +1 -1
  25. package/dist/bundle/index.js +4 -4
  26. package/dist/bundle/rpc-entry.js +1 -1
  27. package/dist/core/model-resolver.d.ts.map +1 -1
  28. package/dist/core/model-resolver.js +19 -1
  29. package/dist/core/model-resolver.js.map +1 -1
  30. package/dist/core/model-runtime.d.ts.map +1 -1
  31. package/dist/core/model-runtime.js +24 -2
  32. package/dist/core/model-runtime.js.map +1 -1
  33. package/dist/core/safe-credential-error.d.ts +11 -0
  34. package/dist/core/safe-credential-error.d.ts.map +1 -0
  35. package/dist/core/safe-credential-error.js +14 -0
  36. package/dist/core/safe-credential-error.js.map +1 -0
  37. package/dist/core/sdk.d.ts.map +1 -1
  38. package/dist/core/sdk.js +4 -1
  39. package/dist/core/sdk.js.map +1 -1
  40. package/dist/core/settings-schema.d.ts +3 -0
  41. package/dist/core/settings-schema.d.ts.map +1 -1
  42. package/dist/core/settings-schema.js +6 -0
  43. package/dist/core/settings-schema.js.map +1 -1
  44. package/dist/humain/gateway/catalog.d.ts +36 -0
  45. package/dist/humain/gateway/catalog.d.ts.map +1 -0
  46. package/dist/humain/gateway/catalog.js +74 -0
  47. package/dist/humain/gateway/catalog.js.map +1 -0
  48. package/dist/humain/gateway/client.d.ts +58 -0
  49. package/dist/humain/gateway/client.d.ts.map +1 -0
  50. package/dist/humain/gateway/client.js +212 -0
  51. package/dist/humain/gateway/client.js.map +1 -0
  52. package/dist/humain/gateway/constants.d.ts +23 -0
  53. package/dist/humain/gateway/constants.d.ts.map +1 -0
  54. package/dist/humain/gateway/constants.js +32 -0
  55. package/dist/humain/gateway/constants.js.map +1 -0
  56. package/dist/humain/gateway/http.d.ts +18 -0
  57. package/dist/humain/gateway/http.d.ts.map +1 -0
  58. package/dist/humain/gateway/http.js +274 -0
  59. package/dist/humain/gateway/http.js.map +1 -0
  60. package/dist/humain/gateway/login.d.ts +13 -0
  61. package/dist/humain/gateway/login.d.ts.map +1 -0
  62. package/dist/humain/gateway/login.js +121 -0
  63. package/dist/humain/gateway/login.js.map +1 -0
  64. package/dist/humain/gateway/provider.d.ts +34 -0
  65. package/dist/humain/gateway/provider.d.ts.map +1 -0
  66. package/dist/humain/gateway/provider.js +253 -0
  67. package/dist/humain/gateway/provider.js.map +1 -0
  68. package/dist/humain/gateway/secret-store.d.ts +19 -0
  69. package/dist/humain/gateway/secret-store.d.ts.map +1 -0
  70. package/dist/humain/gateway/secret-store.js +252 -0
  71. package/dist/humain/gateway/secret-store.js.map +1 -0
  72. package/dist/humain/gateway/session-store.d.ts +42 -0
  73. package/dist/humain/gateway/session-store.d.ts.map +1 -0
  74. package/dist/humain/gateway/session-store.js +175 -0
  75. package/dist/humain/gateway/session-store.js.map +1 -0
  76. package/dist/humain/index.d.ts.map +1 -1
  77. package/dist/humain/index.js +2 -0
  78. package/dist/humain/index.js.map +1 -1
  79. package/dist/humain/login-menu.d.ts +14 -0
  80. package/dist/humain/login-menu.d.ts.map +1 -0
  81. package/dist/humain/login-menu.js +21 -0
  82. package/dist/humain/login-menu.js.map +1 -0
  83. package/dist/humain/node-http.d.ts.map +1 -1
  84. package/dist/humain/node-http.js +6 -31
  85. package/dist/humain/node-http.js.map +1 -1
  86. package/dist/humain/redact-assistant-message.d.ts +4 -0
  87. package/dist/humain/redact-assistant-message.d.ts.map +1 -0
  88. package/dist/humain/redact-assistant-message.js +34 -0
  89. package/dist/humain/redact-assistant-message.js.map +1 -0
  90. package/dist/main.d.ts.map +1 -1
  91. package/dist/main.js +17 -4
  92. package/dist/main.js.map +1 -1
  93. package/dist/modes/interactive/components/login-dialog.d.ts +1 -1
  94. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  95. package/dist/modes/interactive/components/login-dialog.js +3 -2
  96. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  97. package/dist/modes/interactive/components/model-selector.d.ts +11 -0
  98. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  99. package/dist/modes/interactive/components/model-selector.js +16 -3
  100. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  101. package/dist/modes/interactive/components/radius-login-selector.d.ts +5 -4
  102. package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -1
  103. package/dist/modes/interactive/components/radius-login-selector.js +11 -9
  104. package/dist/modes/interactive/components/radius-login-selector.js.map +1 -1
  105. package/dist/modes/interactive/interactive-mode.d.ts +2 -0
  106. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  107. package/dist/modes/interactive/interactive-mode.js +53 -36
  108. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  109. package/dist/utils/sleep.d.ts +1 -1
  110. package/dist/utils/sleep.d.ts.map +1 -1
  111. package/dist/utils/sleep.js +10 -6
  112. package/dist/utils/sleep.js.map +1 -1
  113. package/docs/humain-code.md +13 -1
  114. package/docs/index.md +1 -1
  115. package/docs/models.md +3 -1
  116. package/docs/providers.md +58 -2
  117. package/docs/quickstart.md +8 -1
  118. package/npm-shrinkwrap.json +2 -2
  119. package/package.json +1 -1
  120. package/schemas/settings.schema.json +19 -0
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Sleep helper that respects abort signal.
2
+ * Sleep helper that respects abort signal. Rejects with the signal's abort reason.
3
3
  */
4
4
  export declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
5
5
  //# sourceMappingURL=sleep.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../src/utils/sleep.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAcrE"}
1
+ {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../src/utils/sleep.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBrE"}
@@ -1,17 +1,21 @@
1
1
  /**
2
- * Sleep helper that respects abort signal.
2
+ * Sleep helper that respects abort signal. Rejects with the signal's abort reason.
3
3
  */
4
4
  export function sleep(ms, signal) {
5
5
  return new Promise((resolve, reject) => {
6
6
  if (signal?.aborted) {
7
- reject(new Error("Aborted"));
7
+ reject(signal.reason ?? new Error("Aborted"));
8
8
  return;
9
9
  }
10
- const timeout = setTimeout(resolve, ms);
11
- signal?.addEventListener("abort", () => {
10
+ const abort = () => {
12
11
  clearTimeout(timeout);
13
- reject(new Error("Aborted"));
14
- });
12
+ reject(signal?.reason ?? new Error("Aborted"));
13
+ };
14
+ const timeout = setTimeout(() => {
15
+ signal?.removeEventListener("abort", abort);
16
+ resolve();
17
+ }, ms);
18
+ signal?.addEventListener("abort", abort, { once: true });
15
19
  });
16
20
  }
17
21
  //# sourceMappingURL=sleep.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../src/utils/sleep.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,KAAK,CAAC,EAAU,EAAE,MAAoB;IACrD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YACrB,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;YAC7B,OAAO;QACR,CAAC;QAED,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAExC,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;YACtC,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Sleep helper that respects abort signal.\n */\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tif (signal?.aborted) {\n\t\t\treject(new Error(\"Aborted\"));\n\t\t\treturn;\n\t\t}\n\n\t\tconst timeout = setTimeout(resolve, ms);\n\n\t\tsignal?.addEventListener(\"abort\", () => {\n\t\t\tclearTimeout(timeout);\n\t\t\treject(new Error(\"Aborted\"));\n\t\t});\n\t});\n}\n"]}
1
+ {"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../src/utils/sleep.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,KAAK,CAAC,EAAU,EAAE,MAAoB;IACrD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YACrB,MAAM,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;YAC9C,OAAO;QACR,CAAC;QACD,MAAM,KAAK,GAAG,GAAG,EAAE;YAClB,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAChD,CAAC,CAAC;QACF,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAC/B,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC5C,OAAO,EAAE,CAAC;QACX,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Sleep helper that respects abort signal. Rejects with the signal's abort reason.\n */\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tif (signal?.aborted) {\n\t\t\treject(signal.reason ?? new Error(\"Aborted\"));\n\t\t\treturn;\n\t\t}\n\t\tconst abort = () => {\n\t\t\tclearTimeout(timeout);\n\t\t\treject(signal?.reason ?? new Error(\"Aborted\"));\n\t\t};\n\t\tconst timeout = setTimeout(() => {\n\t\t\tsignal?.removeEventListener(\"abort\", abort);\n\t\t\tresolve();\n\t\t}, ms);\n\t\tsignal?.addEventListener(\"abort\", abort, { once: true });\n\t});\n}\n"]}
@@ -83,10 +83,22 @@ Sending `normal mode` as the whole message disables all three for the session. A
83
83
 
84
84
  ## HUMAIN Node
85
85
 
86
- Use `/login humain-node` to enter a masked API key and optional base URL (default `https://api.node.humain.com/v1`). Alternatively, set `HUMAIN_NODE_API_KEY` and optionally `HUMAIN_NODE_BASE_URL` in your environment.
86
+ Use `/login humain-node` (or **Sign in with HUMAIN** → **HUMAIN Node** in `/login`) to enter a masked API key and optional base URL (default `https://api.node.humain.com/v1`). Alternatively, set `HUMAIN_NODE_API_KEY` and optionally `HUMAIN_NODE_BASE_URL` in your environment.
87
87
 
88
88
  HUMAIN Code CLI discovers the models available to that key before offering them in `/model`. Supported models use Node's Responses, Chat Completions, or Messages endpoint with normal streaming, tools, and reported token usage. Account spend, remaining quota, and pricing are not available from the supplied inference API. See [HUMAIN Node setup](providers.md#humain-node).
89
89
 
90
+ ## HUMAIN Gateway
91
+
92
+ [HUMAIN Gateway](https://gateway.humain.services) gives HUMAIN accounts access to approved models under per-user budgets and limits. HUMAIN Code CLI connects to it natively: no API key and no separate Gateway CLI.
93
+
94
+ Run `/login`, choose **Sign in with HUMAIN**, then **HUMAIN Gateway**. Sign-in opens Microsoft in your browser and returns to the terminal on its own. Over SSH, open the paste-code link instead and paste the one-time code into the masked prompt. Then use `/model` to choose one of the chat models your account is entitled to. `/accounts` shows the signed-in environment and email; `/logout` removes the session.
95
+
96
+ - The session token is stored only in the OS keychain: macOS Keychain, Linux Secret Service, or Windows Credential Manager. Sign-in fails with a clear message when no keychain is available; there is no plaintext fallback. CI and unattended use are not supported.
97
+ - Requests go only to the Gateway, which applies your budget, rate limits, and content checks. Failed requests are never resent automatically once a model may have accepted them.
98
+ - Models blocked for HUMAIN Code by the Gateway are hidden, with the reason shown. Cost shows 0 when the Gateway does not report it; that means unknown, not free.
99
+
100
+ HUMAIN Code CLI uses the production Gateway by default. Internal testers can switch to staging with `"humainGateway": { "environment": "staging" }` in `~/.humain-terminal/agent/settings.json`; project settings cannot change the environment. See [HUMAIN Gateway setup](providers.md#humain-gateway) for step-by-step instructions, print mode, and troubleshooting, and the [staging guide](../../../docs/humain-gateway-staging.md) for internal testers.
101
+
90
102
  ## Local Models
91
103
 
92
104
  Set `HUMAIN_TERMINAL_LOCAL_BASE_URL` to an OpenAI-compatible `/v1` endpoint. Models come from `HUMAIN_TERMINAL_LOCAL_MODELS` when set, otherwise HUMAIN Code CLI performs a bounded `/v1/models` discovery request.
package/docs/index.md CHANGED
@@ -40,7 +40,7 @@ HUMAIN Code CLI's tools and extensions run with the permissions of the HUMAIN Co
40
40
 
41
41
  ## HUMAIN Code CLI integrations
42
42
 
43
- - [HUMAIN Code CLI](humain-code.md) - branded command names, bundled web access/MCP integration, HUMAIN Node, and Forge/DeployNow setup.
43
+ - [HUMAIN Code CLI](humain-code.md) - branded command names, bundled web access/MCP integration, HUMAIN Gateway, HUMAIN Node, and Forge/DeployNow setup.
44
44
  - [Run Flow](flow.md) - hierarchical Flow runs with `/flow`, run controls, and limits.
45
45
  - [Configure Flow Profiles](flow-profiles.md) - Flow profile models, limits, and spend caps.
46
46
  - [Agent activity traces](trace.md) - proposal: record, upload and review what an agent did during a run.
package/docs/models.md CHANGED
@@ -6,6 +6,8 @@ For a built-in provider, start with `/login`, then choose a model with `/model`.
6
6
 
7
7
  | What you have | Recommended setup |
8
8
  |---|---|
9
+ | A HUMAIN account | `/login` → **Sign in with HUMAIN** → **HUMAIN Gateway** (Microsoft sign-in, no API key) |
10
+ | A HUMAIN Node API key | `/login` → **Sign in with HUMAIN** → **HUMAIN Node**, or set `HUMAIN_NODE_API_KEY` |
9
11
  | A supported subscription | Sign in through `/login` |
10
12
  | A provider API key | Store it through `/login` or set its environment variable |
11
13
  | A local GGUF model | Connect HUMAIN Code CLI to the llama.cpp router |
@@ -26,7 +28,7 @@ Keep `auth.json` and any credential commands private. Project settings and exten
26
28
 
27
29
  ## Select a model
28
30
 
29
- Run `/model` to search available models. The picker shows models whose providers have usable authentication. Press `Ctrl+S` on a model to save it as the default for new sessions.
31
+ Run `/model` to search available models. The picker shows models whose providers have usable authentication. Press Enter to use a model for the current session, or `Ctrl+S` to also save it as the default for new sessions.
30
32
 
31
33
  Run `/thinking` to select the thinking level for the current model. Press `Ctrl+S` there to save the startup level. HUMAIN Code CLI limits the choices to levels supported by the selected model.
32
34
 
package/docs/providers.md CHANGED
@@ -118,7 +118,7 @@ A stored API-key credential can include an `env` object. Its values take priorit
118
118
 
119
119
  Radius is a service crafted for Pi by the builders of Pi, Earendil Works. It provides a customizable AI gateway with organization-level controls and analytics built in, and artifacts for sharing what you create with Pi.
120
120
 
121
- To get started, run `/login radius` in Pi. This adds Radius as a provider, and its models appear in `/model` like any other provider's.
121
+ To get started, run `/login radius` in Pi. This adds Radius as a provider, and its models appear in `/model` like any other provider's. HUMAIN Code CLI does not list Radius in the top-level `/login` menu; `/login radius` and the **Sign in with an account** list still reach it.
122
122
 
123
123
  Radius also has an MCP server, so Pi can manage Radius for you.
124
124
 
@@ -261,9 +261,65 @@ gcloud auth application-default login
261
261
 
262
262
  To use a service-account key file instead, set `GOOGLE_APPLICATION_CREDENTIALS` along with the project and location.
263
263
 
264
+ ## HUMAIN Gateway
265
+
266
+ [HUMAIN Gateway](https://gateway.humain.services) gives HUMAIN accounts the models, budget, and limits assigned to them. HUMAIN Code CLI signs in with your Microsoft account; there is no API key to create, paste, or store, and you do not need the separate `humain` Gateway CLI.
267
+
268
+ ### 1. Environment
269
+
270
+ HUMAIN Code CLI uses the production Gateway (`https://gateway.humain.services/ai-gateway`) by default; no setting is needed. Internal testers can switch to staging in `~/.humain-terminal/agent/settings.json` (global settings only; project settings are ignored) and restart HUMAIN Code CLI:
271
+
272
+ ```json
273
+ { "humainGateway": { "environment": "staging" } }
274
+ ```
275
+
276
+ Both Gateway hosts are reachable only from the HUMAIN corporate network.
277
+
278
+ ### 2. Sign in
279
+
280
+ 1. Run `/login`.
281
+ 2. Choose **Sign in with HUMAIN**, then **HUMAIN Gateway**. (It is also listed under **Sign in with an API key**, because its session is a per-user key, even though you never handle it.)
282
+ 3. Your browser opens the Gateway's Microsoft sign-in. Sign in; the page shows **Authentication successful** and the terminal continues on its own.
283
+
284
+ Over SSH or on a machine whose browser cannot reach the terminal, open the **HUMAIN Gateway sign-in (paste code)** link shown in the terminal on any machine, sign in, and paste the one-time `hc_...` code into the masked prompt. The code expires after 2 minutes and works once.
285
+
286
+ The Gateway issues a personal session key, which HUMAIN Code CLI stores in the OS keychain: macOS Keychain, Linux Secret Service (needs a D-Bus session and `secret-tool`), or Windows Credential Manager. `auth.json` keeps only the environment, a session ID, and your email. Sign-in stops with a clear message when no keychain is available.
287
+
288
+ ### 3. Choose a model
289
+
290
+ Run `/model` and pick a `humain-gateway` model. Only chat models your account is entitled to appear; models the Gateway blocks for HUMAIN Code are hidden and named in a warning with the reason. Press `Ctrl+S` on a model to make it the default for new sessions.
291
+
292
+ For print mode, sign in interactively once, then pass the provider and model:
293
+
294
+ ```bash
295
+ humain-code --list-models | grep humain-gateway
296
+ humain-code --provider humain-gateway --model zai-org/GLM-5.3-Flash -p "Say hello"
297
+ ```
298
+
299
+ CI and unattended runs are not supported: every session needs an interactive Microsoft sign-in, and the key never comes from an environment variable.
300
+
301
+ ### Accounts, logout, and limits
302
+
303
+ - `/accounts` shows the HUMAIN Gateway session with its environment and email.
304
+ - `/logout` → **HUMAIN Gateway** removes the local session. The Gateway revokes it on the next interactive start or the next sign-in.
305
+ - Signing in again replaces the session; the old one is revoked automatically afterwards.
306
+ - Your monthly budget and request limits apply. A used-up budget shows the Gateway's budget message and is not retried. Rate limits and "no deployments available" are retried at most three times after the Gateway's suggested delay; other failures are never resent, so a request is not billed twice.
307
+ - Cost shows 0 when the Gateway does not report it; that means unknown, not free.
308
+ - `models.json` entries for `humain-gateway` are ignored; requests always go to the Gateway host for the selected environment.
309
+
310
+ ### Troubleshooting
311
+
312
+ | Message | Fix |
313
+ | --- | --- |
314
+ | `Could not reach HUMAIN Gateway to finish sign-in.` / browser shows `ERR_CONNECTION_CLOSED` | Connect to the HUMAIN corporate network. Staging may require separate access from the Gateway team. |
315
+ | `HUMAIN Gateway sign-in code is invalid or expired.` | Run `/login` again; codes last 2 minutes and work once. |
316
+ | `HUMAIN Gateway requires a newer HUMAIN Code CLI.` | Update HUMAIN Code CLI, then sign in again. |
317
+ | Keychain or Secret Service error | Unlock the keychain, or on Linux start a desktop session with Secret Service. |
318
+ | `HUMAIN Gateway CLI session unavailable. Sign in again.` | Your access was revoked or rotated; run `/login` again. |
319
+
264
320
  ## HUMAIN Node
265
321
 
266
- Run `/login humain-node` (or select **HUMAIN Node** in `/login`). Enter the API key in the masked terminal prompt, then accept `https://api.node.humain.com/v1` or enter a custom base URL. Login validates the key with `GET /models` using the `x-api-key` header before saving credentials.
322
+ Run `/login humain-node`, or choose **Sign in with HUMAIN** → **HUMAIN Node** in `/login`. Enter the API key in the masked terminal prompt, then accept `https://api.node.humain.com/v1` or enter a custom base URL. Login validates the key with `GET /models` using the `x-api-key` header before saving credentials.
267
323
 
268
324
  To obtain a key, open your Team's **Users** page in HUMAIN Node, select the user for this workload and environment, and create an API key. Save it in your local environment as `HUMAIN_NODE_API_KEY` or in a secret manager. Never paste it into chat. If the environment variable is set, leave the login key prompt blank to use it without copying the key into `auth.json`.
269
325
 
@@ -47,7 +47,14 @@ In HUMAIN Code CLI, run:
47
47
  /login
48
48
  ```
49
49
 
50
- Choose a provider, then follow the prompts to use a subscription or store an API key. Run `/model` afterward if you want to select a different available model.
50
+ With a HUMAIN account, choose **Sign in with HUMAIN**, then:
51
+
52
+ - **HUMAIN Gateway** to sign in with your Microsoft account in the browser (no API key), or
53
+ - **HUMAIN Node** to paste an API key from your HUMAIN Node team's **Users** page.
54
+
55
+ Otherwise choose **Sign in with an account** for a subscription, or **Sign in with an API key** for another provider, and follow the prompts.
56
+
57
+ Run `/model` afterward to choose a model: **Enter** uses it for this session, and **Ctrl+S** saves it as your default for new sessions. See [HUMAIN Gateway](providers.md#humain-gateway) and [HUMAIN Node](providers.md#humain-node) for details.
51
58
 
52
59
  See [Choose a model and provider](models.md) for supported providers, environment-variable authentication, local models, and custom endpoints.
53
60
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@humain/humain-code",
3
- "version": "0.5.0",
3
+ "version": "0.5.3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@humain/humain-code",
9
- "version": "0.5.0",
9
+ "version": "0.5.3",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@humain/humain-code-contracts": "0.4.19",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humain/humain-code",
3
- "version": "0.5.0",
3
+ "version": "0.5.3",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "humainTerminalConfig": {
@@ -243,6 +243,25 @@
243
243
  }
244
244
  }
245
245
  },
246
+ "humainGateway": {
247
+ "type": "object",
248
+ "properties": {
249
+ "environment": {
250
+ "anyOf": [
251
+ {
252
+ "type": "string",
253
+ "const": "staging"
254
+ },
255
+ {
256
+ "type": "string",
257
+ "const": "production"
258
+ }
259
+ ],
260
+ "description": "HUMAIN Gateway environment. Read from global settings only.",
261
+ "default": "production"
262
+ }
263
+ }
264
+ },
246
265
  "agentMonitor": {
247
266
  "type": "object",
248
267
  "properties": {