@crewx/cli 0.9.0-rc.19 → 0.9.0-rc.190
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/bootstrap/codex-writable-roots.d.ts +20 -1
- package/dist/bootstrap/codex-writable-roots.js +1 -88
- package/dist/bootstrap/crewx-cli.js +1 -63
- package/dist/bootstrap/rate-limit-snapshot.d.ts +15 -0
- package/dist/bootstrap/rate-limit-snapshot.js +1 -0
- package/dist/builtin.d.ts +1 -1
- package/dist/builtin.js +5 -127
- package/dist/commands/agent.d.ts +1 -0
- package/dist/commands/agent.js +3 -246
- package/dist/commands/ai-account.d.ts +4 -0
- package/dist/commands/ai-account.js +27 -0
- package/dist/commands/cal.d.ts +15 -0
- package/dist/commands/cal.js +2 -0
- package/dist/commands/command-help.d.ts +27 -0
- package/dist/commands/command-help.js +63 -0
- package/dist/commands/db.d.ts +3 -0
- package/dist/commands/db.js +59 -125
- package/dist/commands/detached.d.ts +102 -0
- package/dist/commands/detached.js +15 -0
- package/dist/commands/doctor.d.ts +77 -0
- package/dist/commands/doctor.js +4 -196
- package/dist/commands/emit-trailer.d.ts +25 -0
- package/dist/commands/emit-trailer.js +2 -0
- package/dist/commands/execute.d.ts +8 -4
- package/dist/commands/execute.js +15 -146
- package/dist/commands/history.d.ts +18 -0
- package/dist/commands/history.js +2 -0
- package/dist/commands/hook/command-marker.d.ts +2 -0
- package/dist/commands/hook/command-marker.js +1 -0
- package/dist/commands/hook/install.d.ts +0 -1
- package/dist/commands/hook/install.js +8 -175
- package/dist/commands/hook/paths.js +1 -94
- package/dist/commands/hook/status.js +1 -86
- package/dist/commands/hook/uninstall.js +1 -71
- package/dist/commands/hook-dispatch.js +2 -180
- package/dist/commands/init.d.ts +34 -0
- package/dist/commands/init.js +38 -371
- package/dist/commands/kill.d.ts +2 -8
- package/dist/commands/kill.js +1 -52
- package/dist/commands/log.js +3 -95
- package/dist/commands/parse-agent-message.js +1 -52
- package/dist/commands/parse-common-flags.d.ts +5 -1
- package/dist/commands/parse-common-flags.js +3 -181
- package/dist/commands/ps.d.ts +2 -2
- package/dist/commands/ps.js +2 -107
- package/dist/commands/publish.d.ts +1 -0
- package/dist/commands/publish.js +27 -0
- package/dist/commands/query.d.ts +7 -2
- package/dist/commands/query.js +16 -146
- package/dist/commands/registry.js +1 -31
- package/dist/commands/resolve-prompt.js +3 -54
- package/dist/commands/resolve-recipient.d.ts +14 -0
- package/dist/commands/resolve-recipient.js +3 -0
- package/dist/commands/restart.d.ts +3 -1
- package/dist/commands/restart.js +18 -162
- package/dist/commands/result.d.ts +8 -3
- package/dist/commands/result.js +1 -70
- package/dist/commands/shortcut.d.ts +1 -0
- package/dist/commands/shortcut.js +18 -0
- package/dist/commands/slack.js +16 -559
- package/dist/commands/stop.d.ts +8 -0
- package/dist/commands/stop.js +8 -0
- package/dist/commands/write-output.js +1 -24
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -5
- package/dist/logging.d.ts +1 -1
- package/dist/logging.js +10 -86
- package/dist/main.d.ts +3 -2
- package/dist/main.js +49 -253
- package/dist/register-builtin-tools.js +1 -9
- package/dist/slack/file-download.js +1 -134
- package/dist/slack/markdown.js +1 -33
- package/dist/utils/env-defaults.d.ts +2 -5
- package/dist/utils/env-defaults.js +1 -10
- package/dist/utils/inherited-trace.d.ts +24 -0
- package/dist/utils/inherited-trace.js +1 -25
- package/dist/utils/product-package-root.d.ts +6 -0
- package/dist/utils/product-package-root.js +1 -0
- package/dist/utils/sdk-compat.d.ts +24 -0
- package/dist/utils/sdk-compat.js +1 -0
- package/dist/utils/version.js +1 -28
- package/package.json +16 -12
package/dist/commands/log.js
CHANGED
|
@@ -1,95 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Lists task execution logs or shows a specific task log.
|
|
5
|
-
*
|
|
6
|
-
* Usage:
|
|
7
|
-
* crewx log List all tasks (newest first)
|
|
8
|
-
* crewx log ls Same as above
|
|
9
|
-
* crewx log <task_id> Show specific task details
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.handleLog = handleLog;
|
|
13
|
-
const repository_1 = require("@crewx/sdk/repository");
|
|
14
|
-
function statusIcon(status) {
|
|
15
|
-
switch (status) {
|
|
16
|
-
case 'running': return '⏳';
|
|
17
|
-
case 'success': return '✅';
|
|
18
|
-
case 'failed': return '❌';
|
|
19
|
-
default: return '❓';
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
async function handleLog(args) {
|
|
23
|
-
const action = args[0];
|
|
24
|
-
const isTaskId = action && (action.startsWith('tsk_') || action.startsWith('task_'));
|
|
25
|
-
const isListCommand = !action || action === 'ls' || action === 'list';
|
|
26
|
-
const repo = new repository_1.TaskRepository();
|
|
27
|
-
if (isTaskId) {
|
|
28
|
-
const task = repo.getTask(action);
|
|
29
|
-
if (!task) {
|
|
30
|
-
console.error(`Task not found: ${action}`);
|
|
31
|
-
process.exit(1);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
console.log(`\nTask Log\n${'='.repeat(60)}`);
|
|
35
|
-
console.log(`Task ID: ${task.id}`);
|
|
36
|
-
console.log(`Status: ${statusIcon(task.status)} ${task.status}`);
|
|
37
|
-
console.log(`Agent: ${task.agent_id ?? '—'}`);
|
|
38
|
-
console.log(`Mode: ${task.mode ?? '—'}`);
|
|
39
|
-
console.log(`Started: ${new Date(task.started_at).toLocaleString()}`);
|
|
40
|
-
if (task.completed_at) {
|
|
41
|
-
const duration = new Date(task.completed_at).getTime() - new Date(task.started_at).getTime();
|
|
42
|
-
console.log(`Completed: ${new Date(task.completed_at).toLocaleString()} (${duration}ms)`);
|
|
43
|
-
}
|
|
44
|
-
console.log('='.repeat(60));
|
|
45
|
-
console.log('');
|
|
46
|
-
if (task.status === 'success' && task.result) {
|
|
47
|
-
console.log('Result:');
|
|
48
|
-
console.log(task.result);
|
|
49
|
-
}
|
|
50
|
-
else if (task.status === 'failed' && task.error) {
|
|
51
|
-
console.log(`Error: ${task.error}`);
|
|
52
|
-
}
|
|
53
|
-
else if (task.status === 'running') {
|
|
54
|
-
console.log('(task is still running)');
|
|
55
|
-
}
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (isListCommand) {
|
|
59
|
-
const allTasks = repo.getAllTasks();
|
|
60
|
-
console.log('\nAvailable Task Logs');
|
|
61
|
-
console.log('='.repeat(60));
|
|
62
|
-
const total = allTasks.length;
|
|
63
|
-
const completed = allTasks.filter((t) => t.status === 'success').length;
|
|
64
|
-
const failed = allTasks.filter((t) => t.status === 'failed').length;
|
|
65
|
-
const running = allTasks.filter((t) => t.status === 'running').length;
|
|
66
|
-
console.log(`Total: ${total} | ✅ Completed: ${completed} | ❌ Failed: ${failed} | ⏳ Running: ${running}`);
|
|
67
|
-
console.log('='.repeat(60));
|
|
68
|
-
console.log('');
|
|
69
|
-
if (allTasks.length === 0) {
|
|
70
|
-
console.log('No task logs found.');
|
|
71
|
-
console.log('Tip: Run `crewx query` or `crewx execute` to create tasks.');
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
allTasks.forEach((task, idx) => {
|
|
75
|
-
const icon = statusIcon(task.status);
|
|
76
|
-
const duration = task.completed_at
|
|
77
|
-
? `${new Date(task.completed_at).getTime() - new Date(task.started_at).getTime()}ms`
|
|
78
|
-
: 'running...';
|
|
79
|
-
console.log(`${idx + 1}. ${icon} ${task.id}`);
|
|
80
|
-
console.log(` Agent: ${task.agent_id ?? '—'} Mode: ${task.mode ?? '—'}`);
|
|
81
|
-
console.log(` Started: ${new Date(task.started_at).toLocaleString()}`);
|
|
82
|
-
console.log(` Duration: ${duration}`);
|
|
83
|
-
console.log('');
|
|
84
|
-
});
|
|
85
|
-
console.log('Tip: Use "crewx log <task_id>" to view detailed log');
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
console.error(`Unknown log action: ${action}`);
|
|
89
|
-
console.error('');
|
|
90
|
-
console.error('Usage:');
|
|
91
|
-
console.error(' crewx log List all logs (default)');
|
|
92
|
-
console.error(' crewx log ls List all logs');
|
|
93
|
-
console.error(' crewx log <task_id> View specific log');
|
|
94
|
-
process.exit(1);
|
|
95
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.handleLog=T;const n=require("@crewx/sdk");const $=require("@crewx/sdk/repository");function a(s){switch(s){case"running":return"\u23F3";case"success":return"\u2705";case"failed":return"\u274C";default:return"\u2753"}}async function T(s){const t=s[0];const c=t&&(t.startsWith("tsk_")||t.startsWith("task_"));const i=!t||t==="ls"||t==="list";const r=new $.TaskRepository;if(c){const e=r.getTask(t);if(!e){console.error(`Task not found: ${t}`);process.exit(1);return}console.log(`
|
|
2
|
+
Task Log
|
|
3
|
+
${"=".repeat(60)}`);console.log(`Task ID: ${e.id}`);console.log(`Status: ${a(e.status)} ${e.status}`);console.log(`Agent: ${e.agent_id??"\u2014"}`);console.log(`Mode: ${e.mode??"\u2014"}`);console.log(`Started: ${(0,n.formatDisplayTimestamp)(new Date(e.started_at))}`);if(e.completed_at){const l=new Date(e.completed_at).getTime()-new Date(e.started_at).getTime();console.log(`Completed: ${(0,n.formatDisplayTimestamp)(new Date(e.completed_at))} (${l}ms)`)}console.log("=".repeat(60));console.log("");if(e.status==="success"&&e.result){console.log("Result:");console.log(e.result)}else if(e.status==="failed"&&e.error){console.log(`Error: ${e.error}`)}else if(e.status==="running"){console.log("(task is still running)")}return}if(i){const e=r.getAllTasks();console.log("\nAvailable Task Logs");console.log("=".repeat(60));const l=e.length;const g=e.filter(o=>o.status==="success").length;const u=e.filter(o=>o.status==="failed").length;const d=e.filter(o=>o.status==="running").length;console.log(`Total: ${l} | \u2705 Completed: ${g} | \u274C Failed: ${u} | \u23F3 Running: ${d}`);console.log("=".repeat(60));console.log("");if(e.length===0){console.log("No task logs found.");console.log("Tip: Run `crewx query` or `crewx execute` to create tasks.");return}e.forEach((o,f)=>{const m=a(o.status);const p=o.completed_at?`${new Date(o.completed_at).getTime()-new Date(o.started_at).getTime()}ms`:"running...";console.log(`${f+1}. ${m} ${o.id}`);console.log(` Agent: ${o.agent_id??"\u2014"} Mode: ${o.mode??"\u2014"}`);console.log(` Started: ${(0,n.formatDisplayTimestamp)(new Date(o.started_at))}`);console.log(` Duration: ${p}`);console.log("")});console.log('Tip: Use "crewx log <task_id>" to view detailed log');return}console.error(`Unknown log action: ${t}`);console.error("");console.error("Usage:");console.error(" crewx log List all logs (default)");console.error(" crewx log ls List all logs");console.error(" crewx log <task_id> View specific log");process.exit(1)}
|
|
@@ -1,52 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Shared utility for parsing agent reference and message from CLI args.
|
|
4
|
-
*
|
|
5
|
-
* Supported call forms:
|
|
6
|
-
* crewx query '@claude 안녕' → agentRef='@claude', message='안녕'
|
|
7
|
-
* crewx query '@claude' '안녕' → agentRef='@claude', message='안녕'
|
|
8
|
-
* crewx query '@claude' '안녕' '해' → agentRef='@claude', message='안녕 해'
|
|
9
|
-
* crewx query '안녕하세요' → agentRef='', message='안녕하세요' (default agent)
|
|
10
|
-
*
|
|
11
|
-
* Only @mention form triggers explicit agent selection. Input without a
|
|
12
|
-
* leading @mention uses the default agent (@crewx) — callers are responsible
|
|
13
|
-
* for applying the fallback.
|
|
14
|
-
*
|
|
15
|
-
* Reusable by query, execute, and any future command that accepts an agent ref.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.parseAgentMessage = parseAgentMessage;
|
|
19
|
-
/**
|
|
20
|
-
* Parse agent reference and message from CLI args array.
|
|
21
|
-
*
|
|
22
|
-
* Joins all args with a single space first, then splits on the first
|
|
23
|
-
* whitespace boundary so that both the "single-chunk" form
|
|
24
|
-
* (`'@claude 안녕'`) and the "separated" form (`'@claude', '안녕'`) produce
|
|
25
|
-
* identical results.
|
|
26
|
-
*
|
|
27
|
-
* Returns agentRef='' when no leading @mention is found — the caller should
|
|
28
|
-
* default to '@crewx' in that case.
|
|
29
|
-
*/
|
|
30
|
-
function parseAgentMessage(args) {
|
|
31
|
-
if (args.length === 0) {
|
|
32
|
-
return { agentRef: '', message: '' };
|
|
33
|
-
}
|
|
34
|
-
// Join all args so both forms are handled uniformly
|
|
35
|
-
const combined = args.join(' ').trim();
|
|
36
|
-
if (!combined) {
|
|
37
|
-
return { agentRef: '', message: '' };
|
|
38
|
-
}
|
|
39
|
-
// Only @mention form triggers explicit agent selection
|
|
40
|
-
if (combined.startsWith('@')) {
|
|
41
|
-
const spaceIdx = combined.indexOf(' ');
|
|
42
|
-
if (spaceIdx === -1) {
|
|
43
|
-
return { agentRef: combined, message: '' };
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
agentRef: combined.slice(0, spaceIdx),
|
|
47
|
-
message: combined.slice(spaceIdx + 1).trim(),
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
// No leading @mention — entire input is the message; caller defaults to @crewx
|
|
51
|
-
return { agentRef: '', message: combined };
|
|
52
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.parseAgentMessage=n;function n(s){if(s.length===0){return{agentRef:"",message:""}}const e=s.join(" ").trim();if(!e){return{agentRef:"",message:""}}if(e.startsWith("@")){const t=e.indexOf(" ");if(t===-1){return{agentRef:e,message:""}}return{agentRef:e.slice(0,t),message:e.slice(t+1).trim()}}return{agentRef:"",message:e}}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Common flag parser for query/execute commands.
|
|
3
3
|
*
|
|
4
4
|
* Supports both `--flag=value` and `--flag value` forms.
|
|
5
|
-
* Handles: --thread, --provider, --metadata, --verbose, --config/-c,
|
|
5
|
+
* Handles: --to, --thread, --provider, --model, --metadata, --verbose, --config/-c,
|
|
6
6
|
* --output-format, --effort, --prompt-file/-f, --overdrive.
|
|
7
7
|
*
|
|
8
8
|
* Strict mode: unknown --xxx tokens after known flags are consumed throw an
|
|
@@ -12,8 +12,12 @@
|
|
|
12
12
|
export interface CommonFlags {
|
|
13
13
|
/** Thread name for conversation continuity. */
|
|
14
14
|
thread?: string;
|
|
15
|
+
/** Explicit agent recipient. */
|
|
16
|
+
to?: string;
|
|
15
17
|
/** Provider override (e.g., cli/claude). */
|
|
16
18
|
provider?: string;
|
|
19
|
+
/** Model override (e.g., claude-sonnet-5). */
|
|
20
|
+
model?: string;
|
|
17
21
|
/** Raw metadata JSON string. */
|
|
18
22
|
metadata?: string;
|
|
19
23
|
/** Enable verbose/debug output mode. */
|
|
@@ -1,181 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* Supports both `--flag=value` and `--flag value` forms.
|
|
6
|
-
* Handles: --thread, --provider, --metadata, --verbose, --config/-c,
|
|
7
|
-
* --output-format, --effort, --prompt-file/-f, --overdrive.
|
|
8
|
-
*
|
|
9
|
-
* Strict mode: unknown --xxx tokens after known flags are consumed throw an
|
|
10
|
-
* error instead of silently leaking into the message prompt.
|
|
11
|
-
* Use `--` sentinel to pass literal flag-like tokens as positional args.
|
|
12
|
-
*/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.UnknownOptionError = void 0;
|
|
15
|
-
exports.parseCommonFlags = parseCommonFlags;
|
|
16
|
-
exports.parseMetadata = parseMetadata;
|
|
17
|
-
/**
|
|
18
|
-
* Parse a single-value flag from an args array.
|
|
19
|
-
* Supports `--flag=value` and `--flag value` forms.
|
|
20
|
-
* Returns undefined if flag is not present.
|
|
21
|
-
*/
|
|
22
|
-
function parseFlag(args, ...names) {
|
|
23
|
-
for (let i = 0; i < args.length; i++) {
|
|
24
|
-
const arg = args[i];
|
|
25
|
-
for (const name of names) {
|
|
26
|
-
const prefix = `${name}=`;
|
|
27
|
-
if (arg.startsWith(prefix)) {
|
|
28
|
-
return arg.slice(prefix.length);
|
|
29
|
-
}
|
|
30
|
-
if (arg === name && i + 1 < args.length) {
|
|
31
|
-
return args[i + 1];
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Check if a boolean flag is present.
|
|
39
|
-
*/
|
|
40
|
-
function hasFlag(args, ...names) {
|
|
41
|
-
return names.some(name => args.includes(name));
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Thrown by parseCommonFlags when an unrecognized --xxx flag is encountered.
|
|
45
|
-
* Callers can distinguish this from other errors to map to exit code 2.
|
|
46
|
-
*/
|
|
47
|
-
class UnknownOptionError extends Error {
|
|
48
|
-
constructor(message) {
|
|
49
|
-
super(message);
|
|
50
|
-
this.name = 'UnknownOptionError';
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.UnknownOptionError = UnknownOptionError;
|
|
54
|
-
/**
|
|
55
|
-
* Parse common CLI flags from an args array.
|
|
56
|
-
*
|
|
57
|
-
* Strict mode: any unconsumed `--xxx` token (outside a `--` escape block)
|
|
58
|
-
* throws `UnknownOptionError: Unknown option: --xxx.`
|
|
59
|
-
*
|
|
60
|
-
* Tokens after `--` are treated as positional and included in `rest` as-is.
|
|
61
|
-
* The `--` sentinel itself is NOT included in `rest`.
|
|
62
|
-
*/
|
|
63
|
-
function parseCommonFlags(args) {
|
|
64
|
-
const thread = parseFlag(args, '--thread');
|
|
65
|
-
const provider = parseFlag(args, '--provider');
|
|
66
|
-
const metadata = parseFlag(args, '--metadata');
|
|
67
|
-
const config = parseFlag(args, '--config', '-c');
|
|
68
|
-
const outputFormat = parseFlag(args, '--output-format');
|
|
69
|
-
const effort = parseFlag(args, '--effort');
|
|
70
|
-
const promptFile = parseFlag(args, '--prompt-file', '-f');
|
|
71
|
-
const out = parseFlag(args, '--out', '-o');
|
|
72
|
-
const verbose = hasFlag(args, '--verbose');
|
|
73
|
-
const overdrive = hasFlag(args, '--overdrive');
|
|
74
|
-
// Collect consumed positions for known flags
|
|
75
|
-
const consumed = new Set();
|
|
76
|
-
const flagPairs = [
|
|
77
|
-
{ names: ['--thread'] },
|
|
78
|
-
{ names: ['--provider'] },
|
|
79
|
-
{ names: ['--metadata'] },
|
|
80
|
-
{ names: ['--config', '-c'] },
|
|
81
|
-
{ names: ['--output-format'] },
|
|
82
|
-
{ names: ['--effort'] },
|
|
83
|
-
{ names: ['--prompt-file', '-f'] },
|
|
84
|
-
{ names: ['--out', '-o'] },
|
|
85
|
-
];
|
|
86
|
-
// Parse --var key=value flags (multiple allowed; last value wins on duplicate keys)
|
|
87
|
-
const vars = {};
|
|
88
|
-
for (let i = 0; i < args.length; i++) {
|
|
89
|
-
const arg = args[i];
|
|
90
|
-
if (arg === '--verbose') {
|
|
91
|
-
consumed.add(i);
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
if (arg === '--overdrive') {
|
|
95
|
-
consumed.add(i);
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
// --var=key=value or --var key=value
|
|
99
|
-
if (arg.startsWith('--var=') || arg === '--var') {
|
|
100
|
-
let kv;
|
|
101
|
-
if (arg.startsWith('--var=')) {
|
|
102
|
-
kv = arg.slice('--var='.length);
|
|
103
|
-
consumed.add(i);
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
if (i + 1 >= args.length) {
|
|
107
|
-
throw new UnknownOptionError('--var requires a key=value argument');
|
|
108
|
-
}
|
|
109
|
-
kv = args[i + 1];
|
|
110
|
-
consumed.add(i);
|
|
111
|
-
consumed.add(i + 1);
|
|
112
|
-
i++; // skip the value token in the outer loop
|
|
113
|
-
}
|
|
114
|
-
const eqIdx = kv.indexOf('=');
|
|
115
|
-
if (eqIdx === -1) {
|
|
116
|
-
throw new UnknownOptionError(`--var requires key=value format. Got: ${kv}`);
|
|
117
|
-
}
|
|
118
|
-
const key = kv.slice(0, eqIdx);
|
|
119
|
-
const value = kv.slice(eqIdx + 1);
|
|
120
|
-
vars[key] = value;
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
for (const { names } of flagPairs) {
|
|
124
|
-
for (const name of names) {
|
|
125
|
-
if (arg.startsWith(`${name}=`)) {
|
|
126
|
-
consumed.add(i);
|
|
127
|
-
}
|
|
128
|
-
else if (arg === name) {
|
|
129
|
-
consumed.add(i);
|
|
130
|
-
if (i + 1 < args.length)
|
|
131
|
-
consumed.add(i + 1);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
// Build rest with strict unknown-flag detection and -- escape support
|
|
137
|
-
const rest = [];
|
|
138
|
-
let escapeMode = false;
|
|
139
|
-
for (let i = 0; i < args.length; i++) {
|
|
140
|
-
if (consumed.has(i))
|
|
141
|
-
continue;
|
|
142
|
-
const token = args[i];
|
|
143
|
-
if (!escapeMode && token === '--') {
|
|
144
|
-
escapeMode = true; // consume -- sentinel; everything after is positional
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
if (!escapeMode && token.startsWith('--')) {
|
|
148
|
-
throw new UnknownOptionError(`Unknown option: ${token}. Use "--" to pass literal flag-like tokens as message.\n` +
|
|
149
|
-
` Did you mean: crewx serve ${token}\n` +
|
|
150
|
-
` or: crewx q -- ${token} <message> (to include in message)`);
|
|
151
|
-
}
|
|
152
|
-
// Reject short -x flags that are not numeric (e.g. -f was consumed above)
|
|
153
|
-
if (!escapeMode && token.startsWith('-') && token.length > 1 && !/^-?\d/.test(token)) {
|
|
154
|
-
throw new UnknownOptionError(`Unknown option: ${token}`);
|
|
155
|
-
}
|
|
156
|
-
rest.push(token);
|
|
157
|
-
}
|
|
158
|
-
return { thread, provider, metadata, verbose, config, outputFormat, effort, promptFile, overdrive, vars, out, rest };
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Parse metadata JSON string from --metadata flag.
|
|
162
|
-
* Returns empty object when no raw value provided.
|
|
163
|
-
* Throws Error on invalid JSON or non-object values (fail-fast).
|
|
164
|
-
*/
|
|
165
|
-
function parseMetadata(raw) {
|
|
166
|
-
if (!raw)
|
|
167
|
-
return {};
|
|
168
|
-
try {
|
|
169
|
-
const parsed = JSON.parse(raw);
|
|
170
|
-
if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)) {
|
|
171
|
-
return parsed;
|
|
172
|
-
}
|
|
173
|
-
throw new Error(`--metadata must be a JSON object. Got: ${raw}`);
|
|
174
|
-
}
|
|
175
|
-
catch (err) {
|
|
176
|
-
if (err instanceof Error && err.message.startsWith('--metadata must be a JSON object')) {
|
|
177
|
-
throw err;
|
|
178
|
-
}
|
|
179
|
-
throw new Error(`--metadata must be valid JSON (double-quoted). Got: ${raw}`);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.UnknownOptionError=void 0;exports.parseCommonFlags=F;exports.parseMetadata=S;function d(t,...e){for(let s=0;s<t.length;s++){const r=t[s];for(const i of e){const a=`${i}=`;if(r.startsWith(a)){return r.slice(a.length)}if(r===i&&s+1<t.length){return t[s+1]}}}return void 0}function w(t,...e){return e.some(s=>t.includes(s))}class u extends Error{constructor(e){super(e);this.name="UnknownOptionError"}}exports.UnknownOptionError=u;function F(t){const{value:e,consumed:s}=U(t);const r=d(t,"--thread");const i=d(t,"--provider");const a=d(t,"--model");const m=d(t,"--metadata");const k=d(t,"--config","-c");const b=d(t,"--output-format");const O=d(t,"--effort");const y=d(t,"--prompt-file","-f");const W=d(t,"--out","-o");const $=w(t,"--verbose");const g=w(t,"--overdrive");const c=new Set(s);const E=[{names:["--thread"]},{names:["--provider"]},{names:["--model"]},{names:["--metadata"]},{names:["--config","-c"]},{names:["--output-format"]},{names:["--effort"]},{names:["--prompt-file","-f"]},{names:["--out","-o"]}];const p={};for(let o=0;o<t.length;o++){const n=t[o];if(n==="--verbose"){c.add(o);continue}if(n==="--overdrive"){c.add(o);continue}if(n.startsWith("--var=")||n==="--var"){let f;if(n.startsWith("--var=")){f=n.slice("--var=".length);c.add(o)}else{if(o+1>=t.length){throw new u("--var requires a key=value argument")}f=t[o+1];c.add(o);c.add(o+1);o++}const l=f.indexOf("=");if(l===-1){throw new u(`--var requires key=value format. Got: ${f}`)}const q=f.slice(0,l);const x=f.slice(l+1);p[q]=x;continue}for(const{names:f}of E){for(const l of f){if(n.startsWith(`${l}=`)){c.add(o)}else if(n===l){c.add(o);if(o+1<t.length)c.add(o+1)}}}}const v=[];let h=false;for(let o=0;o<t.length;o++){if(c.has(o))continue;const n=t[o];if(!h&&n==="--"){h=true;continue}if(!h&&n.startsWith("--")){throw new u(`Unknown option: ${n}. Use "--" to pass literal flag-like tokens as message.
|
|
2
|
+
Did you mean: crewx serve ${n}
|
|
3
|
+
or: crewx q --to <agent> -- ${n} <message>`)}if(!h&&n.startsWith("-")&&n.length>1&&!/^-?\d/.test(n)){throw new u(`Unknown option: ${n}`)}v.push(n)}return{to:e,thread:r,provider:i,model:a,metadata:m,verbose:$,config:k,outputFormat:b,effort:O,promptFile:y,overdrive:g,vars:p,out:W,rest:v}}function U(t){let e;const s=[];for(let r=0;r<t.length;r+=1){const i=t[r];if(i==="--")break;if(i.startsWith("--to=")){const m=i.slice("--to=".length);if(!m.trim())throw new u("--to requires an agent id");e=m;s.push(r);continue}if(i!=="--to")continue;const a=t[r+1];if(a===void 0||a==="--"||a.startsWith("--")||!a.trim()){throw new u("--to requires an agent id")}e=a;s.push(r,r+1);r+=1}return{value:e,consumed:s}}function S(t){if(!t)return{};try{const e=JSON.parse(t);if(typeof e==="object"&&e!==null&&!Array.isArray(e)){return e}throw new Error(`--metadata must be a JSON object. Got: ${t}`)}catch(e){if(e instanceof Error&&e.message.startsWith("--metadata must be a JSON object")){throw e}throw new Error(`--metadata must be valid JSON (double-quoted). Got: ${t}`)}}
|
package/dist/commands/ps.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* crewx ps handler.
|
|
3
|
-
* Lists
|
|
3
|
+
* Lists active tasks (pending or running) in table format.
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* crewx ps List all running tasks
|
|
6
|
+
* crewx ps List all pending and running tasks
|
|
7
7
|
* crewx ps --json Output as JSON array
|
|
8
8
|
*/
|
|
9
9
|
export declare function handlePs(args: string[]): Promise<void>;
|
package/dist/commands/ps.js
CHANGED
|
@@ -1,107 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
* crewx ps handler.
|
|
4
|
-
* Lists currently running tasks in table format.
|
|
5
|
-
*
|
|
6
|
-
* Usage:
|
|
7
|
-
* crewx ps List all running tasks
|
|
8
|
-
* crewx ps --json Output as JSON array
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.handlePs = handlePs;
|
|
12
|
-
const repository_1 = require("@crewx/sdk/repository");
|
|
13
|
-
function formatElapsed(ms) {
|
|
14
|
-
const s = Math.floor(ms / 1000);
|
|
15
|
-
if (s < 60)
|
|
16
|
-
return `${s}s`;
|
|
17
|
-
const m = Math.floor(s / 60);
|
|
18
|
-
const rs = s % 60;
|
|
19
|
-
if (m < 60)
|
|
20
|
-
return `${m}m ${rs}s`;
|
|
21
|
-
const h = Math.floor(m / 60);
|
|
22
|
-
return `${h}h ${m % 60}m`;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Antigravity-family providers (coding_agent_command starting with 'agy',
|
|
26
|
-
* path-included forms like '/usr/local/bin/agy' also count) don't emit
|
|
27
|
-
* parseable logs, so they get a distinct 'n/a' instead of '—'.
|
|
28
|
-
*/
|
|
29
|
-
function isAgyCommand(codingAgentCommand) {
|
|
30
|
-
const cmd = (codingAgentCommand ?? '').trim();
|
|
31
|
-
if (!cmd)
|
|
32
|
-
return false;
|
|
33
|
-
const firstToken = cmd.split(/\s+/)[0] ?? '';
|
|
34
|
-
const base = firstToken.split('/').pop() ?? firstToken;
|
|
35
|
-
return base.startsWith('agy');
|
|
36
|
-
}
|
|
37
|
-
function getLastActive(task) {
|
|
38
|
-
try {
|
|
39
|
-
const entries = task.logs ? JSON.parse(task.logs) : [];
|
|
40
|
-
if (Array.isArray(entries) && entries.length > 0) {
|
|
41
|
-
const lastEntry = entries[entries.length - 1];
|
|
42
|
-
const ts = lastEntry?.timestamp;
|
|
43
|
-
const parsedMs = ts ? new Date(ts).getTime() : NaN;
|
|
44
|
-
if (ts && !Number.isNaN(parsedMs)) {
|
|
45
|
-
const diffMs = Math.max(0, Date.now() - parsedMs);
|
|
46
|
-
return {
|
|
47
|
-
display: `${formatElapsed(diffMs)} ago`,
|
|
48
|
-
isoTimestamp: ts,
|
|
49
|
-
logCapable: true,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
// fall through to antigravity/dash fallback below
|
|
56
|
-
}
|
|
57
|
-
if (isAgyCommand(task.coding_agent_command)) {
|
|
58
|
-
return { display: 'n/a', isoTimestamp: null, logCapable: false };
|
|
59
|
-
}
|
|
60
|
-
return { display: '—', isoTimestamp: null, logCapable: true };
|
|
61
|
-
}
|
|
62
|
-
function taskToRow(task) {
|
|
63
|
-
const elapsed = formatElapsed(Date.now() - new Date(task.started_at).getTime());
|
|
64
|
-
const lastActive = getLastActive(task);
|
|
65
|
-
return [
|
|
66
|
-
task.id,
|
|
67
|
-
task.agent_id ?? '—',
|
|
68
|
-
task.pid !== null && task.pid !== undefined ? String(task.pid) : '—',
|
|
69
|
-
elapsed,
|
|
70
|
-
task.mode ?? '—',
|
|
71
|
-
lastActive.display,
|
|
72
|
-
];
|
|
73
|
-
}
|
|
74
|
-
function renderTable(headers, rows) {
|
|
75
|
-
const colWidths = headers.map((h, i) => Math.max(h.length, ...rows.map(r => (r[i] ?? '').length)));
|
|
76
|
-
const separator = colWidths.map(w => '-'.repeat(w)).join(' ');
|
|
77
|
-
const headerLine = headers.map((h, i) => h.padEnd(colWidths[i] ?? h.length)).join(' ');
|
|
78
|
-
console.log(headerLine);
|
|
79
|
-
console.log(separator);
|
|
80
|
-
for (const row of rows) {
|
|
81
|
-
console.log(row.map((cell, i) => cell.padEnd(colWidths[i] ?? cell.length)).join(' '));
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
async function handlePs(args) {
|
|
85
|
-
const repo = new repository_1.TaskRepository();
|
|
86
|
-
const tasks = repo.getRunningTasks();
|
|
87
|
-
if (tasks.length === 0) {
|
|
88
|
-
console.log('No running tasks.');
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
if (args.includes('--json')) {
|
|
92
|
-
const withLastActive = tasks.map((task) => {
|
|
93
|
-
const lastActive = getLastActive(task);
|
|
94
|
-
return {
|
|
95
|
-
...task,
|
|
96
|
-
last_active_at: lastActive.isoTimestamp,
|
|
97
|
-
log_capable: lastActive.logCapable,
|
|
98
|
-
};
|
|
99
|
-
});
|
|
100
|
-
console.log(JSON.stringify(withLastActive, null, 2));
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const headers = ['TASK ID', 'AGENT', 'PID', 'ELAPSED', 'MODE', 'LAST ACTIVE'];
|
|
104
|
-
const rows = tasks.map(taskToRow);
|
|
105
|
-
renderTable(headers, rows);
|
|
106
|
-
console.log(`\n ${tasks.length} running task(s)`);
|
|
107
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.handlePs=f;const d=require("@crewx/sdk/repository");const u=require("./cal");function c(e){const n=Math.floor(e/1e3);if(n<60)return`${n}s`;const t=Math.floor(n/60);const o=n%60;if(t<60)return`${t}m ${o}s`;const r=Math.floor(t/60);return`${r}h ${t%60}m`}function p(e,n){try{const t=n.readLogsTail(e.id,1)?.entries??[];if(Array.isArray(t)&&t.length>0){const o=t[t.length-1];const r=o?.timestamp;const s=r?new Date(r).getTime():NaN;if(r&&!Number.isNaN(s)){const a=Math.max(0,Date.now()-s);return{display:`${c(a)} ago`,isoTimestamp:r,logCapable:true}}}}catch{}return{display:"\u2014",isoTimestamp:null,logCapable:true}}function g(e,n){const t=c(Date.now()-new Date(e.started_at).getTime());const o=p(e,n);return[e.id,e.agent_id??"\u2014",e.status,e.pid!==null&&e.pid!==void 0?String(e.pid):"\u2014",t,e.mode??"\u2014",o.display]}function m(e,n){const t=e.map((s,a)=>Math.max(s.length,...n.map(i=>(i[a]??"").length)));const o=t.map(s=>"-".repeat(s)).join(" ");const r=e.map((s,a)=>s.padEnd(t[a]??s.length)).join(" ");console.log(r);console.log(o);for(const s of n){console.log(s.map((a,i)=>a.padEnd(t[i]??a.length)).join(" "))}}async function f(e){const n=new d.TaskRepository;const t=await n.reapOrphanedTasks();if(t>0)console.error(`Reaped ${t} orphaned task(s)`);n.reapRunningWorkflowTasks();const o=n.getActiveTasks();if(e.includes("--json")){const a=o.map(i=>{const l=p(i,n);return{...i,last_active_at:l.isoTimestamp,log_capable:l.logCapable}});console.log(JSON.stringify(a,null,2));return}if(o.length===0){console.log("No active tasks.");return}const r=["TASK ID","AGENT","STATUS","PID","ELAPSED","MODE","LAST ACTIVE"];const s=o.map(a=>g(a,n));m(r,s);console.log(`
|
|
2
|
+
${o.length} active task(s)`);(0,u.writeCalFooter)({commandId:"crewx.ps",params:{taskId:o[0].id}})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handlePublish(args: string[]): Promise<void>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";var v=exports&&exports.__createBinding||(Object.create?(function(t,e,r,n){if(n===void 0)n=r;var s=Object.getOwnPropertyDescriptor(e,r);if(!s||("get"in s?!e.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,s)}):(function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]}));var w=exports&&exports.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}):function(t,e){t["default"]=e});var b=exports&&exports.__importStar||(function(){var t=function(e){t=Object.getOwnPropertyNames||function(r){var n=[];for(var s in r)if(Object.prototype.hasOwnProperty.call(r,s))n[n.length]=s;return n};return t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null){for(var n=t(e),s=0;s<n.length;s++)if(n[s]!=="default")v(r,e,n[s])}w(r,e);return r}})();Object.defineProperty(exports,"__esModule",{value:true});exports.handlePublish=j;const _=b(require("fs"));const u=require("@crewx/sdk/account");const f=require("@crewx/sdk/publish");const h=require("./parse-common-flags");function y(t){const e={dryRun:false,json:false,help:false,upload:false};for(let r=0;r<t.length;r++){const n=t[r];if(n==="--help"||n==="-h"){e.help=true;continue}if(n==="--dry-run"){e.dryRun=true;continue}if(n==="--json"){e.json=true;continue}if(n==="--upload"){e.upload=true;continue}if(n==="--version"){const s=t[r+1];if(s===void 0)throw new h.UnknownOptionError("--version requires a value");e.version=s;r++;continue}if(n.startsWith("--version=")){e.version=n.slice("--version=".length);continue}if(n.startsWith("-")){throw new h.UnknownOptionError(`Unknown option: ${n}`)}if(e.dir===void 0){e.dir=n;continue}throw new h.UnknownOptionError(`Unknown option: ${n}`)}return e}function E(t){return t.dir??process.env["CREWX_WORKSPACE"]??process.cwd()}function d(t){console.log(JSON.stringify(t))}function c(t,e){const r=t instanceof Error?t.message:String(t);if(e){d({success:false,error:r})}else{console.error(`\u2717 ${r}`)}process.exit(1)}function $(){console.log(`
|
|
2
|
+
crewx publish \u2014 package a workspace as a distributable template archive
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
crewx publish [dir] [--dry-run] [--version <semver>] [--json] [--upload]
|
|
6
|
+
|
|
7
|
+
Arguments:
|
|
8
|
+
dir Workspace to publish (default: $CREWX_WORKSPACE or cwd)
|
|
9
|
+
|
|
10
|
+
Options:
|
|
11
|
+
--dry-run Scan + build manifest only; do not write a .tgz
|
|
12
|
+
--version <ver> Override manifest version (semver, e.g. 1.0.0)
|
|
13
|
+
--json Print machine-readable JSON to stdout
|
|
14
|
+
--upload Submit + upload the packed archive to marketplace
|
|
15
|
+
(uses the configured account target and a prior login;
|
|
16
|
+
ignored when combined with --dry-run)
|
|
17
|
+
--help, -h Show this help
|
|
18
|
+
|
|
19
|
+
Notes:
|
|
20
|
+
Without --upload, this command only scans the workspace, applies
|
|
21
|
+
exclusion rules, checks for secrets, and packs a local
|
|
22
|
+
.crewx/publish/<name>-<version>.tgz archive.
|
|
23
|
+
`.trim())}function O(){try{const t=(0,u.resolveMarketplaceUrl)();(0,u.assertAccountTargetNotMixed)();return t}catch(t){const e=typeof t==="object"&&t!==null&&"code"in t?t.code:void 0;if(e==="ACCOUNT_TARGET_INVALID"||e==="ACCOUNT_TARGET_MIXED"||e==="MARKETPLACE_DISABLED"||e==="MARKETPLACE_URL_INVALID"){const r=t instanceof Error?t.message:String(t);throw new Error(`publish: [${e}] ${r}`)}throw t}}function k(t){return t instanceof Error&&t.message.includes("publish: [E_AUTH_EXPIRED]")&&/HTTP 401\b/.test(t.message)}async function P(t,e,r){try{return await(0,f.uploadToMarketplace)({...e,accessToken:r})}catch(n){if(!k(n))throw n;const s=await t.refresh();return(0,f.uploadToMarketplace)({...e,accessToken:s.access_token})}}async function j(t){const e=y(t);if(e.help){$();return}const r=E(e);process.stderr.write(`[publish] scanning ${r}...
|
|
24
|
+
`);let n;try{n=await(0,f.planPublish)(r,{version:e.version})}catch(i){c(i,e.json)}if(n.secretFindings.length>0){if(e.json){d({success:false,error:"secret findings detected",findings:n.secretFindings})}else{console.error("\u2717 secret findings detected \u2014 publish aborted");for(const i of n.secretFindings){console.error(` ${i.path}:${i.line} (${i.rule})`)}}process.exit(1)}if(e.dryRun){if(e.json){d({success:true,dryRun:true,workspace:r,manifest:n.manifest,included:n.included,excluded:n.excluded})}else{console.log("\u2713 dry-run \u2014 no archive written");console.log(` workspace: ${r}`);console.log(` name: ${n.manifest.name} version: ${n.manifest.version}`);console.log(` included: ${n.included.length} files`);console.log(` excluded: ${n.excluded.length} entries`);for(const i of n.excluded){console.log(` ${i.path} (${i.rule})`)}}return}let s="";let p="";let l;if(e.upload){try{s=O();l=new u.SessionManager({authClient:new u.AuthClient});p=await l.getAccessToken()}catch(i){if(i instanceof Error&&!i.message.startsWith("publish: [")){c(new Error(`publish: [E_AUTH_EXPIRED] Authentication is missing or expired \u2014 please log in again \u2014 ${i.message}`),e.json)}c(i,e.json)}}process.stderr.write(`[publish] packing ${n.manifest.name}@${n.manifest.version}...
|
|
25
|
+
`);let a;try{a=await(0,f.packTemplate)(r,{version:e.version})}catch(i){c(i,e.json)}const g=a.manifest.files.length;const m=_.statSync(a.tgzPath).size;let o;if(e.upload){process.stderr.write(`[publish] uploading ${a.manifest.name}@${a.manifest.version} to ${s}...
|
|
26
|
+
`);try{if(!l)throw new Error("publish: [E_AUTH_EXPIRED] Account session is unavailable");o=await P(l,{tgzPath:a.tgzPath,manifest:a.manifest,baseUrl:s},p)}catch(i){c(i,e.json)}process.stderr.write(`[publish] submit -> ${o.submitOutcome}
|
|
27
|
+
`)}if(e.json){d({success:true,tgzPath:a.tgzPath,fileCount:g,totalBytes:m,manifest:a.manifest,...o?{slug:o.slug,version:o.version,artifactChecksum:o.artifactChecksum,artifactSizeBytes:o.artifactSizeBytes,submitOutcome:o.submitOutcome,versionUpdate:o.versionUpdate,serverVersionBefore:o.serverVersionBefore}:{}})}else{console.log(`\u2713 packed: ${a.tgzPath}`);console.log(` files: ${g} bytes: ${m}`);if(o){console.log(`\u2713 uploaded: ${o.slug}@${o.version} (${o.submitOutcome})`);console.log(` artifactChecksum: ${o.artifactChecksum} artifactSizeBytes: ${o.artifactSizeBytes}`)}}if(!e.upload){console.error("\u26A0 To upload, use --upload \u2014 check the generated file path")}}
|
package/dist/commands/query.d.ts
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
* Parses args, loads config via Crewx SDK, and executes the query.
|
|
4
4
|
*
|
|
5
5
|
* Flags:
|
|
6
|
+
* --to <agent> Explicit recipient (the positional @agent form is shorthand)
|
|
6
7
|
* --thread <name> Conversation thread name
|
|
7
8
|
* --provider <cli/xxx> Provider override
|
|
9
|
+
* --model <name> Model override (e.g. claude-sonnet-5)
|
|
8
10
|
* --metadata <json> Extra metadata JSON (double-quoted object). Propagated to events/hooks/tracing.
|
|
9
11
|
* e.g. --metadata='{"workflow_id":"wf-1"}'
|
|
10
12
|
* --verbose Debug output mode (default: raw agent response only)
|
|
@@ -12,16 +14,19 @@
|
|
|
12
14
|
* --output-format <fmt> Output format (json|text|stream-json)
|
|
13
15
|
* --effort <level> Model effort (high|medium|low)
|
|
14
16
|
* -f/--prompt-file <path> Read prompt body from file (bypasses cmd.exe argv truncation)
|
|
17
|
+
* --detach/--async Persist a receipt and launch a detached runner
|
|
18
|
+
* --wait Force synchronous execution
|
|
15
19
|
*
|
|
16
20
|
* Stdin support:
|
|
17
21
|
* Pipe or redirect content into crewx q to supply the prompt body via stdin.
|
|
18
|
-
* e.g. cat brief.md | crewx q
|
|
22
|
+
* e.g. cat brief.md | crewx q --to agent label
|
|
19
23
|
* Stdin is ignored when running in an interactive TTY.
|
|
20
24
|
*/
|
|
25
|
+
import { type DelegationEmitState } from './emit-trailer';
|
|
21
26
|
/**
|
|
22
27
|
* Handle `crewx query <agentRef> <message>` command.
|
|
23
28
|
*
|
|
24
29
|
* Default output: raw agent response only (stdout).
|
|
25
30
|
* --verbose: debug info written to stderr, response to stdout.
|
|
26
31
|
*/
|
|
27
|
-
export declare function handleQuery(args: string[]): Promise<void>;
|
|
32
|
+
export declare function handleQuery(args: string[], command?: string, emitState?: DelegationEmitState): Promise<void>;
|