orquesta-agent 0.2.262 → 0.2.263
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/executor.d.ts +17 -0
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js +109 -16
- package/dist/executor.js.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/supabase.d.ts +2 -0
- package/dist/supabase.d.ts.map +1 -1
- package/dist/supabase.js.map +1 -1
- package/package.json +1 -1
package/dist/executor.d.ts
CHANGED
|
@@ -45,7 +45,24 @@ export interface ExecuteOptions {
|
|
|
45
45
|
itemId: string;
|
|
46
46
|
branch: string;
|
|
47
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Read-only task (an outside agent holding only the `read` scope on the
|
|
50
|
+
* project). Runs on Claude CLI with no tool that can write or run code —
|
|
51
|
+
* see readOnlyCliArgs(). Any other CLI fails the prompt instead.
|
|
52
|
+
*/
|
|
53
|
+
readOnly?: boolean;
|
|
48
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Claude CLI flags for a read-only task. Only the file-reading tools exist
|
|
57
|
+
* (--tools), the write/exec ones are denied on top (--disallowedTools, which
|
|
58
|
+
* beats any allow rule from a settings file), secrets are denied through a
|
|
59
|
+
* --settings file, project MCP servers are not loaded, and permissions are
|
|
60
|
+
* NOT skipped — anything else that would need approval is refused in -p mode.
|
|
61
|
+
* There is no Bash, so the agent hands the model a git snapshot itself
|
|
62
|
+
* (readOnlyRepoSnapshot). An older CLI that rejects one of these flags fails
|
|
63
|
+
* the run: closed, never open.
|
|
64
|
+
*/
|
|
65
|
+
export declare function readOnlyCliArgs(settingsPath: string): string[];
|
|
49
66
|
export interface AuthConfig {
|
|
50
67
|
anthropicApiKey?: string;
|
|
51
68
|
claudeCredentials?: {
|
package/dist/executor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src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AQ,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAA;CAC7D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,WAAW,EAAE,CAe9C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IAAC,QAAQ,EAAE,WAAW,EAAE,CAAA;CAAE,CAe/N;AAyCD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CA+BzD"}
|
package/dist/executor.js
CHANGED
|
@@ -413,7 +413,10 @@ export function setProjectSettings(settings) {
|
|
|
413
413
|
// machine will keep emitting the curl for months.
|
|
414
414
|
function generateSettingsHeader(opts = {}) {
|
|
415
415
|
const lines = ['## Active Orquesta Settings\n'];
|
|
416
|
-
if (opts.
|
|
416
|
+
if (opts.readOnly) {
|
|
417
|
+
lines.push(`- **READ-ONLY task.** You can only read files (Read, Grep, Glob); you cannot edit, run commands, commit, push or deploy. Answer the question from the code and the repository snapshot below. If it needs a change, say what you would change instead of trying.`);
|
|
418
|
+
}
|
|
419
|
+
else if (opts.assisted) {
|
|
417
420
|
lines.push(`- **Assisted run: deployment is DISABLED for this task.** Do NOT deploy, do NOT call the Orquesta Deploy API, and do NOT push to the main branch. Your changes stay on the QA branch and a reviewer decides whether they ship.`);
|
|
418
421
|
}
|
|
419
422
|
else if (projectSettings.autoDeploy && projectSettings.projectId) {
|
|
@@ -468,6 +471,56 @@ function generateSettingsHeader(opts = {}) {
|
|
|
468
471
|
}
|
|
469
472
|
// Pending supervision callbacks
|
|
470
473
|
const pendingSupervisionCallbacks = new Map();
|
|
474
|
+
/**
|
|
475
|
+
* Claude CLI flags for a read-only task. Only the file-reading tools exist
|
|
476
|
+
* (--tools), the write/exec ones are denied on top (--disallowedTools, which
|
|
477
|
+
* beats any allow rule from a settings file), secrets are denied through a
|
|
478
|
+
* --settings file, project MCP servers are not loaded, and permissions are
|
|
479
|
+
* NOT skipped — anything else that would need approval is refused in -p mode.
|
|
480
|
+
* There is no Bash, so the agent hands the model a git snapshot itself
|
|
481
|
+
* (readOnlyRepoSnapshot). An older CLI that rejects one of these flags fails
|
|
482
|
+
* the run: closed, never open.
|
|
483
|
+
*/
|
|
484
|
+
export function readOnlyCliArgs(settingsPath) {
|
|
485
|
+
return [
|
|
486
|
+
'--tools', 'Read,Grep,Glob',
|
|
487
|
+
'--disallowedTools', 'Bash,Edit,Write,NotebookEdit,WebFetch,WebSearch,Task',
|
|
488
|
+
'--permission-mode', 'default',
|
|
489
|
+
'--strict-mcp-config',
|
|
490
|
+
'--settings', settingsPath,
|
|
491
|
+
];
|
|
492
|
+
}
|
|
493
|
+
const READ_ONLY_SETTINGS = {
|
|
494
|
+
permissions: {
|
|
495
|
+
deny: [
|
|
496
|
+
'Read(**/.env)', 'Read(**/.env.*)', 'Read(**/*.pem)', 'Read(**/*.key)', 'Read(**/*.p8)',
|
|
497
|
+
'Read(**/id_rsa*)', 'Read(**/id_ed25519*)', 'Read(**/credentials*)', 'Read(**/*secret*)',
|
|
498
|
+
'Read(~/**)', 'Read(/etc/**)',
|
|
499
|
+
],
|
|
500
|
+
},
|
|
501
|
+
};
|
|
502
|
+
/** Recent history + working-tree state, gathered by the agent (the model has no Bash). */
|
|
503
|
+
function readOnlyRepoSnapshot(cwd) {
|
|
504
|
+
const run = (args) => {
|
|
505
|
+
try {
|
|
506
|
+
return execFileSync('git', args, { cwd, encoding: 'utf-8', timeout: 10_000, stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
507
|
+
}
|
|
508
|
+
catch {
|
|
509
|
+
return '';
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
if (!run(['rev-parse', '--is-inside-work-tree']))
|
|
513
|
+
return '';
|
|
514
|
+
const parts = [
|
|
515
|
+
['Branch and working tree (git status --short --branch)', run(['status', '--short', '--branch'])],
|
|
516
|
+
['Last 30 commits (git log)', run(['log', '-n', '30', '--date=iso', '--format=%h %ad %an%d %s'])],
|
|
517
|
+
['Branches (git branch -a)', run(['branch', '-a', '--no-color'])],
|
|
518
|
+
].filter(([, out]) => out);
|
|
519
|
+
return parts.length
|
|
520
|
+
? '\n\n## Repository snapshot (read-only, gathered by the agent)\n' +
|
|
521
|
+
parts.map(([title, out]) => `\n### ${title}\n\`\`\`\n${redactSecrets(out.slice(0, 20_000))}\n\`\`\``).join('\n')
|
|
522
|
+
: '';
|
|
523
|
+
}
|
|
471
524
|
// Claude CLI account/API failures surface on the final stream-json `result`
|
|
472
525
|
// event as is_error with an api_error_status, and/or the error string as the
|
|
473
526
|
// result text. These are NOT recoverable by retrying claude (the account is
|
|
@@ -2211,7 +2264,10 @@ export async function execute(options) {
|
|
|
2211
2264
|
// draft the reply, instead of making the model orchestrate curls turn-by-turn
|
|
2212
2265
|
// (slow + fragile on weak models). Falls through to the normal prompt path if
|
|
2213
2266
|
// the spec is absent or malformed.
|
|
2214
|
-
|
|
2267
|
+
// A read-only task never takes the trusted fast-paths below: they act on
|
|
2268
|
+
// the content itself (calls, installers), which an outside reader must not
|
|
2269
|
+
// be able to trigger.
|
|
2270
|
+
const coordSpec = options.readOnly ? null : parseCoordSpec(content);
|
|
2215
2271
|
if (coordSpec) {
|
|
2216
2272
|
const isCall = coordSpec.mode === 'call';
|
|
2217
2273
|
addLog(promptId, 'info', 'system', `Native ${isCall ? 'video call' : 'coordination'} (${coordSpec.reason}) — channel ${coordSpec.channelId}`);
|
|
@@ -2240,7 +2296,7 @@ export async function execute(options) {
|
|
|
2240
2296
|
// sudosudo install fast-path: run the OFFICIAL sudosudo installer as trusted
|
|
2241
2297
|
// agent code (NOT via the LLM). This is how the Orquesta dashboard activates
|
|
2242
2298
|
// sudosudo on a box already running this agent. See ./sudosudo.ts.
|
|
2243
|
-
const sudoSpec = parseSudosudoInstallSpec(content);
|
|
2299
|
+
const sudoSpec = options.readOnly ? null : parseSudosudoInstallSpec(content);
|
|
2244
2300
|
if (sudoSpec) {
|
|
2245
2301
|
addLog(promptId, 'info', 'system', `sudosudo install (trusted) — ${sudoSpec.installUrl.replace(/\/i\/stk_[^\s]*/, '/i/stk_<redacted>')}`);
|
|
2246
2302
|
try {
|
|
@@ -2285,16 +2341,20 @@ export async function execute(options) {
|
|
|
2285
2341
|
addLog(promptId, 'error', 'system', `Failed to process attachments: ${error}`);
|
|
2286
2342
|
}
|
|
2287
2343
|
}
|
|
2344
|
+
if (options.readOnly)
|
|
2345
|
+
attachmentContext += readOnlyRepoSnapshot(workingDirectory || process.cwd());
|
|
2288
2346
|
// Build full prompt with settings, agent instructions, and attachments
|
|
2289
2347
|
let fullContent = content + attachmentContext;
|
|
2290
|
-
const settingsHeader = generateSettingsHeader({ assisted: !!options.assisted });
|
|
2348
|
+
const settingsHeader = generateSettingsHeader({ assisted: !!options.assisted, readOnly: !!options.readOnly });
|
|
2291
2349
|
const browserBlock = globalBrowserEnabled ? BROWSER_TOOLS_PROMPT_BLOCK : '';
|
|
2292
2350
|
const coordinationBlock = await fetchCoordinationContextBlock();
|
|
2293
2351
|
const capabilitiesBlock = `${ORQUESTA_CAPABILITIES_PROMPT_BLOCK}${coordinationBlock}`;
|
|
2294
2352
|
// Auto-inject any rogerthat phone messages received since the last prompt /
|
|
2295
2353
|
// interactive turn. Shared state with the interactive path — see
|
|
2296
2354
|
// readNewApuchatMessages(). No-op when no listener is active.
|
|
2297
|
-
|
|
2355
|
+
// Not for a read-only task: it would consume the owner's phone messages
|
|
2356
|
+
// into an outsider's question.
|
|
2357
|
+
const phoneBlock = options.readOnly ? '' : readNewApuchatMessages();
|
|
2298
2358
|
if (phoneBlock) {
|
|
2299
2359
|
logger.info(`Injecting ${phoneBlock.length} chars of rogerthat phone messages into prompt`);
|
|
2300
2360
|
}
|
|
@@ -2362,9 +2422,22 @@ ${userRequestBody}`;
|
|
|
2362
2422
|
if (!selectedCli) {
|
|
2363
2423
|
throw new Error('No CLI available. Please install either orquesta-cli or claude CLI.');
|
|
2364
2424
|
}
|
|
2425
|
+
// Read-only enforcement lives in Claude CLI's tool flags; no other CLI has
|
|
2426
|
+
// an equivalent, so a read-only task runs on Claude or not at all.
|
|
2427
|
+
if (options.readOnly) {
|
|
2428
|
+
if (!isClaudeCliAvailable()) {
|
|
2429
|
+
const msg = 'Read-only tasks need Claude CLI on the agent machine (other CLIs cannot be restricted to read-only tools).';
|
|
2430
|
+
addLog(promptId, 'error', 'system', msg);
|
|
2431
|
+
await updatePromptStatus(promptId, 'failed', { text: msg, key_actions: [], files_modified: [] });
|
|
2432
|
+
await sendComplete(channel, commandId, 1, startTime);
|
|
2433
|
+
return;
|
|
2434
|
+
}
|
|
2435
|
+
selectedCli = 'claude';
|
|
2436
|
+
reason = 'Read-only task (Claude CLI tool restrictions)';
|
|
2437
|
+
}
|
|
2365
2438
|
// Preflight check: if orquesta CLI is selected, verify its LLM endpoint works
|
|
2366
2439
|
// This prevents wasting time on prompts that will fail with 404s
|
|
2367
|
-
if (selectedCli === 'orquesta') {
|
|
2440
|
+
if (selectedCli === 'orquesta' && !options.readOnly) {
|
|
2368
2441
|
try {
|
|
2369
2442
|
const testResult = execSync('orquesta --status 2>&1 || true', { encoding: 'utf-8', timeout: 5000, env });
|
|
2370
2443
|
// If orquesta-cli reports no endpoint or connection issues, fall back to claude
|
|
@@ -2462,15 +2535,25 @@ ${userRequestBody}`;
|
|
|
2462
2535
|
: '--verbose --output-format stream-json'; // Claude: stream-json format
|
|
2463
2536
|
// Kimi has no --dangerously-skip-permissions, and -p forbids -y. Cursor spells
|
|
2464
2537
|
// the same thing --force (alias --yolo); kiro spells it --trust-all-tools.
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
:
|
|
2538
|
+
let readOnlySettingsPath = null;
|
|
2539
|
+
if (options.readOnly) {
|
|
2540
|
+
const dir = process.platform === 'win32' ? os.tmpdir() : path.join(os.homedir(), '.orquesta-agent', 'sysprompts');
|
|
2541
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
2542
|
+
readOnlySettingsPath = path.join(dir, `readonly-settings-${commandId}.json`);
|
|
2543
|
+
fs.writeFileSync(readOnlySettingsPath, JSON.stringify(READ_ONLY_SETTINGS), { encoding: 'utf-8', mode: 0o600 });
|
|
2544
|
+
}
|
|
2545
|
+
const readOnlyArgs = readOnlySettingsPath ? readOnlyCliArgs(readOnlySettingsPath) : [];
|
|
2546
|
+
const permFlags = readOnlySettingsPath
|
|
2547
|
+
? readOnlyArgs.map(a => `'${a.replace(/'/g, "'\\''")}'`).join(' ')
|
|
2548
|
+
: cliCommand === 'kimi'
|
|
2468
2549
|
? ''
|
|
2469
|
-
:
|
|
2470
|
-
? '
|
|
2471
|
-
: cliCommand === '
|
|
2472
|
-
? '--
|
|
2473
|
-
: '
|
|
2550
|
+
: mode !== 'auto'
|
|
2551
|
+
? ''
|
|
2552
|
+
: cliCommand === 'cursor'
|
|
2553
|
+
? '--force'
|
|
2554
|
+
: cliCommand === 'kiro'
|
|
2555
|
+
? '--trust-all-tools'
|
|
2556
|
+
: '--dangerously-skip-permissions';
|
|
2474
2557
|
// Per-project endpoint override (orquesta CLI only). Single-quoted for the
|
|
2475
2558
|
// shell-wrapped (Linux) path; pushed as a separate arg on Win/macOS below.
|
|
2476
2559
|
const useEndpoint = cliCommand === 'orquesta' && !!globalCliEndpoint;
|
|
@@ -2507,7 +2590,11 @@ ${userRequestBody}`;
|
|
|
2507
2590
|
// limit (and spawns without a shell), so keep the prompt inline there.
|
|
2508
2591
|
if (!isWindows)
|
|
2509
2592
|
args.push(promptContent);
|
|
2510
|
-
|
|
2593
|
+
// shell:true on Windows joins args unquoted — quote the settings path
|
|
2594
|
+
// (a profile dir can contain spaces).
|
|
2595
|
+
if (readOnlyArgs.length)
|
|
2596
|
+
args.push(...readOnlyArgs.map(a => isWindows && /\s/.test(a) ? `"${a}"` : a));
|
|
2597
|
+
else if (permFlags)
|
|
2511
2598
|
args.push(...permFlags.split(/\s+/).filter(Boolean));
|
|
2512
2599
|
if (baseFlags)
|
|
2513
2600
|
args.push(...baseFlags.split(/\s+/).filter(Boolean));
|
|
@@ -3090,6 +3177,12 @@ ${userRequestBody}`;
|
|
|
3090
3177
|
}
|
|
3091
3178
|
catch { /* already gone */ }
|
|
3092
3179
|
}
|
|
3180
|
+
if (readOnlySettingsPath) {
|
|
3181
|
+
try {
|
|
3182
|
+
fs.unlinkSync(readOnlySettingsPath);
|
|
3183
|
+
}
|
|
3184
|
+
catch { /* already gone */ }
|
|
3185
|
+
}
|
|
3093
3186
|
if (promptId)
|
|
3094
3187
|
promptIdToCommandId.delete(promptId);
|
|
3095
3188
|
pendingSupervisionCallbacks.delete(commandId);
|
|
@@ -3104,7 +3197,7 @@ ${userRequestBody}`;
|
|
|
3104
3197
|
// with the error text. _forceCli guards against re-recursing. The
|
|
3105
3198
|
// recursive call owns final completion (sendComplete/flush), so we skip
|
|
3106
3199
|
// the rest of this handler and resolve once it returns.
|
|
3107
|
-
if (claudeApiError && selectedCli === 'claude' && !options._forceCli && isOrquestaCliAvailable()) {
|
|
3200
|
+
if (claudeApiError && selectedCli === 'claude' && !options._forceCli && !options.readOnly && isOrquestaCliAvailable()) {
|
|
3108
3201
|
logger.warn(`Claude CLI unavailable (${claudeApiError.slice(0, 80)}) — retrying via orquesta-cli`);
|
|
3109
3202
|
addLog(promptId, 'warning', 'system', 'Claude CLI unavailable — falling back to orquesta-cli');
|
|
3110
3203
|
try {
|