@motir/cli 0.11.1 → 0.11.2

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 +52 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ var __export = (target, all) => {
9
9
  import { Command as Command2, Option } from "commander";
10
10
 
11
11
  // package.json
12
- var version = "0.11.1";
12
+ var version = "0.11.2";
13
13
 
14
14
  // src/version.ts
15
15
  var CLI_VERSION = version;
@@ -59004,7 +59004,7 @@ var HOSTED_AGENT_ENV_KEYS = [
59004
59004
  var MAX_ARGV_PROMPT_BYTES2 = 100 * 1024;
59005
59005
  var EGRESS_DOCUMENT = {
59006
59006
  $schema: "https://opencode.ai/config.json",
59007
- enabled_providers: ["anthropic", "deepseek"],
59007
+ enabled_providers: ["anthropic", "deepseek", "z-ai", "qwen"],
59008
59008
  provider: {
59009
59009
  anthropic: {
59010
59010
  options: {
@@ -59017,19 +59017,41 @@ var EGRESS_DOCUMENT = {
59017
59017
  baseURL: "{env:MOTIR_GATEWAY_URL}/v1",
59018
59018
  apiKey: "{env:MOTIR_RUN_KEY}"
59019
59019
  }
59020
+ },
59021
+ "z-ai": {
59022
+ npm: "@ai-sdk/openai-compatible",
59023
+ options: {
59024
+ baseURL: "{env:MOTIR_GATEWAY_URL}/v1",
59025
+ apiKey: "{env:MOTIR_RUN_KEY}"
59026
+ }
59027
+ },
59028
+ qwen: {
59029
+ npm: "@ai-sdk/openai-compatible",
59030
+ options: {
59031
+ baseURL: "{env:MOTIR_GATEWAY_URL}/v1",
59032
+ apiKey: "{env:MOTIR_RUN_KEY}"
59033
+ }
59020
59034
  }
59021
59035
  },
59022
59036
  share: "disabled",
59023
59037
  autoupdate: false
59024
59038
  };
59025
59039
  var HOSTED_MODEL_PROVIDERS = EGRESS_DOCUMENT.enabled_providers;
59026
- function egressConfig() {
59027
- return JSON.stringify(EGRESS_DOCUMENT);
59040
+ function egressConfig(model) {
59041
+ const slash = model ? model.indexOf("/") : -1;
59042
+ const provider = slash > 0 ? model.slice(0, slash) : "";
59043
+ const id = slash > 0 ? model.slice(slash + 1) : "";
59044
+ const block = EGRESS_DOCUMENT.provider[provider];
59045
+ if (!block || !("npm" in block) || !id) return JSON.stringify(EGRESS_DOCUMENT);
59046
+ return JSON.stringify({
59047
+ ...EGRESS_DOCUMENT,
59048
+ provider: { ...EGRESS_DOCUMENT.provider, [provider]: { ...block, models: { [id]: {} } } }
59049
+ });
59028
59050
  }
59029
59051
  function hostedAgentEnv(env) {
59030
59052
  const source = {
59031
59053
  ...env,
59032
- OPENCODE_CONFIG_CONTENT: egressConfig(),
59054
+ OPENCODE_CONFIG_CONTENT: egressConfig(env[HOSTED_MODEL_ENV]?.trim()),
59033
59055
  OPENCODE_DISABLE_AUTOUPDATE: "true",
59034
59056
  OPENCODE_DISABLE_MODELS_FETCH: "true",
59035
59057
  OPENCODE_DISABLE_CLAUDE_CODE: "true"
@@ -59622,6 +59644,10 @@ function createLegLogTee(reporter, workItemKey) {
59622
59644
  // src/dispatchRunReporter.ts
59623
59645
  var REPORTER_QUEUE_LIMIT = 500;
59624
59646
  var REPORTER_BATCH_LIMIT = 200;
59647
+ var FLUSH_ON_ENQUEUE = /* @__PURE__ */ new Set([
59648
+ "run_opened",
59649
+ "checkout_ready"
59650
+ ]);
59625
59651
  var REPORTER_OFFLINE_WARNING = "motir: run reporting is unavailable \u2014 this run will not appear in Motir. The run itself is unaffected.";
59626
59652
  var RUN_HEARTBEAT_INTERVAL_MS = 6e4;
59627
59653
  var REPORTER_RUN_CLOSED_WARNING = "motir: Motir closed this run \u2014 it heard nothing from it for five minutes. The work on this machine continues; it is no longer reported.";
@@ -59658,7 +59684,8 @@ function createDispatchRunReporter(deps) {
59658
59684
  function startHeartbeat(id) {
59659
59685
  const client = deps.client;
59660
59686
  if (client.heartbeatDispatchRun === void 0 || heartbeat !== null) return;
59661
- heartbeat = setInterval(() => {
59687
+ const beat = () => {
59688
+ void flushQueue();
59662
59689
  if (client.heartbeatDispatchRun === void 0) return;
59663
59690
  void client.heartbeatDispatchRun(id).then(
59664
59691
  (answer) => {
@@ -59669,8 +59696,10 @@ function createDispatchRunReporter(deps) {
59669
59696
  },
59670
59697
  () => void 0
59671
59698
  );
59672
- }, RUN_HEARTBEAT_INTERVAL_MS);
59699
+ };
59700
+ heartbeat = setInterval(beat, RUN_HEARTBEAT_INTERVAL_MS);
59673
59701
  heartbeat.unref?.();
59702
+ beat();
59674
59703
  }
59675
59704
  function goOffline() {
59676
59705
  if (offline) return;
@@ -59686,6 +59715,20 @@ function createDispatchRunReporter(deps) {
59686
59715
  goOffline();
59687
59716
  }
59688
59717
  }
59718
+ function flushQueue() {
59719
+ const id = runId;
59720
+ if (offline || id === null) return Promise.resolve();
59721
+ const send = inFlight.then(async () => {
59722
+ while (!offline && queue.length > 0) {
59723
+ const batch = queue.splice(0, REPORTER_BATCH_LIMIT);
59724
+ await attempt(
59725
+ () => deps.client.appendDispatchRunEvents({ runId: id, events: batch }).then(() => void 0)
59726
+ );
59727
+ }
59728
+ });
59729
+ inFlight = send;
59730
+ return send;
59731
+ }
59689
59732
  return {
59690
59733
  get offline() {
59691
59734
  return offline;
@@ -59743,20 +59786,10 @@ function createDispatchRunReporter(deps) {
59743
59786
  const scrubbed = deps.reportLogBodies ? event : (({ body: _body, ...rest }) => rest)(event);
59744
59787
  queue.push(scrubbed);
59745
59788
  while (queue.length > REPORTER_QUEUE_LIMIT) queue.shift();
59789
+ if (FLUSH_ON_ENQUEUE.has(event.kind)) void flushQueue();
59746
59790
  },
59747
59791
  async flush() {
59748
- const id = runId;
59749
- if (offline || id === null || queue.length === 0) return;
59750
- const send = inFlight.then(async () => {
59751
- while (!offline && queue.length > 0) {
59752
- const batch = queue.splice(0, REPORTER_BATCH_LIMIT);
59753
- await attempt(
59754
- () => deps.client.appendDispatchRunEvents({ runId: id, events: batch }).then(() => void 0)
59755
- );
59756
- }
59757
- });
59758
- inFlight = send;
59759
- await send;
59792
+ await flushQueue();
59760
59793
  },
59761
59794
  async close(stopReason) {
59762
59795
  const id = runId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motir/cli",
3
- "version": "0.11.1",
3
+ "version": "0.11.2",
4
4
  "description": "Motir CLI — terminal dispatch of the work loop, over Motir's public REST API.",
5
5
  "license": "GPL-3.0-only",
6
6
  "repository": {