@gamaze/hicortex 0.24.0 → 0.24.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.md +3 -1
- package/assets/dashboard.html +142 -44
- package/dist/llm.d.ts +4 -0
- package/dist/llm.js +23 -4
- package/dist/mcp-server.js +1 -0
- package/dist/types.d.ts +8 -0
- package/package.json +1 -1
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -259,7 +259,8 @@ Config at `~/.hicortex/config.json`. Created by `init`. Key options:
|
|
|
259
259
|
| `mode` | `"server"` (default) or `"client"` |
|
|
260
260
|
| `serverUrl` | Remote server URL (client mode) |
|
|
261
261
|
| `llmModel` | The one model used by all phases (distill, score, classify, reflect). Set via `init`. |
|
|
262
|
-
| `
|
|
262
|
+
| `llmProvider` | Explicit request dialect for the OpenAI-compatible path. The only recognized value today: `"azure"` — requests send `max_completion_tokens` instead of `max_tokens` (Azure rejects the latter) and never the local-only `chat_template_kwargs` field. Absent/empty → the provider is detected from the base URL; the dialect is never inferred from the URL. |
|
|
263
|
+
| `enableThinking` | Toggle the model's internal reasoning ("thinking") stream for OpenAI-compatible endpoints (default false). Only meaningful for local chat-template-aware servers (ollama, mlx-lm); leave unset for cloud OpenAI/OpenRouter/Groq endpoints (they 400 on the unknown `chat_template_kwargs` field). With `llmProvider: "azure"` the key is ignored (one warning per boot) — always leave it unset there. |
|
|
263
264
|
| `maxTokens` | Max output tokens for all phases (default 8192). A ceiling, not a target — the model stops early when done. |
|
|
264
265
|
| `llmTimeoutMs` | The ONE timeout ceiling on every LLM call in every phase (default 900000 = 15 min). The LLM request paths disable the HTTP client's hidden 5-minute response-header timer, so this knob is the only bound — one place to tune when the endpoint is slow, no per-phase special cases. |
|
|
265
266
|
| `llmProbeTimeoutMs` | Patience of the readiness probe — one minimal 1-token generation request the daemon sends before distilling (default 60000 = 1 min). Catches a gateway that answers health/model-list queries while generation is dead; a failed probe answers `/distill` with a 503 so capture holds its cursor. The nightly no longer probes — its dead-endpoint signal is the circuit breaker (`endpoint_down`, retried next run) |
|
|
@@ -348,6 +349,7 @@ LLM selection is **user-controlled**: `npx @gamaze/hicortex init` detects candid
|
|
|
348
349
|
| Ollama (local) | `llmBackend: "ollama"` | Set by init; no API key needed |
|
|
349
350
|
| Claude CLI | `llmBackend: "claude-cli"` | Uses CC subscription; no API key needed |
|
|
350
351
|
| Custom provider | `llmBaseUrl` + `llmApiKey` | Any OpenAI-compatible endpoint |
|
|
352
|
+
| Azure OpenAI (AI Foundry) | `llmProvider: "azure"` + `llmBaseUrl` + `llmApiKey` (+ `llmModel`) | The OpenAI-compatible path with the Azure dialect: requests carry `max_completion_tokens` (Azure 400s on `max_tokens`) and Bearer auth; `enableThinking` is ignored — leave it unset |
|
|
351
353
|
| Hicortex env vars | `HICORTEX_LLM_BASE_URL` + `HICORTEX_LLM_API_KEY` | Override at runtime |
|
|
352
354
|
|
|
353
355
|
If no LLM is configured, the server starts in **recall-only mode**: search, lessons, and identity work; `/distill` and consolidation are disabled. Run `npx @gamaze/hicortex init` to configure.
|
package/assets/dashboard.html
CHANGED
|
@@ -1032,6 +1032,9 @@
|
|
|
1032
1032
|
#plan-overlay .po-head b{ font-family:var(--serif); font-weight:500; font-size:17px; letter-spacing:.06em; text-transform:uppercase; }
|
|
1033
1033
|
#plan-overlay .po-body{ padding:14px 16px 16px; display:flex; flex-direction:column; gap:10px; }
|
|
1034
1034
|
#plan-overlay .po-current{ font-size:12.5px; color:var(--dim); }
|
|
1035
|
+
/* #411: the currency toggle pill — the site's #cur-toggle idiom (small,
|
|
1036
|
+
accent-bordered pill above the cards). */
|
|
1037
|
+
#plan-overlay .po-cur{ align-self:flex-start; margin:0; padding:3px 12px; font-size:11px; font-weight:700; color:var(--green); background:rgba(61,255,122,0.08); border:1px solid rgba(61,255,122,0.35); border-radius:100px; cursor:pointer; }
|
|
1035
1038
|
.po-opts{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
|
|
1036
1039
|
#acct-options[hidden]{ display:none; } /* author grid beats [hidden] (renderPlanOverlay hides it when a plan is set) */
|
|
1037
1040
|
.po-opt{ background:var(--panel); border:1px solid var(--line2); border-radius:12px; padding:14px 16px 13px; display:flex; flex-direction:column; gap:5px; min-width:0; }
|
|
@@ -1039,6 +1042,13 @@
|
|
|
1039
1042
|
.po-opt .po-price{ font-size:26px; font-weight:640; font-variant-numeric:tabular-nums; letter-spacing:.01em; color:var(--green); }
|
|
1040
1043
|
html:not([data-theme="light"]) .po-opt .po-price{ text-shadow:0 0 12px rgba(61,255,122,.35); }
|
|
1041
1044
|
.po-opt .po-note{ font-size:11px; color:var(--dim); }
|
|
1045
|
+
/* #411 tax wording: the price's tax qualifier renders small + muted next
|
|
1046
|
+
to the amount (the .period idiom of the site's pricing card). */
|
|
1047
|
+
.po-opt .po-price .po-price-x{ font-size:12px; font-weight:500; letter-spacing:0; color:var(--dim); text-shadow:none; }
|
|
1048
|
+
/* #411 tax brief: the USD checkout footnote — small print under the plan
|
|
1049
|
+
cards, shown only while the selected currency is USD (setPlanCur). No
|
|
1050
|
+
display rule of its own, so the UA [hidden] hides it. */
|
|
1051
|
+
#plan-overlay .po-tax{ font-size:11px; color:var(--dim); }
|
|
1042
1052
|
/* what's included (round 3, owner: "NO info on what is included in the
|
|
1043
1053
|
plan") — the marketing site's Cloud feature lines, verbatim, per card. */
|
|
1044
1054
|
.po-opt .po-feat{ list-style:none; margin-top:7px; display:flex; flex-direction:column; gap:3px; }
|
|
@@ -1427,19 +1437,24 @@
|
|
|
1427
1437
|
the dash (not dimmed-partial). × / cover-click / ESC close and return
|
|
1428
1438
|
where the user was. The option cards are GENERATED from the
|
|
1429
1439
|
PLAN_OPTIONS data array (round 3: N-driven — a future plan is a data
|
|
1430
|
-
entry + a router price id, not a page rework); prices
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1440
|
+
entry + a router price id, not a page rework); #411: prices are
|
|
1441
|
+
PER-CURRENCY data (USD + EUR, whole-number mirrors of each other), the
|
|
1442
|
+
included-features bullets stay shared, and both are aligned with the
|
|
1443
|
+
marketing site (lockstep-pinned by tests). The currency toggle pill
|
|
1444
|
+
(#po-cur, the site's #cur-toggle idiom) re-renders the cards, and
|
|
1445
|
+
checkout posts the displayed currency so the charge matches the
|
|
1446
|
+
display. The router deliberately knows only Stripe price ids, so
|
|
1447
|
+
there is no server-side amount to read; the Stripe Checkout page
|
|
1448
|
+
shows the authoritative amount before payment. ============ -->
|
|
1436
1449
|
<div id="plan-overlay" hidden>
|
|
1437
1450
|
<div class="po-cover" id="po-cover"></div>
|
|
1438
1451
|
<div class="po-card" role="dialog" aria-modal="true" aria-labelledby="po-title">
|
|
1439
1452
|
<div class="po-head"><b id="po-title">Plan & billing</b><button class="pm-close" id="po-close" aria-label="Close">✕</button></div>
|
|
1440
1453
|
<div class="po-body">
|
|
1441
1454
|
<div class="po-current" id="po-current"></div>
|
|
1455
|
+
<button id="po-cur" type="button" class="po-cur" aria-label="Toggle currency USD/EUR">$ USD</button>
|
|
1442
1456
|
<div class="po-opts" id="acct-options"></div>
|
|
1457
|
+
<div class="po-tax" id="po-tax" hidden>No sales tax is currently collected. State sales tax or use tax may apply in your state.</div>
|
|
1443
1458
|
</div>
|
|
1444
1459
|
</div>
|
|
1445
1460
|
</div>
|
|
@@ -4614,28 +4629,66 @@ function acctMenuPlan(a) {
|
|
|
4614
4629
|
avatar: ((typeof a.name === "string" && a.name) ? a.name : "?").slice(0, 2).toUpperCase(),
|
|
4615
4630
|
};
|
|
4616
4631
|
}
|
|
4632
|
+
/* #411 — the overlay's currency state (owner rulings 2026-10-12): exactly
|
|
4633
|
+
USD + EUR; the first-visit default follows the browser timezone (an
|
|
4634
|
+
explicit US IANA zone list — exact zones + the Indiana/Kentucky/
|
|
4635
|
+
North_Dakota prefixes — → usd, anything else → eur, ANY error or
|
|
4636
|
+
unrecognized zone fails open to eur); a stored hctx-cur choice is
|
|
4637
|
+
validated and always wins. This duplicates the marketing site's rule on
|
|
4638
|
+
purpose: web/ and this package asset are separate surfaces that share no
|
|
4639
|
+
code — the SAME key keeps the two toggles converged. */
|
|
4640
|
+
const US_ZONES = ["America/New_York","America/Chicago","America/Denver","America/Phoenix","America/Los_Angeles","America/Anchorage","America/Juneau","America/Sitka","America/Metlakatla","America/Nome","America/Yakutat","America/Adak","America/Boise","America/Detroit","America/Menominee","America/Puerto_Rico","America/St_Thomas","Pacific/Honolulu","Pacific/Guam","Pacific/Saipan","Pacific/Pago_Pago","America/Indiana/","America/Kentucky/","America/North_Dakota/"];
|
|
4641
|
+
function isUsTz(z) {
|
|
4642
|
+
for (const u of US_ZONES) {
|
|
4643
|
+
if (u.slice(-1) === "/") { if (z.slice(0, u.length) === u) return true; }
|
|
4644
|
+
else if (z === u) return true;
|
|
4645
|
+
}
|
|
4646
|
+
return false;
|
|
4647
|
+
}
|
|
4648
|
+
function tzDefaultCur() {
|
|
4649
|
+
try { return isUsTz(Intl.DateTimeFormat().resolvedOptions().timeZone || "") ? "usd" : "eur"; } catch { return "eur"; }
|
|
4650
|
+
}
|
|
4651
|
+
let PLAN_CUR = tzDefaultCur();
|
|
4652
|
+
try { const saved = localStorage.getItem("hctx-cur"); if (saved === "usd" || saved === "eur") PLAN_CUR = saved; } catch {}
|
|
4617
4653
|
/* Pure decision (#371) — the purchasable periods. Decided pricing (owner
|
|
4618
4654
|
2026-08-19): ONE price, TWO periods — €12/mo and €108/yr. ANNUAL FIRST:
|
|
4619
4655
|
annual is the stated product default; its note is the numeric savings
|
|
4620
4656
|
sub-line (round-4 addendum 2026-09-24: it replaces the retired
|
|
4621
4657
|
words-only annual tagline — same fact, numbers not words; effective
|
|
4622
4658
|
monthly 108/12 = €9, discount (144−108)/144 = 25%, derived-pinned by
|
|
4623
|
-
tests so a price change forces the sub-line update).
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4659
|
+
tests so a price change forces the sub-line update). #411 (rulings
|
|
4660
|
+
2026-10-12): the price/note literals are PER-CURRENCY data — USD
|
|
4661
|
+
MIRRORS the EUR whole numbers ($12/mo, $108/yr), and the savings pair
|
|
4662
|
+
is derived per currency from the same-currency bases (never converted;
|
|
4663
|
+
no exchange-rate arithmetic anywhere). The router deliberately knows
|
|
4664
|
+
only Stripe price ids (no server-side amount exists to read), and the
|
|
4665
|
+
Stripe Checkout page shows the authoritative amount before payment.
|
|
4666
|
+
Round 3: a PURE DATA ARRAY and the single source of truth — the overlay
|
|
4667
|
+
cards are GENERATED from it (renderPlanCards) and the wiring loops it
|
|
4668
|
+
(wireChooseButtons); no two-plan hardcoding anywhere. #411 tax wording
|
|
4669
|
+
(tax research brief, 2026-10-12): the price strings carry the VERBATIM
|
|
4670
|
+
pricing-card wording — EUR consumer prices read VAT-inclusive ("incl.
|
|
4671
|
+
25.5% VAT"), USD tax-exclusive ("excl. tax"); fixed wording, the 25.5%
|
|
4672
|
+
inside it is never a computed value. The savings note is a derived
|
|
4673
|
+
ANNOTATION, not a price point — it carries no qualifier. The bullets
|
|
4674
|
+
are the marketing site's Cloud feature lines, verbatim (lockstep-
|
|
4675
|
+
pinned against web/index.html) — the seven owner-decided lines
|
|
4676
|
+
(amendment 4, 2026-09-24: copy-first ruling; the agent-cap enforcement
|
|
4677
|
+
rides its own issue); both periods are the same Cloud product, so both
|
|
4678
|
+
carry the same seven. */
|
|
4635
4679
|
const PLAN_OPTIONS = [
|
|
4636
|
-
{ id: "annual", posts: "annual", name: "Annual", price: "€108/year", note: "€9/mo · 25% off", cta: "Choose annual", bullets: ["Fully managed — no API keys needed", "Claude Code, Hermes, OpenClaw, Pi, OpenCode", "10,000 memories included", "Up to 10 agents", "Learnings & nightly reflection", "Semantic search + knowledge graph", "Multi-machine support"] },
|
|
4637
|
-
{ id: "monthly", posts: "monthly", name: "Monthly", price: "€12/
|
|
4680
|
+
{ id: "annual", posts: "annual", name: "Annual", prices: { eur: { price: "€108/year (incl. 25.5% VAT)", note: "€9/mo · 25% off" }, usd: { price: "$108/year (excl. tax)", note: "$9/mo · 25% off" } }, cta: "Choose annual", bullets: ["Fully managed — no API keys needed", "Claude Code, Hermes, OpenClaw, Pi, OpenCode", "10,000 memories included", "Up to 10 agents", "Learnings & nightly reflection", "Semantic search + knowledge graph", "Multi-machine support"] },
|
|
4681
|
+
{ id: "monthly", posts: "monthly", name: "Monthly", prices: { eur: { price: "€12/month (incl. 25.5% VAT)", note: "" }, usd: { price: "$12/month (excl. tax)", note: "" } }, cta: "Choose monthly", bullets: ["Fully managed — no API keys needed", "Claude Code, Hermes, OpenClaw, Pi, OpenCode", "10,000 memories included", "Up to 10 agents", "Learnings & nightly reflection", "Semantic search + knowledge graph", "Multi-machine support"] },
|
|
4638
4682
|
];
|
|
4683
|
+
/* #411 tax brief — presentation split for the big price line: the amount
|
|
4684
|
+
renders at full size, the tax qualifier in the smaller muted style.
|
|
4685
|
+
Pure, and the DATA string stays the brief's verbatim wording either
|
|
4686
|
+
way (the 25.5% lives only inside the fixed wording strings, never as a
|
|
4687
|
+
computed value). */
|
|
4688
|
+
function priceParts(s) {
|
|
4689
|
+
const at = s.indexOf(" (");
|
|
4690
|
+
return at === -1 ? [s, ""] : [s.slice(0, at), s.slice(at + 1)];
|
|
4691
|
+
}
|
|
4639
4692
|
/* Pure decision (#371) — the Stripe return parameter (?billing=…, the
|
|
4640
4693
|
success_url/cancel_url the router stamps on every checkout) → the
|
|
4641
4694
|
acknowledgment banner spec, or null when there is nothing to acknowledge
|
|
@@ -4737,24 +4790,69 @@ function closeConnectOverlay() {
|
|
|
4737
4790
|
const ov = $("connect-overlay");
|
|
4738
4791
|
if (ov) ov.hidden = true;
|
|
4739
4792
|
}
|
|
4740
|
-
/* N-driven card render (#371 round 3): the option cards
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4793
|
+
/* N-driven card render (#371 round 3, #411 per-currency): the option cards
|
|
4794
|
+
are GENERATED from PLAN_OPTIONS at the CURRENT currency — N entries, N
|
|
4795
|
+
cards, no per-plan or per-currency literals anywhere in the markup or
|
|
4796
|
+
this template (a future plan is a data entry + a router price id, not a
|
|
4797
|
+
page rework). Runs at script init AND on every currency toggle
|
|
4798
|
+
(setPlanCur); account data only toggles visibility (renderPlanOverlay). */
|
|
4745
4799
|
function renderPlanCards() {
|
|
4746
4800
|
const host = $("acct-options");
|
|
4747
4801
|
if (!host) return;
|
|
4748
|
-
host.innerHTML = PLAN_OPTIONS.map((o) =>
|
|
4802
|
+
host.innerHTML = PLAN_OPTIONS.map((o) => {
|
|
4803
|
+
const p = o.prices[PLAN_CUR];
|
|
4804
|
+
const [main, tax] = priceParts(p.price);
|
|
4805
|
+
return `
|
|
4749
4806
|
<div class="po-opt" id="acct-opt-${o.id}">
|
|
4750
4807
|
<div class="po-name">${esc(o.name)}</div>
|
|
4751
|
-
<div class="po-price">${esc(
|
|
4752
|
-
${
|
|
4808
|
+
<div class="po-price">${esc(main)}${tax ? ` <span class="po-price-x">${esc(tax)}</span>` : ""}</div>
|
|
4809
|
+
${p.note ? `<div class="po-note">${esc(p.note)}</div>` : ""}
|
|
4753
4810
|
<ul class="po-feat">${o.bullets.map((b) => `<li>${esc(b)}</li>`).join("")}</ul>
|
|
4754
4811
|
<button id="acct-buy-${o.id}" type="button" class="po-choose">${esc(o.cta)}</button>
|
|
4755
|
-
</div
|
|
4812
|
+
</div>`;
|
|
4813
|
+
}).join("");
|
|
4756
4814
|
}
|
|
4757
4815
|
renderPlanCards();
|
|
4816
|
+
/* #411 — bind each card's Choose button from the entry's id (N buttons,
|
|
4817
|
+
one loop). Extracted from wireSubscription because the currency toggle
|
|
4818
|
+
REGENERATES the cards' innerHTML, which drops the listeners — every
|
|
4819
|
+
re-render re-binds through here. */
|
|
4820
|
+
function wireChooseButtons() {
|
|
4821
|
+
for (const o of PLAN_OPTIONS) {
|
|
4822
|
+
const buy = $("acct-buy-" + o.id);
|
|
4823
|
+
if (!buy) continue;
|
|
4824
|
+
buy.addEventListener("click", () => { startCheckout(o.posts, PLAN_CUR, buy); });
|
|
4825
|
+
}
|
|
4826
|
+
}
|
|
4827
|
+
/* #411 — the overlay's currency toggle (the site's #cur-toggle idiom):
|
|
4828
|
+
swap the current currency, persist the choice under the SAME hctx-cur
|
|
4829
|
+
key the site uses, repaint the pill label, and re-render + re-bind the
|
|
4830
|
+
cards (the prices are per-currency data). */
|
|
4831
|
+
function setPlanCur(c) {
|
|
4832
|
+
PLAN_CUR = c;
|
|
4833
|
+
try { localStorage.setItem("hctx-cur", c); } catch {}
|
|
4834
|
+
const t = $("po-cur");
|
|
4835
|
+
if (t) t.textContent = c === "usd" ? "$ USD" : "€ EUR";
|
|
4836
|
+
// #411 tax brief: the USD checkout footnote shows ONLY on USD (the
|
|
4837
|
+
// Stripe-hosted page cannot carry custom copy — this overlay is the
|
|
4838
|
+
// checkout surface we own). EUR needs no note: its compliance wording
|
|
4839
|
+
// rides the price strings ("incl. 25.5% VAT").
|
|
4840
|
+
const note = $("po-tax");
|
|
4841
|
+
if (note) note.hidden = c !== "usd";
|
|
4842
|
+
renderPlanCards();
|
|
4843
|
+
wireChooseButtons();
|
|
4844
|
+
}
|
|
4845
|
+
function wirePlanCurrency() {
|
|
4846
|
+
// Footnote visibility at INIT too — a US-timezone first visit starts on
|
|
4847
|
+
// USD with no toggle ever firing.
|
|
4848
|
+
const note = $("po-tax");
|
|
4849
|
+
if (note) note.hidden = PLAN_CUR !== "usd";
|
|
4850
|
+
const t = $("po-cur");
|
|
4851
|
+
if (!t) return;
|
|
4852
|
+
t.textContent = PLAN_CUR === "usd" ? "$ USD" : "€ EUR";
|
|
4853
|
+
t.addEventListener("click", () => { setPlanCur(PLAN_CUR === "usd" ? "eur" : "usd"); });
|
|
4854
|
+
}
|
|
4855
|
+
wirePlanCurrency();
|
|
4758
4856
|
function wireSubscription() {
|
|
4759
4857
|
const btn = $("acct-subscription");
|
|
4760
4858
|
if (!btn) return;
|
|
@@ -4766,11 +4864,9 @@ function wireSubscription() {
|
|
|
4766
4864
|
closeAcctMenu();
|
|
4767
4865
|
openPlanOverlay();
|
|
4768
4866
|
});
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
buy.addEventListener("click", () => { startCheckout(o.posts, buy); });
|
|
4773
|
-
}
|
|
4867
|
+
// #411: the Choose-button binding lives in wireChooseButtons (the
|
|
4868
|
+
// currency toggle re-binds through it after every re-render).
|
|
4869
|
+
wireChooseButtons();
|
|
4774
4870
|
}
|
|
4775
4871
|
/* #506: the menu's Connect-an-agent entry opens the full-cover connect
|
|
4776
4872
|
overlay — the same launch idiom as wireSubscription (#371): the menu
|
|
@@ -4785,21 +4881,23 @@ function wireConnectEntry() {
|
|
|
4785
4881
|
openConnectOverlay();
|
|
4786
4882
|
});
|
|
4787
4883
|
}
|
|
4788
|
-
/** POST /stripe/checkout for ONE plan
|
|
4789
|
-
* URL (#371 — each period's action posts
|
|
4790
|
-
* annual-only body was the defect
|
|
4791
|
-
*
|
|
4792
|
-
*
|
|
4793
|
-
*
|
|
4794
|
-
*
|
|
4795
|
-
*
|
|
4796
|
-
|
|
4884
|
+
/** POST /stripe/checkout for ONE plan at the DISPLAYED currency, then
|
|
4885
|
+
* navigate to the returned Stripe URL (#371 — each period's action posts
|
|
4886
|
+
* its own plan; the hardcoded annual-only body was the defect. #411 — the
|
|
4887
|
+
* body now carries the currency the buyer saw, so the charge matches the
|
|
4888
|
+
* display; the router maps (plan, currency) → its configured price id).
|
|
4889
|
+
* The failure seams are the shipped checkout-handler contract, kept
|
|
4890
|
+
* verbatim for EVERY action: 401 → Google re-auth where the probe says
|
|
4891
|
+
* OAuth exists, else the expired-session alert; non-ok → the unavailable
|
|
4892
|
+
* alert; network error → the unreachable alert. Each button is disabled
|
|
4893
|
+
* independently while its own request is in flight. */
|
|
4894
|
+
async function startCheckout(plan, currency, btn) {
|
|
4797
4895
|
btn.disabled = true;
|
|
4798
4896
|
try {
|
|
4799
4897
|
const resp = await fetch("/stripe/checkout", {
|
|
4800
4898
|
method: "POST",
|
|
4801
4899
|
headers: { "content-type": "application/json" },
|
|
4802
|
-
body: JSON.stringify({ plan }),
|
|
4900
|
+
body: JSON.stringify({ plan, currency }),
|
|
4803
4901
|
});
|
|
4804
4902
|
if (resp.status === 401) {
|
|
4805
4903
|
// Never hard-redirect to Google on a daemon (dead end / loop) — only
|
package/dist/llm.d.ts
CHANGED
|
@@ -68,6 +68,7 @@ export declare function resolveExplicitLlmConfig(overrides?: {
|
|
|
68
68
|
llmBaseUrl?: string;
|
|
69
69
|
llmApiKey?: string;
|
|
70
70
|
llmModel?: string;
|
|
71
|
+
llmProvider?: string;
|
|
71
72
|
}): LlmConfig | null;
|
|
72
73
|
/**
|
|
73
74
|
* @deprecated Use resolveExplicitLlmConfig. This alias exists only to ease
|
|
@@ -290,6 +291,9 @@ export declare class LlmClient {
|
|
|
290
291
|
/**
|
|
291
292
|
* OpenAI-compatible /v1/chat/completions (works for OpenAI, OpenRouter, etc).
|
|
292
293
|
* enableThinking is read from config here (one value, all phases — #231).
|
|
294
|
+
* #562: the azure dialect (provider "azure", selected ONLY via config
|
|
295
|
+
* llmProvider) swaps the token-cap parameter to max_completion_tokens and
|
|
296
|
+
* never sends chat_template_kwargs — Azure 400s on both (probed 2026-10-27).
|
|
293
297
|
*
|
|
294
298
|
* Token usage (#246): the OpenAI spec's `usage` object is always present on
|
|
295
299
|
* a successful completion — `prompt_tokens` / `completion_tokens` /
|
package/dist/llm.js
CHANGED
|
@@ -59,7 +59,11 @@ const undici_1 = require("undici");
|
|
|
59
59
|
function resolveExplicitLlmConfig(overrides) {
|
|
60
60
|
// 1. Explicit config-file overrides (both baseUrl and apiKey required)
|
|
61
61
|
if (overrides?.llmBaseUrl && overrides?.llmApiKey) {
|
|
62
|
-
|
|
62
|
+
// #562: a non-empty llmProvider selects an explicit request DIALECT
|
|
63
|
+
// (today: "azure") instead of URL detection. Absent/empty → detection
|
|
64
|
+
// unchanged. The dialect is NEVER inferred from the URL — Azure URLs
|
|
65
|
+
// detect as "openai" and stay that way without the explicit key.
|
|
66
|
+
const provider = overrides.llmProvider || detectProvider(overrides.llmBaseUrl);
|
|
63
67
|
return {
|
|
64
68
|
baseUrl: overrides.llmBaseUrl,
|
|
65
69
|
apiKey: overrides.llmApiKey,
|
|
@@ -123,6 +127,12 @@ function applyTierTuningOverlay(llmConfig, savedConfig) {
|
|
|
123
127
|
const thinking = (0, config_read_js_1.readStrictBoolean)(savedConfig, "enableThinking");
|
|
124
128
|
if (thinking !== undefined) {
|
|
125
129
|
llmConfig.enableThinking = thinking;
|
|
130
|
+
// #562: inert on the azure dialect — the cloud endpoint never receives
|
|
131
|
+
// chat_template_kwargs (see completeOpenAiCompat). One operator-facing
|
|
132
|
+
// line; removing the config key clears it.
|
|
133
|
+
if (llmConfig.provider === "azure") {
|
|
134
|
+
console.warn("[hicortex] enableThinking is ignored on the azure dialect (cloud endpoint — no chat_template_kwargs is sent); remove the key to clear this warning");
|
|
135
|
+
}
|
|
126
136
|
}
|
|
127
137
|
// #337 resilience knobs. Same boundary discipline as the keys above: absent =
|
|
128
138
|
// call-site defaults (timeout 900 s, probe timeout 60 s, probe TTL 5 min),
|
|
@@ -185,6 +195,7 @@ function resolveSavedLlmConfig(savedConfig, findBinary = findClaudeBinary) {
|
|
|
185
195
|
llmBaseUrl: savedConfig?.llmBaseUrl,
|
|
186
196
|
llmApiKey: savedConfig?.llmApiKey,
|
|
187
197
|
llmModel: savedConfig?.llmModel,
|
|
198
|
+
llmProvider: savedConfig?.llmProvider,
|
|
188
199
|
});
|
|
189
200
|
}
|
|
190
201
|
// Tuning overlay (#220: maxTokens + enableThinking; #408: the diagnostic
|
|
@@ -768,6 +779,9 @@ class LlmClient {
|
|
|
768
779
|
/**
|
|
769
780
|
* OpenAI-compatible /v1/chat/completions (works for OpenAI, OpenRouter, etc).
|
|
770
781
|
* enableThinking is read from config here (one value, all phases — #231).
|
|
782
|
+
* #562: the azure dialect (provider "azure", selected ONLY via config
|
|
783
|
+
* llmProvider) swaps the token-cap parameter to max_completion_tokens and
|
|
784
|
+
* never sends chat_template_kwargs — Azure 400s on both (probed 2026-10-27).
|
|
771
785
|
*
|
|
772
786
|
* Token usage (#246): the OpenAI spec's `usage` object is always present on
|
|
773
787
|
* a successful completion — `prompt_tokens` / `completion_tokens` /
|
|
@@ -794,14 +808,19 @@ class LlmClient {
|
|
|
794
808
|
// kwarg rides every call — so it is LOCAL-endpoint only (ollama, mlx-lm
|
|
795
809
|
// gateway); a cloud OpenAI/OpenRouter/Groq endpoint would 400 on the unknown
|
|
796
810
|
// field. provider cannot gate this (the MLX gateway is also provider:openai),
|
|
797
|
-
// so the operator leaves enableThinking unset for cloud endpoints
|
|
811
|
+
// so the operator leaves enableThinking unset for cloud endpoints — the ONE
|
|
812
|
+
// exception is the azure dialect (#562), which is explicitly selected via
|
|
813
|
+
// llmProvider and therefore IS gated off. See #220.
|
|
814
|
+
const azureDialect = this.config.provider === "azure";
|
|
798
815
|
const thinking = this.config.enableThinking;
|
|
799
816
|
const body = {
|
|
800
817
|
model,
|
|
801
818
|
messages: [{ role: "user", content: prompt }],
|
|
802
|
-
|
|
819
|
+
// #562: Azure 400s on max_tokens ("not supported with this model") and
|
|
820
|
+
// requires max_completion_tokens — the only request-shape difference.
|
|
821
|
+
...(azureDialect ? { max_completion_tokens: maxTokens } : { max_tokens: maxTokens }),
|
|
803
822
|
};
|
|
804
|
-
if (thinking !== undefined) {
|
|
823
|
+
if (thinking !== undefined && !azureDialect) {
|
|
805
824
|
body.chat_template_kwargs = { enable_thinking: thinking };
|
|
806
825
|
}
|
|
807
826
|
const resp = await (0, undici_1.fetch)(url, {
|
package/dist/mcp-server.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -501,6 +501,14 @@ export interface HicortexConfig {
|
|
|
501
501
|
llmApiKey?: string;
|
|
502
502
|
/** @deprecated Use the Hicortex server for distillation and consolidation. */
|
|
503
503
|
llmModel?: string;
|
|
504
|
+
/**
|
|
505
|
+
* Explicit request-dialect key for the openai-compat path (#562). The only
|
|
506
|
+
* recognized dialect value today is "azure" — the request sends
|
|
507
|
+
* max_completion_tokens instead of max_tokens and never chat_template_kwargs
|
|
508
|
+
* (Azure 400s on both). Absent/empty → the provider is URL-detected
|
|
509
|
+
* (detectProvider); the dialect is NEVER inferred from the URL.
|
|
510
|
+
*/
|
|
511
|
+
llmProvider?: string;
|
|
504
512
|
/** @deprecated Consolidation is owned by the server nightly. */
|
|
505
513
|
consolidateHour?: number;
|
|
506
514
|
/** @deprecated The OC plugin no longer opens its own database. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamaze/hicortex",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.1",
|
|
4
4
|
"description": "Persistent agent identity for AI agents \u2014 a hand-edited identity layer, nightly-distilled experience, and lessons injected every session, shared across your whole fleet. Works with Hermes, OpenClaw, Claude Code, Pi, and opencode.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
package/server.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"name": "io.github.gamaze-labs/hicortex",
|
|
4
4
|
"title": "Hicortex \u2014 AI Fleet Memory",
|
|
5
5
|
"description": "Shared fleet memory for AI agents: nightly self-correction, recall every prompt (supported agents).",
|
|
6
|
-
"version": "0.24.
|
|
6
|
+
"version": "0.24.1",
|
|
7
7
|
"packages": [
|
|
8
8
|
{
|
|
9
9
|
"registryType": "npm",
|
|
10
10
|
"identifier": "@gamaze/hicortex",
|
|
11
|
-
"version": "0.24.
|
|
11
|
+
"version": "0.24.1",
|
|
12
12
|
"transport": {
|
|
13
13
|
"type": "stdio",
|
|
14
14
|
"command": "npx",
|