motebit 1.11.0 → 1.11.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.
Files changed (2) hide show
  1. package/dist/index.js +86 -20
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -5126,11 +5126,11 @@ function resolveModelTier(tier, currentModel) {
5126
5126
  if (currentModel.includes("claude") || currentModel.includes("anthropic")) {
5127
5127
  switch (tier) {
5128
5128
  case "strongest":
5129
- return "claude-opus";
5129
+ return "claude-opus-5";
5130
5130
  case "default":
5131
- return "claude-sonnet";
5131
+ return "claude-sonnet-5";
5132
5132
  case "fast":
5133
- return "claude-haiku";
5133
+ return "claude-haiku-4-5";
5134
5134
  }
5135
5135
  }
5136
5136
  if (currentModel.includes("gpt") || currentModel.includes("o1") || currentModel.includes("o3") || currentModel.includes("o4")) {
@@ -5628,6 +5628,9 @@ ${tagged}` : n2;
5628
5628
  function modelSupportsExtendedThinking(model) {
5629
5629
  return /claude-(?:3-7-sonnet|(?:opus|sonnet)-(?:[4-9]|\d\d))/i.test(model);
5630
5630
  }
5631
+ function modelRejectsSamplingParams(model) {
5632
+ return /claude-(?:opus-(?:4-[7-9]|[5-9]\b|\d\d)|sonnet-(?:[5-9]\b|\d\d)|fable|mythos)/i.test(model);
5633
+ }
5631
5634
  function stripTags(text) {
5632
5635
  return text.replace(/<memory\s+[^>]*>[\s\S]*?<\/memory>/g, "").replace(/<thinking>[\s\S]*?<\/thinking>/g, "").replace(/<state\s+[^>]*\/>/g, "").replace(/<narration\s*>[\s\S]*?<\/narration\s*>/g, "").replace(/\[EXTERNAL_DATA[^\]]*\][\s\S]*?\[\/EXTERNAL_DATA\]/g, "").replace(/\[MEMORY_DATA\][\s\S]*?\[\/MEMORY_DATA\]/g, "").replace(/\[EXTERNAL_DATA[^\]]*\]/g, "").replace(/\[\/EXTERNAL_DATA\]/g, "").replace(/\[MEMORY_DATA\]/g, "").replace(/\[\/MEMORY_DATA\]/g, "").replace(/\*[^*]+\*/g, "").replace(/\n{3,}/g, "\n\n").replace(/\s{2,}/g, " ").trim();
5633
5636
  }
@@ -5761,11 +5764,15 @@ var init_core = __esm({
5761
5764
  const body = {
5762
5765
  model: this.config.model,
5763
5766
  max_tokens: this.config.max_tokens ?? 4096,
5764
- // Only send temperature when the user explicitly configured it. Claude
5765
- // Opus 4.7+ deprecates the parameter entirely and returns HTTP 400 when
5766
- // it's present. Omitting it lets each model use its own default; users
5767
- // who want to tune sampling still can via `config.temperature`.
5768
- ...this.config.temperature !== void 0 && { temperature: this.config.temperature },
5767
+ // Only send temperature when the user explicitly configured it AND the
5768
+ // model still accepts it — the Opus 4.7+/Claude-5 family returns HTTP
5769
+ // 400 when the parameter is present at all (witnessed live 2026-07-29:
5770
+ // the CLI's personality default 0.7 400'd every claude-opus-5 turn).
5771
+ // Omitting it lets each model use its own default; users on models
5772
+ // that accept sampling still tune via `config.temperature`.
5773
+ ...this.config.temperature !== void 0 && !modelRejectsSamplingParams(this.config.model) && {
5774
+ temperature: this.config.temperature
5775
+ },
5769
5776
  // Cacheable system blocks (see buildSystemBlocks) — the static prefix
5770
5777
  // caches at 1/10th input cost, the lever for cost on the agentic loop.
5771
5778
  system: this.buildSystemBlocks(contextPack),
@@ -5828,11 +5835,15 @@ var init_core = __esm({
5828
5835
  const body = {
5829
5836
  model: this.config.model,
5830
5837
  max_tokens: this.config.max_tokens ?? 4096,
5831
- // Only send temperature when the user explicitly configured it. Claude
5832
- // Opus 4.7+ deprecates the parameter entirely and returns HTTP 400 when
5833
- // it's present. Omitting it lets each model use its own default; users
5834
- // who want to tune sampling still can via `config.temperature`.
5835
- ...this.config.temperature !== void 0 && { temperature: this.config.temperature },
5838
+ // Only send temperature when the user explicitly configured it AND the
5839
+ // model still accepts it — the Opus 4.7+/Claude-5 family returns HTTP
5840
+ // 400 when the parameter is present at all (witnessed live 2026-07-29:
5841
+ // the CLI's personality default 0.7 400'd every claude-opus-5 turn).
5842
+ // Omitting it lets each model use its own default; users on models
5843
+ // that accept sampling still tune via `config.temperature`.
5844
+ ...this.config.temperature !== void 0 && !modelRejectsSamplingParams(this.config.model) && {
5845
+ temperature: this.config.temperature
5846
+ },
5836
5847
  // Cacheable system blocks (see buildSystemBlocks) — same caching lever as
5837
5848
  // generate(); the streaming path is the one the chat surface actually uses.
5838
5849
  system: this.buildSystemBlocks(contextPack),
@@ -5990,7 +6001,7 @@ var init_core = __esm({
5990
6001
  if (!et || !modelSupportsExtendedThinking(this.config.model))
5991
6002
  return;
5992
6003
  const budget = Math.max(1024, Math.floor(et.budgetTokens));
5993
- body.thinking = { type: "enabled", budget_tokens: budget };
6004
+ body.thinking = modelRejectsSamplingParams(this.config.model) ? { type: "adaptive" } : { type: "enabled", budget_tokens: budget };
5994
6005
  const configured = typeof body.max_tokens === "number" ? body.max_tokens : 4096;
5995
6006
  body.max_tokens = Math.max(configured, budget + 4096);
5996
6007
  delete body.temperature;
@@ -25493,7 +25504,7 @@ var init_config2 = __esm({
25493
25504
  "src/config.ts"() {
25494
25505
  "use strict";
25495
25506
  init_esm_shims();
25496
- VERSION = true ? "1.11.0" : "0.0.0-dev";
25507
+ VERSION = true ? "1.11.1" : "0.0.0-dev";
25497
25508
  CONFIG_DIR = process.env["MOTEBIT_CONFIG_DIR"] ?? path2.join(os.homedir(), ".motebit");
25498
25509
  CONFIG_PATH = path2.join(CONFIG_DIR, "config.json");
25499
25510
  RELAY_DIR = path2.join(CONFIG_DIR, "relay");
@@ -57120,8 +57131,8 @@ function deniedIntentKey(toolName, args) {
57120
57131
  return `${toolName}:${canonical}`;
57121
57132
  }
57122
57133
  function stripDisplayTags(text) {
57123
- const clean2 = text.replace(/<memory\s+[^>]*>[\s\S]*?<\/memory>/g, "").replace(/<thinking>[\s\S]*?<\/thinking>/g, "").replace(/<state\s+[^>]*\/>/g, "").replace(/<parameter\s+[^>]*>[\s\S]*?<\/parameter>/g, "").replace(/<\/?(?:artifact|function_calls|invoke|antml)[^>]*>/g, "").replace(/\[EXTERNAL_DATA[^\]]*\][\s\S]*?\[\/EXTERNAL_DATA\]/g, "").replace(/\[MEMORY_DATA\][\s\S]*?\[\/MEMORY_DATA\]/g, "").replace(/\[EXTERNAL_DATA[^\]]*\]/g, "").replace(/\[\/EXTERNAL_DATA\]/g, "").replace(/\[MEMORY_DATA\]/g, "").replace(/\[\/MEMORY_DATA\]/g, "").replace(/\*{1,3}/g, "").replace(/ {2,}/g, " ");
57124
- for (const tag2 of ["<memory", "<thinking", "<parameter"]) {
57134
+ const clean2 = text.replace(/<memory\s+[^>]*>[\s\S]*?<\/memory>/g, "").replace(/<thinking>[\s\S]*?<\/thinking>/g, "").replace(/<narration>[\s\S]*?<\/narration>/g, "").replace(/<state\s+[^>]*\/>/g, "").replace(/<parameter\s+[^>]*>[\s\S]*?<\/parameter>/g, "").replace(/<\/?(?:artifact|function_calls|invoke|antml)[^>]*>/g, "").replace(/\[EXTERNAL_DATA[^\]]*\][\s\S]*?\[\/EXTERNAL_DATA\]/g, "").replace(/\[MEMORY_DATA\][\s\S]*?\[\/MEMORY_DATA\]/g, "").replace(/\[EXTERNAL_DATA[^\]]*\]/g, "").replace(/\[\/EXTERNAL_DATA\]/g, "").replace(/\[MEMORY_DATA\]/g, "").replace(/\[\/MEMORY_DATA\]/g, "").replace(/\*{1,3}/g, "").replace(/ {2,}/g, " ");
57135
+ for (const tag2 of ["<memory", "<thinking", "<parameter", "<narration"]) {
57125
57136
  const lastOpen2 = clean2.lastIndexOf(tag2);
57126
57137
  if (lastOpen2 !== -1) {
57127
57138
  const closeTag = `</${tag2.slice(1)}>`;
@@ -57168,6 +57179,28 @@ var init_streaming = __esm({
57168
57179
  * exit.
57169
57180
  */
57170
57181
  deniedIntents = /* @__PURE__ */ new Map();
57182
+ /**
57183
+ * Tools the human refused THIS exchange — since their last message (#470).
57184
+ *
57185
+ * The exact-args ledger above deliberately lets a reworked proposal ask
57186
+ * once more ("a model that meaningfully reworks its arguments gets to ask
57187
+ * once more; the prompt text it just received tells it not to"). That bet
57188
+ * lost, live, 2026-07-29: a weak model reworded the denied paid hire
57189
+ * trivially — folding one more sentence of the user's own words into the
57190
+ * prompt — and re-prompted seconds after the "no", with the terminal
57191
+ * REFUSED_BY_HUMAN instruction in its context. Model compliance cannot
57192
+ * carry a money boundary.
57193
+ *
57194
+ * So the exact ledger gets a complement, not a replacement: within one
57195
+ * exchange, a human denial is terminal for the TOOL, however the arguments
57196
+ * are reworded. The set clears on the next genuine user message
57197
+ * (`beginExchange`) — a human-initiated follow-up can always re-open the
57198
+ * line it closed, so no future request is silently swallowed. Fuzzy arg
57199
+ * matching was rejected for the same reason exact was chosen: a false
57200
+ * match breaks the approval gate; tool-until-next-message cannot
57201
+ * mis-classify.
57202
+ */
57203
+ deniedToolsThisExchange = /* @__PURE__ */ new Set();
57171
57204
  approvalExpiredCallback = null;
57172
57205
  /** Fired when a NEW turn voids a pending approval (#462) — the owning surface renders the void. */
57173
57206
  approvalVoidedCallback = null;
@@ -57230,6 +57263,16 @@ var init_streaming = __esm({
57230
57263
  onApprovalVoided(cb) {
57231
57264
  this.approvalVoidedCallback = cb;
57232
57265
  }
57266
+ /**
57267
+ * Mark the start of a genuine user turn (#470). The exchange-scoped denial
57268
+ * brake stops re-asks BETWEEN user messages; the user's own next message
57269
+ * always releases it — the human can re-open any line they closed, and
57270
+ * only the human can. Callers: user-initiated turns only, never proactive
57271
+ * or system-triggered ones (a consolidation tick must not launder a "no").
57272
+ */
57273
+ beginExchange() {
57274
+ this.deniedToolsThisExchange.clear();
57275
+ }
57233
57276
  /** Shared stream processing — extracts state tags, handles tool/approval/injection chunks. */
57234
57277
  async *processStream(stream, userMessage, runId, options) {
57235
57278
  let result = null;
@@ -57342,6 +57385,27 @@ var init_streaming = __esm({
57342
57385
  type: "text",
57343
57386
  text: `
57344
57387
  [refused already \u2014 not asking again: ${chunk.name}]
57388
+ `
57389
+ };
57390
+ continue;
57391
+ }
57392
+ if (chunk.type === "approval_request" && this.deniedToolsThisExchange.has(chunk.name)) {
57393
+ this.deps.injectIntermediateMessages({
57394
+ role: "assistant",
57395
+ content: `[tool_use: ${chunk.name}(${JSON.stringify(chunk.args)})]`
57396
+ }, {
57397
+ role: "user",
57398
+ content: `[tool_result: ${JSON.stringify({
57399
+ ok: false,
57400
+ error: "REFUSED_BY_HUMAN_THIS_EXCHANGE",
57401
+ terminal: true,
57402
+ message: `The human refused a ${chunk.name} call moments ago in this same exchange. Rewording the arguments does not make it a new request \u2014 this proposal was NOT shown to them. Do not propose ${chunk.name} again until the human sends a new message. Tell the user plainly what you wanted to do and that they declined, then ask what they would like instead.`
57403
+ })}]`
57404
+ });
57405
+ yield {
57406
+ type: "text",
57407
+ text: `
57408
+ [you already declined ${chunk.name} this turn \u2014 not asking again]
57345
57409
  `
57346
57410
  };
57347
57411
  continue;
@@ -57439,6 +57503,7 @@ var init_streaming = __esm({
57439
57503
  } else {
57440
57504
  const key = deniedIntentKey(pending.toolName, pending.args);
57441
57505
  this.deniedIntents.set(key, (this.deniedIntents.get(key) ?? 0) + 1);
57506
+ this.deniedToolsThisExchange.add(pending.toolName);
57442
57507
  this.deps.injectIntermediateMessages({
57443
57508
  role: "assistant",
57444
57509
  content: `[tool_use: ${pending.toolName}(${JSON.stringify(pending.args)})]`
@@ -60750,6 +60815,7 @@ var init_motebit_runtime = __esm({
60750
60815
  this.preemptCycleForUserMessage();
60751
60816
  this._lastUserMessageAt = Date.now();
60752
60817
  this._currentTypedIntent = options?.userActionAttestation ?? null;
60818
+ this.streaming.beginExchange();
60753
60819
  const voidedApproval = this.streaming.voidPendingApproval();
60754
60820
  this.state.pushUpdate({ processing: 0.9, attention: 0.8 });
60755
60821
  this.behavior.setSpeaking(true);
@@ -106408,9 +106474,9 @@ ${summary}`);
106408
106474
  }
106409
106475
  case "model": {
106410
106476
  const MODEL_ALIASES = {
106411
- opus: "claude-opus-4-6-20250414",
106412
- sonnet: "claude-sonnet-4-5-latest",
106413
- haiku: "claude-haiku-4-5-20251001",
106477
+ opus: "claude-opus-5",
106478
+ sonnet: "claude-sonnet-5",
106479
+ haiku: "claude-haiku-4-5",
106414
106480
  "gpt-5.4": "gpt-5.4",
106415
106481
  "gpt-5.4-mini": "gpt-5.4-mini",
106416
106482
  "gpt-5.4-nano": "gpt-5.4-nano",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motebit",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "type": "module",
5
5
  "description": "Reference runtime and operator console for sovereign AI agents — REPL, daemon, delegation, MCP server. Persistent Ed25519 identity, signed execution receipts, governance at the boundary.",
6
6
  "main": "./dist/index.js",
@@ -76,30 +76,30 @@
76
76
  "typescript": "^5.6.0",
77
77
  "vitest": "^4.1.10",
78
78
  "@motebit/ai-core": "0.0.0-private",
79
- "@motebit/behavior-engine": "0.0.0-private",
80
79
  "@motebit/core-identity": "0.0.0-private",
81
80
  "@motebit/crypto": "3.19.1",
81
+ "@motebit/behavior-engine": "0.0.0-private",
82
82
  "@motebit/encryption": "0.0.0-private",
83
83
  "@motebit/event-log": "0.0.0-private",
84
- "@motebit/gradient": "0.0.0-private",
85
84
  "@motebit/identity-file": "0.0.0-private",
86
85
  "@motebit/mcp-client": "0.0.0-private",
86
+ "@motebit/gradient": "0.0.0-private",
87
87
  "@motebit/mcp-server": "0.0.0-private",
88
- "@motebit/memory-graph": "0.0.0-private",
89
88
  "@motebit/persistence": "0.0.0-private",
89
+ "@motebit/memory-graph": "0.0.0-private",
90
90
  "@motebit/protocol": "3.15.1",
91
91
  "@motebit/planner": "0.0.0-private",
92
- "@motebit/policy": "0.0.0-private",
93
92
  "@motebit/privacy-layer": "0.0.0-private",
93
+ "@motebit/policy": "0.0.0-private",
94
94
  "@motebit/relay": "0.0.0-private",
95
95
  "@motebit/relay-client": "0.0.0-private",
96
- "@motebit/runtime": "0.0.0-private",
97
96
  "@motebit/runtime-host": "0.0.0-private",
98
97
  "@motebit/sdk": "2.5.4",
99
98
  "@motebit/self-knowledge": "0.0.0-private",
100
- "@motebit/skills": "0.0.0-private",
99
+ "@motebit/runtime": "0.0.0-private",
101
100
  "@motebit/state-vector": "0.0.0-private",
102
101
  "@motebit/sync-engine": "0.0.0-private",
102
+ "@motebit/skills": "0.0.0-private",
103
103
  "@motebit/tools": "0.0.0-private",
104
104
  "@motebit/verify": "1.8.12",
105
105
  "@motebit/voice": "0.0.0-private",