@shipers-dev/multi 0.8.1 → 0.8.3

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.
package/dist/index.js CHANGED
@@ -5355,6 +5355,14 @@ ${entries}` } });
5355
5355
  async function handleRequestPermission(params, o, allowCache) {
5356
5356
  const tc = params.toolCall || {};
5357
5357
  const toolKey = `${tc.toolName || tc.title || ""}|${tc.kind || ""}`.toLowerCase();
5358
+ if (o.autonomy === "auto") {
5359
+ const opts2 = params.options;
5360
+ const alwaysOpt = opts2.find((op) => /always/i.test(op.name || "") || /allow_always/i.test(op.kind || ""));
5361
+ const allowOpt = opts2.find((op) => /allow/i.test(op.kind || "") || /allow/i.test(op.name || ""));
5362
+ const chosen = alwaysOpt || allowOpt;
5363
+ if (chosen)
5364
+ return { outcome: { outcome: "selected", optionId: chosen.optionId } };
5365
+ }
5358
5366
  if (toolKey && allowCache.has(toolKey)) {
5359
5367
  const allowOpt = params.options.find((op) => /allow/i.test(op.kind || "") || /allow/i.test(op.name || ""));
5360
5368
  if (allowOpt)
@@ -6332,6 +6340,7 @@ ${userPart}` : userPart;
6332
6340
  prompt,
6333
6341
  sessionId: task.session_id || null,
6334
6342
  adapterBin,
6343
+ autonomy: task.autonomy_level,
6335
6344
  cwd: workingDir,
6336
6345
  onEvent: eventHandler,
6337
6346
  onSession: async (sid) => {
@@ -6575,7 +6584,7 @@ async function executePlanActions(apiUrl, parentTask, actions, ctx) {
6575
6584
  continue;
6576
6585
  }
6577
6586
  const created = res.data;
6578
- lines.push(`- \u2713 created **${created.key}** \u2014 ${created.title}${created.assignee_id ? ` \u2192 @${created.assignee_id}` : ""} (autonomy=${created.autonomy_level || "ask"})`);
6587
+ lines.push(`- \u2713 created **${created.key}** \u2014 ${created.title}${created.assignee_id ? ` \u2192 @${created.assignee_id}` : ""} (autonomy=${created.autonomy_level || "auto"})`);
6579
6588
  } else if (a.type === "update") {
6580
6589
  const res = await apiClient.post(`${apiUrl}/api/issues/agent/mutate`, { action: "update", ...a }, { headers });
6581
6590
  if (!res.success) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipers-dev/multi",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "multi-agent": "./dist/index.js"
package/src/acp-runner.ts CHANGED
@@ -24,6 +24,7 @@ export type AcpRunOpts = {
24
24
  cwd?: string;
25
25
  sessionId?: string | null;
26
26
  adapterBin: string | string[]; // command + args to spawn ACP agent
27
+ autonomy?: 'manual' | 'ask' | 'auto';
27
28
  onEvent: (ev: AcpEvent) => void | Promise<void>;
28
29
  onSession?: (sessionId: string) => void | Promise<void>;
29
30
  };
@@ -205,6 +206,15 @@ export async function runAcp(opts: AcpRunOpts): Promise<{ stopReason: string; se
205
206
  const tc: any = params.toolCall || {};
206
207
  const toolKey = `${tc.toolName || tc.title || ''}|${tc.kind || ''}`.toLowerCase();
207
208
 
209
+ // Autonomy=auto: auto-approve everything, prefer "always" variant so adapter caches it.
210
+ if (o.autonomy === 'auto') {
211
+ const opts = params.options as any[];
212
+ const alwaysOpt = opts.find(op => /always/i.test(op.name || '') || /allow_always/i.test(op.kind || ''));
213
+ const allowOpt = opts.find(op => /allow/i.test(op.kind || '') || /allow/i.test(op.name || ''));
214
+ const chosen = alwaysOpt || allowOpt;
215
+ if (chosen) return { outcome: { outcome: 'selected', optionId: chosen.optionId } as any };
216
+ }
217
+
208
218
  // Auto-approve if user previously chose "always allow" for same tool/kind
209
219
  if (toolKey && allowCache.has(toolKey)) {
210
220
  const allowOpt = (params.options as any[]).find(op => /allow/i.test(op.kind || '') || /allow/i.test(op.name || ''));
package/src/index.ts CHANGED
@@ -682,6 +682,7 @@ async function handleRunTask(apiUrl: string, deviceId: string, task: any, detect
682
682
  apiUrl, issueId, deviceId, prompt,
683
683
  sessionId: task.session_id || null,
684
684
  adapterBin,
685
+ autonomy: task.autonomy_level,
685
686
  cwd: workingDir,
686
687
  onEvent: eventHandler,
687
688
  onSession: async (sid) => {
@@ -892,7 +893,7 @@ async function executePlanActions(apiUrl: string, parentTask: any, actions: Plan
892
893
  const res = await apiClient.post<any>(`${apiUrl}/api/issues/agent/mutate`, body, { headers });
893
894
  if (!res.success) { lines.push(`- ❌ create "${a.title}": ${res.error || res.status}`); continue; }
894
895
  const created = res.data;
895
- lines.push(`- ✓ created **${created.key}** — ${created.title}${created.assignee_id ? ` → @${created.assignee_id}` : ''} (autonomy=${created.autonomy_level || 'ask'})`);
896
+ lines.push(`- ✓ created **${created.key}** — ${created.title}${created.assignee_id ? ` → @${created.assignee_id}` : ''} (autonomy=${created.autonomy_level || 'auto'})`);
896
897
  } else if (a.type === 'update') {
897
898
  const res = await apiClient.post<any>(`${apiUrl}/api/issues/agent/mutate`, { action: 'update', ...a }, { headers });
898
899
  if (!res.success) { lines.push(`- ❌ update ${a.id}: ${res.error || res.status}`); continue; }