@shipers-dev/multi 0.8.0 → 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 +348 -339
- package/package.json +1 -1
- package/src/acp-runner.ts +10 -0
- package/src/index.ts +3 -2
package/package.json
CHANGED
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) => {
|
|
@@ -852,7 +853,7 @@ function extractPlanActions(text: string): PlanAction[] {
|
|
|
852
853
|
|
|
853
854
|
const PLAN_ACTION_LIMIT = 10;
|
|
854
855
|
|
|
855
|
-
async function executePlanActions(apiUrl: string, parentTask: any, actions: PlanAction[],
|
|
856
|
+
async function executePlanActions(apiUrl: string, parentTask: any, actions: PlanAction[], ctx: RuntimeCtx): Promise<string> {
|
|
856
857
|
const lines: string[] = [];
|
|
857
858
|
let truncated = false;
|
|
858
859
|
if (actions.length > PLAN_ACTION_LIMIT) {
|
|
@@ -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 || '
|
|
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; }
|