@codeagentswarm/cas-cloud 0.0.12 → 0.0.16

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.
@@ -3809,6 +3809,18 @@ var require_mcp_stdio_server = __commonJS({
3809
3809
  } catch (e) {
3810
3810
  }
3811
3811
  }
3812
+ _hasNudgeMarker(kind) {
3813
+ try {
3814
+ const os3 = require("os");
3815
+ const fs3 = require("fs");
3816
+ const stateDir = path2.join(os3.homedir(), ".codeagentswarm", "terminal-nudge-state");
3817
+ const rawKey = process.env.CODEAGENTSWARM_TERMINAL_ID || process.env.CODEAGENTSWARM_CURRENT_QUADRANT;
3818
+ const key = String(rawKey || "").replace(/[^A-Za-z0-9_-]/g, "_");
3819
+ return !!key && fs3.existsSync(path2.join(stateDir, `${key}.${kind}`));
3820
+ } catch (e) {
3821
+ return false;
3822
+ }
3823
+ }
3812
3824
  // Resolve the current terminal id (1-based) from the environment.
3813
3825
  _getCurrentTerminalId() {
3814
3826
  const terminalId = process.env.CODEAGENTSWARM_CURRENT_QUADRANT;
@@ -3827,20 +3839,30 @@ var require_mcp_stdio_server = __commonJS({
3827
3839
  }
3828
3840
  // Set the GENERAL terminal title: the sticky tab label that represents the
3829
3841
  // product-level goal of what this terminal is working on. Set it ONCE at the
3830
- // start of work; call it again only to refine when the overall functionality
3831
- // changes, or to replace it when the terminal pivots to a radically different
3832
- // topic. It does NOT represent the current step — use update_terminal_activity
3833
- // for that.
3842
+ // start of the conversation. Later calls preserve it unless the caller explicitly
3843
+ // declares a radical topic change. It does NOT represent the current step — use
3844
+ // update_terminal_activity for that.
3834
3845
  async setTerminalTitle(params) {
3835
- const { title, long_title } = params;
3846
+ const { title, long_title, replace_existing } = params;
3836
3847
  if (!title) {
3837
3848
  throw new Error("title is required");
3838
3849
  }
3839
3850
  if (isPlaceholderTitle(title)) {
3840
3851
  throw new Error(`"${title}" looks like example text copied from the tool documentation, not a real title. Call the tool again with a title that describes the ACTUAL feature or goal you are working on in this agent (max 6 words).`);
3841
3852
  }
3842
- const shortTitle = this.generateShortTitle(title);
3853
+ if (replace_existing !== void 0 && typeof replace_existing !== "boolean") {
3854
+ throw new Error("replace_existing must be a boolean");
3855
+ }
3843
3856
  const terminalId = this._getCurrentTerminalId();
3857
+ if (replace_existing !== true && this._hasNudgeMarker("title")) {
3858
+ return {
3859
+ terminal_id: terminalId,
3860
+ updated: false,
3861
+ preserved: true,
3862
+ message: "The existing conversation title was preserved. Use update_terminal_activity for follow-up work; set replace_existing=true only after the user pivots to a completely different functionality."
3863
+ };
3864
+ }
3865
+ const shortTitle = this.generateShortTitle(title);
3844
3866
  const currentTask = this._getCurrentTask(terminalId);
3845
3867
  const taskId = currentTask ? currentTask.id : null;
3846
3868
  let longTitle = long_title;
@@ -4738,7 +4760,7 @@ Use 'clear' to remove the status.`;
4738
4760
  },
4739
4761
  {
4740
4762
  name: "set_terminal_title",
4741
- description: 'Set the GENERAL agent title AND the agent GOAL \u2014 pass BOTH arguments, because the user sees them together. `title` is the sticky Agent tab label at the FEATURE level (e.g. "Promo video for Twitter", "Minimize agents"); `long_title` is one sentence on what this agent is FOR, shown in the hover under the title. Keep the title high-level: name the feature, not a low-level step or work phase. Set it once at the start, then only refine it when the overall goal changes. Use update_terminal_activity for the current step. LANGUAGE: write BOTH in the SAME language the user is speaking.',
4763
+ description: "Set the GENERAL agent title AND the agent GOAL from the first user request that established this conversation's topic. Pass BOTH text arguments because the user sees them together. This is once per conversation, NOT once per user message, turn, task, review, validation, or resumed session. Follow-up work belongs in update_terminal_activity and repeated calls preserve the original title. Only a user pivot to a completely different functionality may replace it, by passing replace_existing=true. LANGUAGE: write both text fields in the SAME language the user is speaking.",
4742
4764
  inputSchema: {
4743
4765
  type: "object",
4744
4766
  properties: {
@@ -4749,6 +4771,10 @@ Use 'clear' to remove the status.`;
4749
4771
  long_title: {
4750
4772
  type: "string",
4751
4773
  description: `The agent GOAL: one sentence saying what this agent is FOR \u2014 the outcome the work is aiming at, not the current step. ALWAYS provide it: the user reads it in the Agent hover, labelled GOAL, under the short title. Write the real goal in the user's language. Do NOT restate the title or prefix it with "Working on:".`
4774
+ },
4775
+ replace_existing: {
4776
+ type: "boolean",
4777
+ description: "Leave false or omit for normal follow-up work. Set true ONLY when the user explicitly pivots this existing conversation to a completely different functionality; reviews, tests, fixes, implementation phases, and refinements of the original request are activities and must not replace the title."
4752
4778
  }
4753
4779
  },
4754
4780
  // long_title is NOT in `required` on purpose: some agent clients
@@ -5202,7 +5228,8 @@ Use 'clear' to remove the status.`;
5202
5228
  case "set_terminal_title":
5203
5229
  result = await this.setTerminalTitle({
5204
5230
  title: args.title,
5205
- long_title: args.long_title
5231
+ long_title: args.long_title,
5232
+ replace_existing: args.replace_existing
5206
5233
  });
5207
5234
  break;
5208
5235
  case "update_terminal_activity":