@siftd/connect-agent 0.2.48 → 0.2.50

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.
@@ -206,6 +206,7 @@ export declare class MasterOrchestrator {
206
206
  private updateFileScope;
207
207
  private getTeamFilesDir;
208
208
  private getFileScopeOverrides;
209
+ private rewriteFilesAlias;
209
210
  private getFileScopeSystemNote;
210
211
  /**
211
212
  * Check if verbose mode is enabled
@@ -19,7 +19,7 @@ import { WorkerTools } from './tools/worker.js';
19
19
  import { CalendarTools } from './tools/calendar.js';
20
20
  import { SharedState } from './workers/shared-state.js';
21
21
  import { getKnowledgeForPrompt } from './genesis/index.js';
22
- import { loadHubContext, formatHubContext, logAction, logWorker } from './core/hub.js';
22
+ import { loadHubContext, formatHubContext, logAction, logWorker, getSharedOutputPath } from './core/hub.js';
23
23
  import { buildWorkerPrompt } from './prompts/worker-system.js';
24
24
  import { LiaTaskQueue } from './core/task-queue.js';
25
25
  /**
@@ -839,6 +839,16 @@ export class MasterOrchestrator {
839
839
  instructions: `TEAM FILES DIRECTORY: ${teamDir}\nSave any requested files under this directory so they appear in /files (Team Files). Create the directory if needed.`,
840
840
  };
841
841
  }
842
+ rewriteFilesAlias(task) {
843
+ if (!task.includes('/files'))
844
+ return task;
845
+ const teamDir = this.currentFileScope === 'team' ? this.getTeamFilesDir() : null;
846
+ const targetDir = teamDir || getSharedOutputPath();
847
+ return task.replace(/\/files(\/[^\s"'`)]*)?/gi, (match) => {
848
+ const suffix = match.slice('/files'.length);
849
+ return `${targetDir}${suffix}`;
850
+ });
851
+ }
842
852
  getFileScopeSystemNote() {
843
853
  if (this.currentFileScope !== 'team')
844
854
  return null;
@@ -879,6 +889,25 @@ export class MasterOrchestrator {
879
889
  this.attachmentContext = null;
880
890
  }
881
891
  }
892
+ const wantsFiles = this.hasFileMutation(message);
893
+ if (wantsFiles) {
894
+ this.attachmentContext = this.extractAttachmentContext(message);
895
+ const { task } = this.withAttachments(message);
896
+ const normalizedTask = this.rewriteFilesAlias(task);
897
+ const fileScope = this.getFileScopeOverrides();
898
+ const scopedTask = fileScope.instructions ? `${fileScope.instructions}\n\n${normalizedTask}` : normalizedTask;
899
+ try {
900
+ await this.delegateToWorker(scopedTask, undefined, fileScope.workingDir, fileScope.instructions);
901
+ return 'Working on it. Check /files shortly.';
902
+ }
903
+ catch (error) {
904
+ const errorMessage = error instanceof Error ? error.message : String(error);
905
+ return `Error: ${errorMessage}`;
906
+ }
907
+ finally {
908
+ this.attachmentContext = null;
909
+ }
910
+ }
882
911
  // DISABLED: Dumb regex extraction was creating garbage todos
883
912
  // Let the AI use calendar_upsert_events and todo_upsert_items tools properly
884
913
  // const quickWrite = this.tryHandleCalendarTodo(message);
@@ -2099,7 +2128,8 @@ Unlike lia_plan (internal only), this creates a VISIBLE todo list that appears i
2099
2128
  case 'spawn_worker': {
2100
2129
  const { task } = this.withAttachments(input.task);
2101
2130
  const fileScope = this.getFileScopeOverrides();
2102
- const scopedTask = fileScope.instructions ? `${fileScope.instructions}\n\n${task}` : task;
2131
+ const normalizedTask = this.rewriteFilesAlias(task);
2132
+ const scopedTask = fileScope.instructions ? `${fileScope.instructions}\n\n${normalizedTask}` : normalizedTask;
2103
2133
  result = await this.workerTools.spawnWorker(scopedTask, {
2104
2134
  timeout: input.timeout,
2105
2135
  priority: input.priority,
@@ -2123,7 +2153,8 @@ Unlike lia_plan (internal only), this creates a VISIBLE todo list that appears i
2123
2153
  case 'delegate_to_worker': {
2124
2154
  const { task, context } = this.withAttachments(input.task, input.context);
2125
2155
  const fileScope = this.getFileScopeOverrides();
2126
- result = await this.delegateToWorker(task, context, input.working_directory || fileScope.workingDir, fileScope.instructions);
2156
+ const normalizedTask = this.rewriteFilesAlias(task);
2157
+ result = await this.delegateToWorker(normalizedTask, context, input.working_directory || fileScope.workingDir, fileScope.instructions);
2127
2158
  break;
2128
2159
  }
2129
2160
  case 'remember':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siftd/connect-agent",
3
- "version": "0.2.48",
3
+ "version": "0.2.50",
4
4
  "description": "Master orchestrator agent - control Claude Code remotely via web",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",