@crewx/cli 0.9.0-rc.10 → 0.9.0-rc.100
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 +13 -0
- package/dist/bootstrap/codex-writable-roots.js +25 -0
- package/dist/bootstrap/crewx-cli.js +7 -2
- package/dist/builtin.js +1 -0
- package/dist/commands/agent.js +0 -58
- package/dist/commands/cal.d.ts +15 -0
- package/dist/commands/cal.js +44 -0
- package/dist/commands/db.d.ts +2 -0
- package/dist/commands/db.js +381 -1
- package/dist/commands/detached.d.ts +65 -0
- package/dist/commands/detached.js +507 -0
- package/dist/commands/doctor.d.ts +53 -0
- package/dist/commands/doctor.js +391 -21
- package/dist/commands/emit-trailer.d.ts +25 -0
- package/dist/commands/emit-trailer.js +33 -0
- package/dist/commands/execute.d.ts +7 -4
- package/dist/commands/execute.js +118 -17
- package/dist/commands/hook/command-marker.d.ts +2 -0
- package/dist/commands/hook/command-marker.js +5 -0
- package/dist/commands/hook/install.d.ts +0 -1
- package/dist/commands/hook/install.js +60 -63
- package/dist/commands/hook/status.js +3 -3
- package/dist/commands/hook/uninstall.js +2 -2
- package/dist/commands/init.js +22 -1
- package/dist/commands/kill.d.ts +2 -8
- package/dist/commands/kill.js +6 -47
- package/dist/commands/log.js +4 -3
- package/dist/commands/parse-common-flags.d.ts +5 -1
- package/dist/commands/parse-common-flags.js +6 -2
- package/dist/commands/ps.d.ts +2 -2
- package/dist/commands/ps.js +25 -15
- package/dist/commands/publish.d.ts +1 -0
- package/dist/commands/publish.js +303 -0
- package/dist/commands/query.d.ts +5 -1
- package/dist/commands/query.js +110 -11
- package/dist/commands/registry.js +4 -2
- package/dist/commands/result.d.ts +8 -3
- package/dist/commands/result.js +139 -7
- package/dist/commands/shortcut.d.ts +1 -0
- package/dist/commands/shortcut.js +267 -0
- package/dist/commands/slack.js +2 -1
- package/dist/commands/stop.d.ts +8 -0
- package/dist/commands/stop.js +119 -0
- package/dist/commands/write-output.d.ts +3 -0
- package/dist/commands/write-output.js +24 -0
- package/dist/logging.d.ts +1 -1
- package/dist/logging.js +3 -2
- package/dist/main.d.ts +3 -2
- package/dist/main.js +66 -16
- package/dist/utils/env-defaults.d.ts +2 -5
- package/dist/utils/env-defaults.js +10 -5
- package/dist/utils/inherited-trace.d.ts +24 -0
- package/dist/utils/inherited-trace.js +40 -0
- package/dist/utils/sdk-compat.d.ts +24 -0
- package/dist/utils/sdk-compat.js +120 -0
- package/package.json +14 -11
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Re-exported from @crewx/sdk for convenience.
|
|
4
|
-
*/
|
|
5
|
-
export { resolveCrewxCli, resolveCrewxWorkspace } from '@crewx/sdk';
|
|
1
|
+
export declare function resolveCrewxCli(): string;
|
|
2
|
+
export declare function resolveCrewxWorkspace(): string;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.resolveCrewxCli = resolveCrewxCli;
|
|
4
|
+
exports.resolveCrewxWorkspace = resolveCrewxWorkspace;
|
|
4
5
|
/**
|
|
5
6
|
* CREWX_* environment variable defaults for CLI bootstrap.
|
|
6
|
-
*
|
|
7
|
+
* Routed through the SDK compatibility accessor for older SDK installations.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const sdk_compat_1 = require("./sdk-compat");
|
|
10
|
+
function resolveCrewxCli() {
|
|
11
|
+
return sdk_compat_1.sdkCompat.resolveCrewxCli();
|
|
12
|
+
}
|
|
13
|
+
function resolveCrewxWorkspace() {
|
|
14
|
+
return sdk_compat_1.sdkCompat.resolveCrewxWorkspace();
|
|
15
|
+
}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import type { TraceContext } from '@crewx/sdk';
|
|
2
|
+
export interface InheritedRunnerIdentity {
|
|
3
|
+
assignedTaskId?: string;
|
|
4
|
+
detachedRunner: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Consume the runner-only identity exactly once.
|
|
8
|
+
*
|
|
9
|
+
* These variables are a one-hop capability, not trace context. Keeping the
|
|
10
|
+
* values in this module lets the current CLI process use them while deleting
|
|
11
|
+
* them from process.env prevents later child processes from inheriting the
|
|
12
|
+
* receipt runner identity.
|
|
13
|
+
*/
|
|
14
|
+
export declare function consumeInheritedRunnerIdentity(): InheritedRunnerIdentity;
|
|
15
|
+
/** Test-only reset for the module-level one-shot cache. */
|
|
16
|
+
export declare function resetInheritedRunnerIdentityForTests(): void;
|
|
2
17
|
/**
|
|
3
18
|
* Read cross-process trace context from inherited environment variables.
|
|
4
19
|
*
|
|
@@ -10,3 +25,12 @@ import type { TraceContext } from '@crewx/sdk';
|
|
|
10
25
|
* Returns undefined when none of the three vars are set (root invocation).
|
|
11
26
|
*/
|
|
12
27
|
export declare function readInheritedTrace(): TraceContext | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Read the pre-assigned task id carried only by a detached runner.
|
|
30
|
+
*
|
|
31
|
+
* This is deliberately separate from readInheritedTrace(): trace variables
|
|
32
|
+
* describe the caller's chain and must not be used as this task's identity.
|
|
33
|
+
*/
|
|
34
|
+
export declare function readRunnerAssignment(): string | undefined;
|
|
35
|
+
/** Return true only for the final detached runner process. */
|
|
36
|
+
export declare function isDetachedRunner(): boolean;
|
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.consumeInheritedRunnerIdentity = consumeInheritedRunnerIdentity;
|
|
4
|
+
exports.resetInheritedRunnerIdentityForTests = resetInheritedRunnerIdentityForTests;
|
|
3
5
|
exports.readInheritedTrace = readInheritedTrace;
|
|
6
|
+
exports.readRunnerAssignment = readRunnerAssignment;
|
|
7
|
+
exports.isDetachedRunner = isDetachedRunner;
|
|
8
|
+
let inheritedRunnerIdentity;
|
|
9
|
+
/**
|
|
10
|
+
* Consume the runner-only identity exactly once.
|
|
11
|
+
*
|
|
12
|
+
* These variables are a one-hop capability, not trace context. Keeping the
|
|
13
|
+
* values in this module lets the current CLI process use them while deleting
|
|
14
|
+
* them from process.env prevents later child processes from inheriting the
|
|
15
|
+
* receipt runner identity.
|
|
16
|
+
*/
|
|
17
|
+
function consumeInheritedRunnerIdentity() {
|
|
18
|
+
if (inheritedRunnerIdentity !== undefined)
|
|
19
|
+
return inheritedRunnerIdentity;
|
|
20
|
+
const assignedTaskId = process.env['CREWX_ASSIGNED_TASK_ID']?.trim() || undefined;
|
|
21
|
+
const detachedRunner = process.env['CREWX_DETACHED_RUNNER'] === '1';
|
|
22
|
+
delete process.env['CREWX_ASSIGNED_TASK_ID'];
|
|
23
|
+
delete process.env['CREWX_DETACHED_RUNNER'];
|
|
24
|
+
inheritedRunnerIdentity = { assignedTaskId, detachedRunner };
|
|
25
|
+
return inheritedRunnerIdentity;
|
|
26
|
+
}
|
|
27
|
+
/** Test-only reset for the module-level one-shot cache. */
|
|
28
|
+
function resetInheritedRunnerIdentityForTests() {
|
|
29
|
+
inheritedRunnerIdentity = undefined;
|
|
30
|
+
}
|
|
4
31
|
/**
|
|
5
32
|
* Read cross-process trace context from inherited environment variables.
|
|
6
33
|
*
|
|
@@ -23,3 +50,16 @@ function readInheritedTrace() {
|
|
|
23
50
|
callerAgentId,
|
|
24
51
|
};
|
|
25
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Read the pre-assigned task id carried only by a detached runner.
|
|
55
|
+
*
|
|
56
|
+
* This is deliberately separate from readInheritedTrace(): trace variables
|
|
57
|
+
* describe the caller's chain and must not be used as this task's identity.
|
|
58
|
+
*/
|
|
59
|
+
function readRunnerAssignment() {
|
|
60
|
+
return consumeInheritedRunnerIdentity().assignedTaskId;
|
|
61
|
+
}
|
|
62
|
+
/** Return true only for the final detached runner process. */
|
|
63
|
+
function isDetachedRunner() {
|
|
64
|
+
return consumeInheritedRunnerIdentity().detachedRunner;
|
|
65
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CrewxExecutableResolution } from '@crewx/sdk';
|
|
2
|
+
type PricingInitializer = () => Promise<unknown> | unknown;
|
|
3
|
+
export interface SdkLike {
|
|
4
|
+
resolveCrewxCli?: () => string;
|
|
5
|
+
resolveCrewxCliArgv?: () => CrewxExecutableResolution;
|
|
6
|
+
resolveCrewxWorkspace?: () => string;
|
|
7
|
+
initPricingRemote?: PricingInitializer;
|
|
8
|
+
}
|
|
9
|
+
export interface SdkCompat {
|
|
10
|
+
resolveCrewxCli(): string;
|
|
11
|
+
resolveCrewxCliArgv(): CrewxExecutableResolution;
|
|
12
|
+
resolveCrewxWorkspace(): string;
|
|
13
|
+
initPricingRemote(): void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create the CLI bootstrap capability accessor for the installed SDK.
|
|
17
|
+
*
|
|
18
|
+
* SDK exports are additive across compatible majors, so an older SDK may not
|
|
19
|
+
* expose every capability that a newer CLI knows about. Optional capabilities
|
|
20
|
+
* are checked here rather than at each bootstrap call site.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createSdkCompat(sdkLike?: SdkLike): SdkCompat;
|
|
23
|
+
export declare const sdkCompat: SdkCompat;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.sdkCompat = void 0;
|
|
37
|
+
exports.createSdkCompat = createSdkCompat;
|
|
38
|
+
const sdk = __importStar(require("@crewx/sdk"));
|
|
39
|
+
function formatLegacyArgv(argv) {
|
|
40
|
+
const formatter = sdk.formatCrewxExecutableArgv;
|
|
41
|
+
if (typeof formatter === 'function')
|
|
42
|
+
return formatter(argv);
|
|
43
|
+
// Older SDKs may expose the argv resolver before exposing its formatter.
|
|
44
|
+
// Keep this compatibility-only fallback one-way and quote every token.
|
|
45
|
+
if (process.platform === 'win32') {
|
|
46
|
+
return argv
|
|
47
|
+
.map((value) => {
|
|
48
|
+
const escaped = value
|
|
49
|
+
.replace(/(\\*)"/g, '$1$1\\"')
|
|
50
|
+
.replace(/(\\+)$/g, '$1$1');
|
|
51
|
+
return `"${escaped}"`;
|
|
52
|
+
})
|
|
53
|
+
.join(' ');
|
|
54
|
+
}
|
|
55
|
+
return argv.map((value) => `'${value.replace(/'/g, `'\\''`)}'`).join(' ');
|
|
56
|
+
}
|
|
57
|
+
const FALLBACK_CREWX_CLI_DISPLAY = 'crewx';
|
|
58
|
+
function missingCliResolver() {
|
|
59
|
+
return {
|
|
60
|
+
ok: false,
|
|
61
|
+
reason: 'The installed SDK does not expose the argv-based CrewX CLI resolver.',
|
|
62
|
+
attempts: [
|
|
63
|
+
{ stage: 'env', reason: 'argv resolver capability is unavailable' },
|
|
64
|
+
{ stage: 'self', reason: 'argv resolver capability is unavailable' },
|
|
65
|
+
{ stage: 'workspace', reason: 'argv resolver capability is unavailable' },
|
|
66
|
+
{ stage: 'module', reason: 'argv resolver capability is unavailable' },
|
|
67
|
+
{ stage: 'path', reason: 'argv resolver capability is unavailable' },
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Create the CLI bootstrap capability accessor for the installed SDK.
|
|
73
|
+
*
|
|
74
|
+
* SDK exports are additive across compatible majors, so an older SDK may not
|
|
75
|
+
* expose every capability that a newer CLI knows about. Optional capabilities
|
|
76
|
+
* are checked here rather than at each bootstrap call site.
|
|
77
|
+
*/
|
|
78
|
+
function createSdkCompat(sdkLike = sdk) {
|
|
79
|
+
return {
|
|
80
|
+
resolveCrewxCli: () => {
|
|
81
|
+
const configured = process.env.CREWX_CLI;
|
|
82
|
+
if (configured?.trim())
|
|
83
|
+
return configured;
|
|
84
|
+
if (typeof sdkLike.resolveCrewxCliArgv === 'function') {
|
|
85
|
+
const resolution = sdkLike.resolveCrewxCliArgv();
|
|
86
|
+
if (resolution.ok)
|
|
87
|
+
return formatLegacyArgv(resolution.argv);
|
|
88
|
+
}
|
|
89
|
+
if (typeof sdkLike.resolveCrewxCli === 'function') {
|
|
90
|
+
const value = sdkLike.resolveCrewxCli();
|
|
91
|
+
if (value.trim())
|
|
92
|
+
return value;
|
|
93
|
+
}
|
|
94
|
+
return FALLBACK_CREWX_CLI_DISPLAY;
|
|
95
|
+
},
|
|
96
|
+
resolveCrewxCliArgv: () => {
|
|
97
|
+
if (typeof sdkLike.resolveCrewxCliArgv === 'function') {
|
|
98
|
+
return sdkLike.resolveCrewxCliArgv();
|
|
99
|
+
}
|
|
100
|
+
return missingCliResolver();
|
|
101
|
+
},
|
|
102
|
+
resolveCrewxWorkspace: () => {
|
|
103
|
+
if (typeof sdkLike.resolveCrewxWorkspace === 'function') {
|
|
104
|
+
return sdkLike.resolveCrewxWorkspace();
|
|
105
|
+
}
|
|
106
|
+
return process.env.CREWX_WORKSPACE || process.cwd();
|
|
107
|
+
},
|
|
108
|
+
initPricingRemote: () => {
|
|
109
|
+
if (typeof sdkLike.initPricingRemote !== 'function')
|
|
110
|
+
return;
|
|
111
|
+
try {
|
|
112
|
+
void Promise.resolve(sdkLike.initPricingRemote()).catch(() => undefined);
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
// Remote pricing is optional and must not block CLI startup.
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
exports.sdkCompat = createSdkCompat();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewx/cli",
|
|
3
|
-
"version": "0.9.0-rc.
|
|
3
|
+
"version": "0.9.0-rc.100",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.19.0"
|
|
@@ -23,18 +23,21 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@crewx/adapter-slack": "0.1.4",
|
|
25
25
|
"better-sqlite3": "*",
|
|
26
|
+
"dotenv": "17.2.3",
|
|
26
27
|
"isomorphic-git": "1.37.1",
|
|
27
|
-
"@crewx/sdk": "0.9.0-rc.
|
|
28
|
-
"@crewx/
|
|
29
|
-
"@crewx/
|
|
30
|
-
"@crewx/
|
|
31
|
-
"@crewx/
|
|
32
|
-
"@crewx/
|
|
28
|
+
"@crewx/sdk": "0.9.0-rc.100",
|
|
29
|
+
"@crewx/memory": "0.1.23-rc.117",
|
|
30
|
+
"@crewx/search": "0.1.10-rc.96",
|
|
31
|
+
"@crewx/doc": "0.1.9-rc.93",
|
|
32
|
+
"@crewx/knowledge-core": "0.1.17-rc.110",
|
|
33
|
+
"@crewx/wbs": "0.1.10-rc.126",
|
|
34
|
+
"@crewx/workflow": "0.3.22-rc.146",
|
|
35
|
+
"@crewx/wi": "0.1.10-rc.120",
|
|
36
|
+
"@crewx/cron": "0.1.10-rc.135",
|
|
33
37
|
"@crewx/skill": "0.1.20",
|
|
34
|
-
"@crewx/
|
|
35
|
-
"@crewx/
|
|
36
|
-
"@crewx/
|
|
37
|
-
"@crewx/wi": "0.1.10"
|
|
38
|
+
"@crewx/shared": "0.0.6",
|
|
39
|
+
"@crewx/notify": "0.1.0-rc.71",
|
|
40
|
+
"@crewx/chromex": "0.1.0-rc.133"
|
|
38
41
|
},
|
|
39
42
|
"devDependencies": {
|
|
40
43
|
"@types/better-sqlite3": "*",
|