@usabledev/usable-chat 1.174.3 → 1.175.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/cli.js +37 -3
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -91696,6 +91696,12 @@ var init_env2 = __esm({
|
|
|
91696
91696
|
// (/api/oauth/register). Pre-configured in Keycloak (memory-mesh) with PKCE +
|
|
91697
91697
|
// whitelisted redirect URIs — clients never hit Keycloak's DCR endpoint.
|
|
91698
91698
|
MCP_OAUTH_CLIENT_ID: external_exports.string().min(1).default("mcp_oauth_client"),
|
|
91699
|
+
// Optional azp (authorized party) allowlist for Bearer JWT auth on API routes.
|
|
91700
|
+
// Comma-separated Keycloak client IDs. UNSET = no azp enforcement (issuer +
|
|
91701
|
+
// signature + expiry only — pre-existing behaviour, keeps embed integrations
|
|
91702
|
+
// working). SET = bearer tokens whose azp is not in the list are rejected
|
|
91703
|
+
// with 401 JWT_AZP_REJECTED. See docs/chat-v2-contract.md#authentication.
|
|
91704
|
+
CHAT_TRUSTED_CLIENT_IDS: external_exports.string().optional(),
|
|
91699
91705
|
// Usable MCP
|
|
91700
91706
|
USABLE_MCP_URL: external_exports.string().url().default("https://usable.dev/api/mcp"),
|
|
91701
91707
|
USABLE_WORKSPACE_ID: external_exports.string().uuid(),
|
|
@@ -91803,6 +91809,7 @@ var init_env2 = __esm({
|
|
|
91803
91809
|
USABLE_CLIENT_ID: process.env.USABLE_CLIENT_ID,
|
|
91804
91810
|
USABLE_CLIENT_SECRET: process.env.USABLE_CLIENT_SECRET,
|
|
91805
91811
|
MCP_OAUTH_CLIENT_ID: process.env.MCP_OAUTH_CLIENT_ID,
|
|
91812
|
+
CHAT_TRUSTED_CLIENT_IDS: process.env.CHAT_TRUSTED_CLIENT_IDS,
|
|
91806
91813
|
// Usable MCP
|
|
91807
91814
|
USABLE_MCP_URL: process.env.USABLE_MCP_URL,
|
|
91808
91815
|
USABLE_WORKSPACE_ID: process.env.USABLE_WORKSPACE_ID,
|
|
@@ -91911,7 +91918,12 @@ var init_config = __esm({
|
|
|
91911
91918
|
clientId: env.USABLE_CLIENT_ID,
|
|
91912
91919
|
clientSecret: env.USABLE_CLIENT_SECRET,
|
|
91913
91920
|
/** Static public client_id returned by the MCP OAuth registration endpoint. */
|
|
91914
|
-
mcpOAuthClientId: env.MCP_OAUTH_CLIENT_ID || DEFAULT_MCP_OAUTH_CLIENT_ID2
|
|
91921
|
+
mcpOAuthClientId: env.MCP_OAUTH_CLIENT_ID || DEFAULT_MCP_OAUTH_CLIENT_ID2,
|
|
91922
|
+
/**
|
|
91923
|
+
* Optional azp allowlist for Bearer JWT auth (comma-separated client IDs).
|
|
91924
|
+
* Empty/unset disables enforcement. See docs/chat-v2-contract.md.
|
|
91925
|
+
*/
|
|
91926
|
+
trustedClientIdsRaw: env.CHAT_TRUSTED_CLIENT_IDS
|
|
91915
91927
|
},
|
|
91916
91928
|
mcp: {
|
|
91917
91929
|
url: env.USABLE_MCP_URL,
|
|
@@ -214522,6 +214534,19 @@ Use this to discover the current state of background work \u2014 running, comple
|
|
|
214522
214534
|
}
|
|
214523
214535
|
});
|
|
214524
214536
|
|
|
214537
|
+
// src/core/billing/credit-authorization.ts
|
|
214538
|
+
async function authorizeCreditBeforeProvider(port, input) {
|
|
214539
|
+
if (!port) return void 0;
|
|
214540
|
+
const authorization = await port.authorize(input);
|
|
214541
|
+
port.current = authorization;
|
|
214542
|
+
return authorization;
|
|
214543
|
+
}
|
|
214544
|
+
var init_credit_authorization = __esm({
|
|
214545
|
+
"src/core/billing/credit-authorization.ts"() {
|
|
214546
|
+
"use strict";
|
|
214547
|
+
}
|
|
214548
|
+
});
|
|
214549
|
+
|
|
214525
214550
|
// src/core/orchestrator/discoverable-skills-prompt.ts
|
|
214526
214551
|
function buildDiscoverableSkillsPromptSection(skills) {
|
|
214527
214552
|
if (skills.length === 0) {
|
|
@@ -289652,6 +289677,12 @@ Re-read them (working_memory on web, bash on the CLI \u2014 grep/sed projection,
|
|
|
289652
289677
|
while (true) {
|
|
289653
289678
|
let overflowMessage;
|
|
289654
289679
|
try {
|
|
289680
|
+
if (!config3.__scriptedLlm) {
|
|
289681
|
+
await authorizeCreditBeforeProvider(context.creditAuthorization, {
|
|
289682
|
+
inputTokens,
|
|
289683
|
+
maxOutputTokens: maxTokens
|
|
289684
|
+
});
|
|
289685
|
+
}
|
|
289655
289686
|
result = await callLLM({
|
|
289656
289687
|
isClaude,
|
|
289657
289688
|
selectedModelId,
|
|
@@ -290314,7 +290345,8 @@ Re-read them (working_memory on web, bash on the CLI \u2014 grep/sed projection,
|
|
|
290314
290345
|
});
|
|
290315
290346
|
}
|
|
290316
290347
|
}
|
|
290317
|
-
const
|
|
290348
|
+
const rawErrorCode = error41?.code;
|
|
290349
|
+
const errorCode = rawErrorCode === "CONTEXT_TOO_LARGE" || rawErrorCode === "MEMBER_CAP_EXCEEDED" || rawErrorCode === "CREDIT_LIMIT_REACHED" || rawErrorCode === "CREDIT_OVERAGE_CAP_REACHED" || rawErrorCode === "CREDIT_PREFLIGHT_UNAVAILABLE" ? rawErrorCode : "ORCHESTRATION_ERROR";
|
|
290318
290350
|
const errorEvent = emitter.emit("error", {
|
|
290319
290351
|
message: errorMessage,
|
|
290320
290352
|
code: errorCode,
|
|
@@ -290357,6 +290389,7 @@ function createOrchestratorRequest(messages4, context, config3, persona, apiKey,
|
|
|
290357
290389
|
abortSignal: context.abortSignal,
|
|
290358
290390
|
sessionPathway: context.sessionPathway,
|
|
290359
290391
|
// REQUIRED - validated above
|
|
290392
|
+
creditAuthorization: context.creditAuthorization,
|
|
290360
290393
|
chatStore: context.chatStore,
|
|
290361
290394
|
// Persistence port (Drizzle for Next.js, SQLite for CLI)
|
|
290362
290395
|
metadata: context.metadata,
|
|
@@ -290456,6 +290489,7 @@ var init_orchestrator = __esm({
|
|
|
290456
290489
|
init_redis();
|
|
290457
290490
|
init_executor();
|
|
290458
290491
|
init_tool_categories();
|
|
290492
|
+
init_credit_authorization();
|
|
290459
290493
|
init_discoverable_skills_prompt();
|
|
290460
290494
|
init_mcp_server_tools_prompt();
|
|
290461
290495
|
init_spill_payload();
|
|
@@ -309138,7 +309172,7 @@ init_tui_select();
|
|
|
309138
309172
|
init_model_registry();
|
|
309139
309173
|
|
|
309140
309174
|
// package.json
|
|
309141
|
-
var version2 = "1.
|
|
309175
|
+
var version2 = "1.175.0";
|
|
309142
309176
|
|
|
309143
309177
|
// src/adapters/cli/model-catalog.ts
|
|
309144
309178
|
init_codex_auth();
|