ai_co_discuss 0.2.13 → 0.2.15

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.
@@ -149,7 +149,8 @@ export class FreeRoomRunner {
149
149
  /** A retried client id returns the original execution; a finished or refused one just goes idle. */
150
150
  async reserve(member, record) {
151
151
  let execution;
152
- const cwd = cwd_key(this.config.participants[member.name]?.cwd || this.config.cwd);
152
+ const profile = this.config.participants[member.name];
153
+ const cwd = profile?.adapter === 'api' ? '' : cwd_key(profile?.cwd || this.config.cwd);
153
154
  try { execution = await api(this.config, '/executions', { member_id: member.id, client_id: record.client_id, cwd }); }
154
155
  catch (error) {
155
156
  if (/HTTP (404|409)/.test(error.message)) return this.save(member.name, { status: 'idle', error: '' });
@@ -164,7 +165,7 @@ export class FreeRoomRunner {
164
165
  const adapter = this.config.participants[member.name];
165
166
  if (!adapter) return this.fail(member.name, execution.id, `未配置 ${member.name} 的本机接入`);
166
167
  if (this.context_errors.has(member.name)) return this.fail(member.name, execution.id, this.context_errors.get(member.name));
167
- const directory = adapter.cwd || this.config.cwd;
168
+ const directory = adapter.adapter === 'api' ? undefined : adapter.cwd || this.config.cwd;
168
169
  const before = workspace_snapshot(directory);
169
170
  if (before) this.snapshots.set(execution.id, { member: member.name, directory, before });
170
171
  const binding = this.store.binding(member.name);
@@ -174,6 +175,9 @@ export class FreeRoomRunner {
174
175
  const task = free_task_files(this.config, member, execution, binding);
175
176
  invoked = true;
176
177
  const result = await this.deliver(adapter, binding, { ...task, room_title: this.room_title,
178
+ api_context: { site: this.config.site, room: this.config.room, token: this.config.members[member.name].token,
179
+ home: this.config.api_home, mode: 'free', role: member.role || 'member', execution_id: execution.id,
180
+ requests: execution.requests, read_after: execution.read_until },
177
181
  on_binding: session => this.store.bind(member.name, session),
178
182
  on_process: child => this.track(member.name, child),
179
183
  on_output: (path, chunk) => appendFileSync(path, chunk, { mode: 0o600 }),