@dimi-agent/cli 0.4.3 → 0.4.4

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/main.mjs +44 -12
  2. package/package.json +6 -6
package/dist/main.mjs CHANGED
@@ -296603,6 +296603,26 @@ const ADD_DIR_ARG_COMPLETIONS = [{
296603
296603
  value: "list",
296604
296604
  description: "Show configured additional workspace directories"
296605
296605
  }];
296606
+ /**
296607
+ * Busy-state availability policy for built-in commands.
296608
+ *
296609
+ * A command is either:
296610
+ * - `always` — usable while a turn is streaming or the context is compacting.
296611
+ * This covers read-only queries, pure UI commands, and session
296612
+ * *configuration* changes (permission, plan mode, model, thinking effort,
296613
+ * title, workspace dirs, auth…): the engine snapshots the model, thinking
296614
+ * effort, and system prompt per turn, so config writes never race an
296615
+ * in-flight request and take effect from the next turn.
296616
+ * - `idle-only` — requires an idle agent: commands that rewrite conversation
296617
+ * history (`/undo`, `/compact`), start or stop a turn (`/goal` creation,
296618
+ * `/swarm <task>`, `/init`), or switch/rebuild the session (`/new`,
296619
+ * `/sessions`, `/fork`, `/reload`, `/experiments`, `/plan clear`).
296620
+ *
296621
+ * Commands without an explicit `availability` default to `idle-only` (see
296622
+ * `resolveSlashCommandAvailability`). A command's handler must never block an
296623
+ * `always` command while busy — the apply layer has no business re-gating what
296624
+ * the registry already allowed (that was the old model-switch guard).
296625
+ */
296606
296626
  /** Argument autocompletion for the `/goal` command (subcommands). */
296607
296627
  function goalArgumentCompletions(argumentPrefix) {
296608
296628
  const nextMatch = argumentPrefix.match(/^next\s+(\S*)$/i);
@@ -296727,7 +296747,10 @@ const BUILTIN_SLASH_COMMANDS = [
296727
296747
  priority: 100,
296728
296748
  argumentHint: "[on|off] | <task>",
296729
296749
  completeArgs: swarmArgumentCompletions,
296730
- availability: "idle-only"
296750
+ availability: (args) => {
296751
+ const sub = args.trim().toLowerCase();
296752
+ return sub === "" || sub === "on" || sub === "off" ? "always" : "idle-only";
296753
+ }
296731
296754
  },
296732
296755
  {
296733
296756
  name: "model",
@@ -296811,7 +296834,7 @@ const BUILTIN_SLASH_COMMANDS = [
296811
296834
  aliases: [],
296812
296835
  description: "Add or list an additional workspace directory",
296813
296836
  priority: 60,
296814
- availability: "idle-only",
296837
+ availability: "always",
296815
296838
  argumentHint: "[list] | <path>",
296816
296839
  completeArgs: addDirArgumentCompletions
296817
296840
  },
@@ -296921,32 +296944,37 @@ const BUILTIN_SLASH_COMMANDS = [
296921
296944
  name: "logout",
296922
296945
  aliases: ["disconnect"],
296923
296946
  description: "Log out of a configured provider",
296924
- priority: 40
296947
+ priority: 40,
296948
+ availability: "always"
296925
296949
  },
296926
296950
  {
296927
296951
  name: "login",
296928
296952
  aliases: [],
296929
296953
  description: "Connect an AI provider with an account or API key",
296930
296954
  priority: 40,
296931
- argumentHint: "[provider]"
296955
+ argumentHint: "[provider]",
296956
+ availability: "always"
296932
296957
  },
296933
296958
  {
296934
296959
  name: "export-md",
296935
296960
  aliases: ["export"],
296936
296961
  description: "Export current session as a Markdown file",
296937
- priority: 40
296962
+ priority: 40,
296963
+ availability: "always"
296938
296964
  },
296939
296965
  {
296940
296966
  name: "export-debug-zip",
296941
296967
  aliases: [],
296942
296968
  description: "Export current session as a debug ZIP archive",
296943
- priority: 40
296969
+ priority: 40,
296970
+ availability: "always"
296944
296971
  },
296945
296972
  {
296946
296973
  name: "copy",
296947
296974
  aliases: [],
296948
296975
  description: "Copy the last assistant message to the clipboard",
296949
- priority: 40
296976
+ priority: 40,
296977
+ availability: "always"
296950
296978
  },
296951
296979
  {
296952
296980
  name: "web",
@@ -296959,7 +296987,8 @@ const BUILTIN_SLASH_COMMANDS = [
296959
296987
  name: "exit",
296960
296988
  aliases: ["quit", "q"],
296961
296989
  description: "Exit the application",
296962
- priority: 20
296990
+ priority: 20,
296991
+ availability: "always"
296963
296992
  },
296964
296993
  {
296965
296994
  name: "version",
@@ -310787,11 +310816,14 @@ async function rememberedEffortForModel(host, model) {
310787
310816
  if (config === void 0) return void 0;
310788
310817
  return rememberedEffortFromConfig(config, model);
310789
310818
  }
310819
+ /**
310820
+ * Apply a model / thinking-effort switch. Safe while a turn is streaming or
310821
+ * the context is compacting: the engine snapshots model, effort, and system
310822
+ * prompt per turn, so the change takes effect from the next turn and never
310823
+ * races an in-flight request. The registry marks both `/model` and `/effort`
310824
+ * as `always`; this function must not re-gate them on busy state.
310825
+ */
310790
310826
  async function performModelSwitch(host, alias, effort, persist) {
310791
- if (host.state.appState.streamingPhase !== "idle") {
310792
- host.showError("Cannot switch models while streaming — press Esc or Ctrl-C first.");
310793
- return;
310794
- }
310795
310827
  const prevModel = host.state.appState.model;
310796
310828
  const prevEffort = host.state.appState.thinkingEffort;
310797
310829
  const modelChanged = alias !== prevModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dimi-agent/cli",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "The Starting Point for Next-Gen Agents",
5
5
  "keywords": [
6
6
  "agent",
@@ -59,14 +59,14 @@
59
59
  "tsx": "^4.21.0",
60
60
  "yazl": "^3.3.1",
61
61
  "zod": "^4.3.6",
62
- "@dimi-agent/agent-core-v2": "^0.1.0",
63
- "@dimi-agent/dimi-sdk": "^0.2.0",
64
62
  "@dimi-agent/dimi-oauth": "^0.1.0",
65
- "@dimi-agent/dimi-telemetry": "^0.1.0",
63
+ "@dimi-agent/dimi-sdk": "^0.2.0",
66
64
  "@dimi-agent/dimi-web": "^0.1.0",
67
- "@dimi-agent/kap-server": "^0.1.0",
65
+ "@dimi-agent/dimi-telemetry": "^0.1.0",
66
+ "@dimi-agent/agent-core-v2": "^0.1.0",
67
+ "@dimi-agent/remote": "^0.1.0",
68
68
  "@dimi-agent/pi-tui": "^0.1.0",
69
- "@dimi-agent/remote": "^0.1.0"
69
+ "@dimi-agent/kap-server": "^0.1.0"
70
70
  },
71
71
  "optionalDependencies": {
72
72
  "@mariozechner/clipboard": "^0.3.9",